Move cert stuff to the puppet setup file
[mirror/dsa-wiki.git] / input / howto / puppet-setup.mdwn
1 # Puppet infrastructure
2
3 handel.debian.org is our current puppetmaster.  Currently, it handles
4 configuration of samhain, munin, apt, and exim (although more to come -
5 this list is likely to get out of date quickly).
6
7 To set up a new host to be a puppet client, do the following:
8
9 Make sure you have set up the IP address for the new machine in ud-ldap.
10 After that run puppet on puppetmaster once, so the ferm config get
11 adjusted.
12
13         : __handel__ && puppet agent -t --environment=production
14
15         : ::client:: && me=$(hostname -f) && [ "$me" != "${me%debian.org}" ] && apt-get update &&
16                 apt-get install -y --no-install-recommends puppet libaugeas-ruby1.8 augeas-lenses lsb-release &&
17                 service puppet stop &&
18                 (puppet agent -t || true ) &&
19                 cd /var/lib/puppet/ssl/certificate_requests &&
20                 echo sha256sum output: && echo &&
21                 sha256sum $me.pem &&
22                 echo && echo && cd /
23
24 This will not overwrite anything yet, since handel has not signed the
25 client cert.  Now is the time to abort if you are getting cold feet.
26
27 Compare incoming csr request:
28 on handel, paste the sha256output::
29
30         : __handel__ && echo "paste sha256sum output now:" &&
31                 read sha256 filename &&
32                 cd /var/lib/puppet/ssl/ca/requests &&
33                 ( [ -e $filename ] || (echo "$filename does not exist."; exit 1) ) &&
34                 echo -e "$sha256  $filename" | sha256sum -c &&
35                 puppetca --sign $(basename "$filename" .pem) &&
36                 echo && echo && echo &&
37                 echo 'cat > /var/lib/puppet/ssl/certs/ca.pem << EOF ' &&
38                 cat /var/lib/puppet/ssl/certs/ca.pem &&
39                 echo 'EOF' &&
40                 echo "cat > /var/lib/puppet/ssl/certs/$filename << EOF " &&
41                 cat /var/lib/puppet/ssl/ca/signed/$filename &&
42                 echo 'EOF' &&
43                 cd /
44
45 and execute this on the client.
46
47         : ::client:: copy paste the thing you just created on handel
48
49 If this is a busy mail host, you might want to stop exim before proceeding
50 although the config files should remain identical before and after.
51
52 Then run (this will change the configs in /etc):
53
54         : ::client:: && puppet agent -t --pluginsync
55
56 This run will start puppet after reconfiguring it, so if you are
57 unhappy with what just happened, you'll need to stop it again to do
58 repair.
59
60 Double check apt - the puppet setup usually results in duplicate apt
61 sources, since we ship a few under sources.list.d.  Remove any unnecessary
62 entries from sources.list.
63
64 On handel, make sure the certs exist for the new host
65
66   : :: handel :: : && sudo -u puppet make -C /srv/puppet.debian.org/ca/ install
67
68 We ship a samhain config file that includes /lib and /usr/lib.  This will
69 almost certainly be different than the config file on the machine, so it
70 will result in 1000s of files changed.
71 You may need to run samhain update after getting puppet going.
72
73 # vim:textwidth=72 sw=8 ts=8 et