Thursday, 5 September 2013

Maintaining a Debian/Ubuntu repository on Redhat (or other linuxes)

At work we have a repo server that runs Redhat.  I couldn't find a good way to maintain a Debian/Ubuntu repository on it, so I built a solution.

Basically I built a chroot environment that when run takes packages from the incoming folder and turns them into a repository that you can put on your webserver.

I'm sure there are more elegant solutions (though I couldn't find them), but this serves my purpose at least.

This script will create the chroot environment for you.  Run the script on a debian box, copy the tar ball to another server, untar it, put files in the incoming directory and run the included script.

Monday, 11 March 2013

Fixing broken trust relationships in windows server

I was looking around for a reference to send to a colleague who had a server lose it's domain relationship and found this one which seems to work really well.

Basically, log in to the affected server and run:
netdom.exe resetpwd /s:<DC hostname> /ud:<domain\user> /pd:*

Thursday, 3 January 2013

Over riding puppet modules

I've discovered that you can overload parts of puppet modules.  This means I can still use the module but just overload what I need.

Of course, modifying the module may be tidier but modifying a module used by lots of production servers is not a trivial undertaking.

Here's how it works:

class systems::section::authssh inherits auth::ssh {
   File['/etc/pam.d/sshd']{
      content=>"blah"
  }
}

This means I get all the good stuff from auth::ssh but I can override the sshd pam configuration for this server/group of servers.

The case I was dealing with was a bit more complicated (though same concept), in modules I have auth::thistype which includes auth::pam

I would normally include auth::thistype and just to complicate things the setting I want to change is in auth::pam.  Unfortunately (in this case) puppet won't let you modify an argument in a class that isn't the one setting it (or a sub class thereof) so I can't set it in the class as above, I need to set it in the correct class, like this:

class systems::section::auththistype inherits auth::thistype {
  include systems::section::authpam
}

class systems::section::authpam inherits auth::pam {
   File['/etc/pam.d/sshd']{
      content=>"blah"
  }
}

(Please note, code sections were genericised and should be used as reference only)