3 # Stuff common to all debian.org servers
6 include debian_org::apt
10 $servicefiles = 'present'
12 $servicefiles = 'absent'
15 # the virtual facter needs virt-what on jessie to work
16 if versioncmp($::lsbmajdistrelease, '9') < 0 {
17 package { 'virt-what': ensure => installed }
19 package { 'virt-what': ensure => purged }
22 $samhain_recipients = hiera('samhain_recipients')
23 $root_mail_alias = hiera('root_mail_alias')
37 'debian.org-recommended',
79 package { 'molly-guard':
82 file { '/etc/molly-guard/run.d/10-check-kvm':
84 source => 'puppet:///modules/debian_org/molly-guard/10-check-kvm',
85 require => Package['molly-guard'],
87 file { '/etc/molly-guard/run.d/15-acquire-reboot-lock':
89 source => 'puppet:///modules/debian_org/molly-guard/15-acquire-reboot-lock',
90 require => Package['molly-guard'],
93 augeas { 'inittab_replicate':
94 context => '/files/etc/inittab',
96 'set ud/runlevels 2345',
97 'set ud/action respawn',
98 'set ud/process "/usr/bin/ud-replicated -d"',
100 notify => Exec['init q'],
104 file { '/etc/facter':
109 source => 'puppet:///files/empty/',
111 file { '/etc/facter/facts.d':
114 file { '/etc/facter/facts.d/debian_facts.yaml':
115 content => template('debian_org/debian_facts.yaml.erb')
117 file { '/etc/timezone':
118 content => "Etc/UTC\n",
119 notify => Exec['dpkg-reconfigure tzdata -pcritical -fnoninteractive'],
121 if versioncmp($::lsbmajdistrelease, '9') >= 0 { # jessie has a regular file there, for instance
122 file { '/etc/localtime':
124 target => '/usr/share/zoneinfo/Etc/UTC',
125 notify => Exec['dpkg-reconfigure tzdata -pcritical -fnoninteractive'],
128 file { '/etc/puppet/puppet.conf':
129 content => template('debian_org/puppet.conf.erb'),
133 file { '/etc/default/puppet':
134 source => 'puppet:///modules/debian_org/puppet.default',
136 file { '/etc/systemd':
140 file { '/etc/systemd/system':
144 file { '/etc/systemd/system/ud-replicated.service':
145 ensure => $servicefiles,
146 source => 'puppet:///modules/debian_org/ud-replicated.service',
147 notify => Exec['systemctl daemon-reload'],
150 file { '/etc/systemd/system/multi-user.target.wants/ud-replicated.service':
152 target => '../ud-replicated.service',
153 notify => Exec['systemctl daemon-reload'],
156 file { '/etc/systemd/system/puppet.service':
158 target => '/dev/null',
159 notify => Exec['systemctl daemon-reload'],
161 file { '/etc/systemd/system/proc-sys-fs-binfmt_misc.automount':
163 target => '/dev/null',
164 notify => Exec['systemctl daemon-reload'],
167 concat { '/etc/cron.d/dsa-puppet-stuff': }
168 concat::fragment { 'dsa-puppet-stuff---header':
169 target => '/etc/cron.d/dsa-puppet-stuff',
172 ## THIS FILE IS UNDER PUPPET CONTROL. DON'T EDIT IT HERE.
175 PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/lib/nagios/plugins
178 concat::fragment { 'dsa-puppet-stuff---all':
179 target => '/etc/cron.d/dsa-puppet-stuff',
181 content => template('debian_org/dsa-puppet-stuff.cron.erb'),
182 require => Package['debian.org'],
184 file { '/etc/ldap/ldap.conf':
185 require => Package['debian.org'],
186 content => template('debian_org/ldap.conf.erb'),
188 file { '/etc/pam.d/common-session':
189 require => Package['debian.org'],
190 content => template('debian_org/pam.common-session.erb'),
192 file { '/etc/pam.d/common-session-noninteractive':
193 require => Package['debian.org'],
194 content => template('debian_org/pam.common-session-noninteractive.erb'),
196 file { '/etc/rc.local':
198 content => template('debian_org/rc.local.erb'),
199 notify => Exec['service rc.local restart'],
205 file { '/etc/dsa/cron.ignore.dsa-puppet-stuff':
206 source => 'puppet:///modules/debian_org/dsa-puppet-stuff.cron.ignore',
207 require => Package['debian.org']
209 file { '/etc/nsswitch.conf':
211 source => 'puppet:///modules/debian_org/nsswitch.conf',
214 file { '/etc/profile.d/timeout.sh':
216 source => 'puppet:///modules/debian_org/etc.profile.d/timeout.sh',
221 file { '/etc/zsh/zprofile':
223 source => 'puppet:///modules/debian_org/etc.zsh/zprofile',
225 file { '/etc/environment':
229 file { '/etc/default/locale':
234 # set mmap_min_addr to 4096 to mitigate
235 # Linux NULL-pointer dereference exploits
236 base::sysctl { 'mmap_min_addr':
239 base::sysctl { 'perf_event_paranoid':
240 key => 'kernel.perf_event_paranoid',
243 base::sysctl { 'puppet-vfs_cache_pressure':
244 key => 'vm.vfs_cache_pressure',
247 base::alternative { 'editor':
248 linkto => '/usr/bin/vim.basic',
250 base::alternative { 'view':
251 linkto => '/usr/bin/vim.basic',
253 mailalias { 'samhain-reports':
255 recipient => $samhain_recipients,
256 require => Package['debian.org']
260 recipient => $root_mail_alias,
261 require => Package['debian.org']
264 file { '/usr/local/bin/check_for_updates':
265 source => 'puppet:///modules/debian_org/check_for_updates',
270 file { '/usr/local/bin/dsa-is-shutdown-scheduled':
271 source => 'puppet:///modules/debian_org/dsa-is-shutdown-scheduled',
275 exec { 'dpkg-reconfigure tzdata -pcritical -fnoninteractive':
276 path => '/usr/bin:/usr/sbin:/bin:/sbin',
279 exec { 'service puppetmaster restart':
282 exec { 'service rc.local restart':
289 exec { 'systemctl daemon-reload':
291 onlyif => "test -x /bin/systemctl"
294 exec { 'systemd-tmpfiles --create --exclude-prefix=/dev':
296 onlyif => "test -x /bin/systemd-tmpfiles"
299 tidy { '/var/lib/puppet/clientbucket/':
303 matches => [ 'paths', 'contents' ],
307 file { '/root/.bashrc':
308 source => 'puppet:///modules/debian_org/root-dotfiles/bashrc',
310 file { '/root/.profile':
311 source => 'puppet:///modules/debian_org/root-dotfiles/profile',
313 file { '/root/.selected_editor':
314 source => 'puppet:///modules/debian_org/root-dotfiles/selected_editor',
316 file { '/root/.screenrc':
317 source => 'puppet:///modules/debian_org/root-dotfiles/screenrc',
319 file { '/root/.tmux.conf':
320 source => 'puppet:///modules/debian_org/root-dotfiles/tmux.conf',
322 file { '/root/.vimrc':
323 source => 'puppet:///modules/debian_org/root-dotfiles/vimrc',
326 if versioncmp($::lsbmajdistrelease, '9') == 0 { # older puppets do facts as strings.
327 if $::processorcount > 1 {
328 package { 'irqbalance': ensure => installed }
331 # 926967 drops the recommendation on irqbalance in Buster
332 package { 'irqbalance': ensure => purged }
336 # https://www.decadent.org.uk/ben/blog/bpf-security-issues-in-debian.html
337 base::sysctl { 'unprivileged_bpf_disabled':
338 key => 'kernel.unprivileged_bpf_disabled',
342 # Disable kpartx udev rules
343 file { '/etc/udev/rules.d/60-kpartx.rules':
344 ensure => $has_lib_udev_rules_d_60_kpartx_rules ? { true => 'present', default => 'absent' },
349 # this is only to avoid warnings, else puppet will complain that we
350 # have a symlink there, even if we're not replacing it anyhow.
351 if ! $has_etc_ssh_ssh_known_hosts {
352 file { '/etc/ssh/ssh_known_hosts':
355 content => inline_template('<%= open("/etc/ssh/ssh_known_hosts").read() %>'),
356 notify => Exec['ud-replicate'],
360 exec { 'ud-replicate':
361 path => '/usr/bin:/usr/sbin:/bin:/sbin',
362 command => '/usr/bin/ud-replicate',
364 require => Package['userdir-ldap']
367 # some changes require rebuilding the initramfs. Have the common exec here.
368 exec { 'update-initramfs -u':
369 path => '/etc/init.d:/usr/bin:/usr/sbin:/bin:/sbin',