puppet cert streamlining
[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__ &&
31                 ud-replicate && sudo -u puppet make -C /srv/puppet.debian.org/ca/ install &&
32                 echo "paste sha256sum output now:" &&
33                 read sha256 filename &&
34                 cd /var/lib/puppet/ssl/ca/requests &&
35                 ( [ -e $filename ] || (echo "$filename does not exist."; exit 1) ) &&
36                 echo -e "$sha256  $filename" | sha256sum -c &&
37                 puppetca --sign $(basename "$filename" .pem) &&
38                 echo && echo && echo &&
39                 echo 'cat > /var/lib/puppet/ssl/certs/ca.pem << EOF ' &&
40                 cat /var/lib/puppet/ssl/certs/ca.pem &&
41                 echo 'EOF' &&
42                 echo "cat > /var/lib/puppet/ssl/certs/$filename << EOF " &&
43                 cat /var/lib/puppet/ssl/ca/signed/$filename &&
44                 echo 'EOF' &&
45                 cd /
46
47 and execute this on the client.
48
49         : ::client:: copy paste the thing you just created on handel
50
51 If this is a busy mail host, you might want to stop exim before proceeding
52 although the config files should remain identical before and after.
53
54 Then run (this will change the configs in /etc):
55
56         : ::client:: && puppet agent -t --pluginsync
57
58 This run will start puppet after reconfiguring it, so if you are
59 unhappy with what just happened, you'll need to stop it again to do
60 repair.
61
62 Double check apt - the puppet setup usually results in duplicate apt
63 sources, since we ship a few under sources.list.d.  Remove any unnecessary
64 entries from sources.list.
65
66 On handel, make sure the certs exist for the new host
67
68
69 We ship a samhain config file that includes /lib and /usr/lib.  This will
70 almost certainly be different than the config file on the machine, so it
71 will result in 1000s of files changed.
72 You may need to run samhain update after getting puppet going.
73
74 # vim:textwidth=72 sw=8 ts=8 et