Add information about the git-pull-hook on puppet
[cacert-infradocs.git] / docs / systems / puppet.rst
1 .. index::
2 single: Systems; Puppet
3
4 ======
5 Puppet
6 ======
7
8 Purpose
9 =======
10
11 This system acts as `Puppet`_ master for infrastructure systems.
12
13 .. _Puppet: https://docs.puppet.com/puppet/
14
15 Application Links
16 -----------------
17
18 This system has no publicly visible URLs.
19
20
21 Administration
22 ==============
23
24 System Administration
25 ---------------------
26
27 * Primary: :ref:`people_jandd`
28 * Secondary: None
29
30 .. todo:: find an additional admin
31
32 Application Administration
33 --------------------------
34
35 +---------------+---------------------+
36 | Application | Administrator(s) |
37 +===============+=====================+
38 | Puppet server | :ref:`people_jandd` |
39 +---------------+---------------------+
40 | PuppetDB | :ref:`people_jandd` |
41 +---------------+---------------------+
42
43 Contact
44 -------
45
46 * puppet-admin@cacert.org
47
48 Additional People
49 -----------------
50
51 * None
52
53 Basics
54 ======
55
56 Physical Location
57 -----------------
58
59 This system is located in an :term:`LXC` container on physical machine
60 :doc:`infra02`.
61
62 Logical Location
63 ----------------
64
65 :IP Internet: None
66 :IP Intranet: None
67 :IP Internal: :ip:v4:`10.0.0.200`
68 :IPv6: :ip:v6:`2001:7b8:616:162:2::200`
69 :MAC address: :mac:`00:ff:f9:32:9d:2a` (eth0)
70
71 .. seealso::
72
73 See :doc:`../network`
74
75 DNS
76 ---
77
78 .. index::
79 single: DNS records; Puppet
80
81 .. todo:: setup DNS records (in infra.cacert.org zone)
82
83 .. seealso::
84
85 See :wiki:`SystemAdministration/Procedures/DNSChanges`
86
87 Operating System
88 ----------------
89
90 .. index::
91 single: Debian GNU/Linux; Stretch
92 single: Debian GNU/Linux; 9.4
93
94 * Debian GNU/Linux 9.4
95
96 Applicable Documentation
97 ------------------------
98
99 This is it :-)
100
101 Services
102 ========
103
104 Listening services
105 ------------------
106
107 +----------+-----------+-----------+------------------------------------------+
108 | Port | Service | Origin | Purpose |
109 +==========+===========+===========+==========================================+
110 | 22/tcp | ssh | ANY | admin console access |
111 +----------+-----------+-----------+------------------------------------------+
112 | 25/tcp | smtp | local | mail delivery to local MTA |
113 +----------+-----------+-----------+------------------------------------------+
114 | 5432/tcp | pgsql | local | PostgreSQL database for PuppetDB |
115 +----------+-----------+-----------+------------------------------------------+
116 | 8000/tcp | git-hook | internal | HTTP endpoint for git-pull-hook |
117 +----------+-----------+-----------+------------------------------------------+
118 | 8140/tcp | puppet | internal | Puppet master |
119 +----------+-----------+-----------+------------------------------------------+
120 | 8080/tcp | puppetdb | local | HTTP endpoint for local PuppetDB queries |
121 +----------+-----------+-----------+------------------------------------------+
122 | 8081/tcp | puppetdb | internal | HTTPS endpoint for PuppetDB |
123 +----------+-----------+-----------+------------------------------------------+
124
125 Running services
126 ----------------
127
128 .. index::
129 single: cron
130 single: exim
131 single: git-pull-hook
132 single: openssh
133 single: postgresql
134 single: puppet agent
135 single: puppet server
136 single: puppetdb
137 single: rsyslog
138
139 +--------------------+--------------------+----------------------------------------+
140 | Service | Usage | Start mechanism |
141 +====================+====================+========================================+
142 | cron | job scheduler | init script :file:`/etc/init.d/cron` |
143 +--------------------+--------------------+----------------------------------------+
144 | Exim | SMTP server for | init script |
145 | | local mail | :file:`/etc/init.d/exim4` |
146 | | submission | |
147 +--------------------+--------------------+----------------------------------------+
148 | git-pull-hook | Custom Python3 | init script |
149 | | hook to pull git | :file:`/etc/init.d/git-pull-hook` |
150 | | changes from the | |
151 | | cacert-puppet | |
152 | | repository | |
153 +--------------------+--------------------+----------------------------------------+
154 | openssh server | ssh daemon for | init script :file:`/etc/init.d/ssh` |
155 | | remote | |
156 | | administration | |
157 +--------------------+--------------------+----------------------------------------+
158 | PostgreSQL | PostgreSQL | init script |
159 | | database server | :file:`/etc/init.d/postgresql` |
160 | | for PuppetDB | |
161 +--------------------+--------------------+----------------------------------------+
162 | Puppet server | Puppet master for | init script |
163 | | infrastructure | :file:`/etc/init.d/puppetserver` |
164 | | systems | |
165 +--------------------+--------------------+----------------------------------------+
166 | Puppet agent | local Puppet agent | init script |
167 | | | :file:`/etc/init.d/puppet` |
168 +--------------------+--------------------+----------------------------------------+
169 | PuppetDB | PuppetDB for | init script |
170 | | querying Puppet | :file:`/etc/init.d/puppetdb` |
171 | | facts and nodes | |
172 | | and resources | |
173 +--------------------+--------------------+----------------------------------------+
174 | rsyslog | syslog daemon | init script |
175 | | | :file:`/etc/init.d/syslog` |
176 +--------------------+--------------------+----------------------------------------+
177
178 Databases
179 ---------
180
181 +-------------+----------+-------------------+
182 | RDBMS | Name | Used for |
183 +=============+==========+===================+
184 | PostgreSQL | puppetdb | PuppetDB database |
185 +-------------+----------+-------------------+
186
187 Connected Systems
188 -----------------
189
190 * :doc:`bugs`
191 * :doc:`ircserver`
192 * :doc:`jenkins`
193 * :doc:`monitor`
194 * :doc:`motion`
195 * :doc:`proxyin`
196 * :doc:`proxyout`
197 * :doc:`svn`
198 * :doc:`translations`
199 * :doc:`web`
200 * :doc:`webstatic`
201 * :doc:`git` for triggering the git-pull-hook on newly pushed commits to the
202 cacert-puppet repository
203
204 Outbound network connections
205 ----------------------------
206
207 * :doc:`infra02` as resolving nameserver
208 * :doc:`emailout` as SMTP relay
209 * :doc:`git` to fetch new commits from the cacert-puppet repository
210 * :doc:`proxyout` as HTTP proxy for APT
211 * forgeapi.puppet.com for Puppet forge access
212 * rubygems.org for Puppet specific Ruby gems
213
214 Security
215 ========
216
217 .. sshkeys::
218 :RSA: SHA256:PPEZkD7ezGStENYmE9/RftHqJyy6cC9IN6zw63OvJTM MD5:54:57:b0:09:46:ba:56:95:5e:e3:35:df:28:27:ed:c5
219 :ECDSA: SHA256:3U1CVC9YAKmF9W5SDLibwP1A9MVSb5ltVN7nYNOE15o MD5:29:06:f1:71:8d:65:3e:39:7c:49:69:16:8d:99:97:15
220 :ED25519: SHA256:AkqMLLEtMbAEuxniRRDgd7TItD+pb9hsbpn5Ab81+IM MD5:53:dc:e7:4d:25:89:a8:d5:5a:24:0b:06:3f:41:cd:4d
221
222 Non-distribution packages and modifications
223 -------------------------------------------
224
225 The Puppet server, Puppet agent and PuppetDB packages and a few dependencies
226 are installed from the official Puppet APT repository because the versions
227 in Debian are too old to use modern Puppet features.
228
229 Some rubygems are installed via the puppet specific ruby gem binary to support
230 advanced Puppet functionality like hiera-eyaml.
231
232 All puppet related code is installed in the Puppet specific /opt/puppetlabs
233 tree.
234
235 Risk assessments on critical packages
236 -------------------------------------
237
238 The system uses third party packages with a good security track record and
239 regular updates. The attack surface is small due to the tightly restricted
240 access to the system.
241
242 Critical Configuration items
243 ============================
244
245 Keys and X.509 certificates
246 ---------------------------
247
248 Puppet comes with its own inbuilt special purpose CA that is used to sign the
249 Puppet server and Puppet DB certificates as well as the certificates of all
250 trusted Puppet agents.
251
252 The CA data is stored in :file:`/etc/puppetlabs/puppet/ssl` and managed by
253 puppet itself.
254
255
256 Eyaml private key
257 -----------------
258
259 All sensitive data like passwords in Hiera data is encrypted using the public
260 key in :file:`keys/public_key.pkcs7.pem` in the `CAcert puppet Git repository
261 <ssh://git.cacert.org/var/cache/git/cacert-puppet.git>`_. The corresponding
262 private key is stored in
263 :file:`/etc/puppetlabs/code/environments/production/keys/private_key.pkcs7.pem`.
264
265
266 hiera configuration
267 -------------------
268
269 Puppet uses Hiera for hierarchical information retrieval. The global hiera
270 configuration is stored in :file:`/etc/puppetlabs/puppet/hiera.yaml` and
271 defines the hierarchy lookup as well as the eyaml key locations.
272
273
274 puppet configuration
275 --------------------
276
277 All puppet configuration is stored in :file:`/etc/puppetlabs/`. The CAcert
278 specific puppet code is taken from the `CAcert puppet Git repository
279 <ssh://git.cacert.org/var/cache/git/cacert-puppet.git>`_ and cloned to
280 :file:`/etc/puppetlabs/code/environments/production/` directory. Required
281 Puppet modules are installed by :program:`/opt/puppetlabs/puppet/bin/r10k`.
282
283 The puppet code should follow best practices like the Roles and profiles
284 pattern (see references below) and code/data separation via Hiera.
285
286 Updates to the cacert-puppet repository trigger a web hook listening on tcp
287 port 8000 that automatically updates the production environment directory.
288
289
290 Tasks
291 =====
292
293 Planned
294 -------
295
296 * migrate as many systems as possible to use Puppet for a more
297 reproducible/auditable system setup
298 * automate updates of the Puppet code from Git
299
300 .. todo:: improve Webhook to run r10k after git pull
301
302 Changes
303 =======
304
305 System Future
306 -------------
307
308 * Improve setup, use more widely
309
310 Additional documentation
311 ========================
312
313 .. seealso::
314
315 * :wiki:`Exim4Configuration`
316
317 References
318 ----------
319
320 * https://docs.puppet.com/puppet/
321 * https://puppet.com/blog/encrypt-your-data-using-hiera-eyaml
322 * https://docs.puppet.com/pe/2016.5/r_n_p_full_example.html