X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=modules%2Fdebian_org%2Fmanifests%2Finit.pp;h=be1fe71094005b90000dc5599970569cf62cbbda;hb=9728596ba8cf819fe5255eb2aee9b2c469b8359c;hp=616be7522943c6405a7fac8aadd93e08854a5d38;hpb=2cabdcc6df70e88f47ed865207985578553b99d5;p=mirror%2Fdsa-puppet.git diff --git a/modules/debian_org/manifests/init.pp b/modules/debian_org/manifests/init.pp index 616be7522..be1fe7109 100644 --- a/modules/debian_org/manifests/init.pp +++ b/modules/debian_org/manifests/init.pp @@ -6,18 +6,14 @@ class debian_org { include debian_org::apt if $systemd { - include systemd + include dsa_systemd $servicefiles = 'present' } else { $servicefiles = 'absent' } - # the virtual facter needs virt-what on jessie to work - if versioncmp($::lsbmajdistrelease, '9') < 0 { - package { 'virt-what': ensure => installed } - } else { - package { 'virt-what': ensure => purged } - } + # the virtual facter needs virt-what on jessie to work; clean up. + package { 'virt-what': ensure => purged } $samhain_recipients = hiera('samhain_recipients') $root_mail_alias = hiera('root_mail_alias') @@ -41,29 +37,19 @@ class debian_org { ensure => installed, tag => extra_repo, } - file { '/etc/ssh/ssh_known_hosts': - ensure => present, - replace => false, - mode => '0644', - source => 'puppet:///modules/debian_org/basic-ssh_known_hosts' - } - if versioncmp($::lsbmajdistrelease, '8') >= 0 { - $rubyfs_package = 'ruby-filesystem' - } else { - $rubyfs_package = 'libfilesystem-ruby1.9' - } package { [ 'apt-utils', 'bash-completion', 'dnsutils', 'less', 'lsb-release', - $rubyfs_package, + 'ruby-filesystem', 'mtr-tiny', 'nload', 'pciutils', 'lldpd', + 'ncurses-term', ]: ensure => installed, } @@ -86,13 +72,6 @@ class debian_org { ]: } - if getfromhash($site::nodeinfo, 'broken-rtc') { - package { 'fake-hwclock': - ensure => installed, - tag => extra_repo, - } - } - package { 'molly-guard': ensure => installed, } @@ -132,12 +111,13 @@ class debian_org { content => template('debian_org/debian_facts.yaml.erb') } file { '/etc/timezone': - source => 'puppet:///modules/debian_org/timezone', + content => "Etc/UTC\n", notify => Exec['dpkg-reconfigure tzdata -pcritical -fnoninteractive'], } - if $::hostname == handel { - include puppetmaster::db - $dbpassword = $puppetmaster::db::password + file { '/etc/localtime': + ensure => 'link', + target => '/usr/share/zoneinfo/Etc/UTC', + notify => Exec['dpkg-reconfigure tzdata -pcritical -fnoninteractive'], } file { '/etc/puppet/puppet.conf': content => template('debian_org/puppet.conf.erb'), @@ -179,7 +159,27 @@ class debian_org { } file { '/etc/cron.d/dsa-puppet-stuff': - content => template('debian_org/dsa-puppet-stuff.cron.erb'), + ensure => 'absent', + } + file { '/etc/dsa/cron.ignore.dsa-puppet-stuff': + ensure => 'absent', + } + + concat { '/etc/cron.d/puppet-crontab': } + concat::fragment { 'puppet-crontab---header': + target => '/etc/cron.d/puppet-crontab', + order => '000', + content => @(EOF) + ## THIS FILE IS UNDER PUPPET CONTROL. DON'T EDIT IT HERE. + SHELL=/bin/bash + MAILTO=root + PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/lib/nagios/plugins + | EOF + } + concat::fragment { 'puppet-crontab---all': + target => '/etc/cron.d/puppet-crontab', + order => '010', + content => template('debian_org/puppet-crontab.cron.erb'), require => Package['debian.org'], } file { '/etc/ldap/ldap.conf': @@ -203,12 +203,12 @@ class debian_org { ensure => directory, mode => '0755', } - file { '/etc/dsa/cron.ignore.dsa-puppet-stuff': - source => 'puppet:///modules/debian_org/dsa-puppet-stuff.cron.ignore', + file { '/etc/dsa/cron.ignore.puppet-crontab': + source => 'puppet:///modules/debian_org/puppet-crontab.cron.ignore', require => Package['debian.org'] } file { '/etc/nsswitch.conf': - mode => '0755', + mode => '0444', source => 'puppet:///modules/debian_org/nsswitch.conf', } @@ -234,21 +234,21 @@ class debian_org { # set mmap_min_addr to 4096 to mitigate # Linux NULL-pointer dereference exploits - site::sysctl { 'mmap_min_addr': + base::sysctl { 'mmap_min_addr': ensure => absent } - site::sysctl { 'perf_event_paranoid': + base::sysctl { 'perf_event_paranoid': key => 'kernel.perf_event_paranoid', value => '2', } - site::sysctl { 'puppet-vfs_cache_pressure': + base::sysctl { 'puppet-vfs_cache_pressure': key => 'vm.vfs_cache_pressure', value => '10', } - site::alternative { 'editor': + base::alternative { 'editor': linkto => '/usr/bin/vim.basic', } - site::alternative { 'view': + base::alternative { 'view': linkto => '/usr/bin/vim.basic', } mailalias { 'samhain-reports': @@ -269,8 +269,7 @@ class debian_org { group => root, } file { '/usr/local/bin/dsa-is-shutdown-scheduled': - source => 'puppet:///modules/debian_org/dsa-is-shutdown-scheduled', - mode => '0555', + ensure => 'absent', } exec { 'dpkg-reconfigure tzdata -pcritical -fnoninteractive': @@ -324,16 +323,60 @@ class debian_org { source => 'puppet:///modules/debian_org/root-dotfiles/vimrc', } - if versioncmp($::lsbmajdistrelease, '9') >= 0 { # older puppets do facts as strings. + if versioncmp($::lsbmajdistrelease, '9') == 0 { # older puppets do facts as strings. if $::processorcount > 1 { package { 'irqbalance': ensure => installed } } + } else { + # 926967 drops the recommendation on irqbalance in Buster + package { 'irqbalance': ensure => purged } } # https://www.decadent.org.uk/ben/blog/bpf-security-issues-in-debian.html - site::sysctl { 'unprivileged_bpf_disabled': + base::sysctl { 'unprivileged_bpf_disabled': key => 'kernel.unprivileged_bpf_disabled', value => '1', } + + # our ipv6 addresses and routes are statically configured. + base::sysctl { 'dsa-accept-ra-default': + key => 'net.ipv6.conf.default.accept_ra', + value => 0, + } + base::sysctl { 'dsa-accept-ra-all': + key => 'net.ipv6.conf.all.accept_ra', + value => 0, + } + + # Disable kpartx udev rules + file { '/etc/udev/rules.d/60-kpartx.rules': + ensure => $has_lib_udev_rules_d_60_kpartx_rules ? { true => 'present', default => 'absent' }, + content => "", + mode => '0444', + } + + # this is only to avoid warnings, else puppet will complain that we + # have a symlink there, even if we're not replacing it anyhow. + if ! $has_etc_ssh_ssh_known_hosts { + file { '/etc/ssh/ssh_known_hosts': + ensure => 'present', + replace => 'no', + content => inline_template('<%= open("/etc/ssh/ssh_known_hosts").read() %>'), + notify => Exec['ud-replicate'], + } + } + + exec { 'ud-replicate': + path => '/usr/bin:/usr/sbin:/bin:/sbin', + command => '/usr/bin/ud-replicate', + refreshonly => true, + require => Package['userdir-ldap'] + } + + # some changes require rebuilding the initramfs. Have the common exec here. + exec { 'update-initramfs -u': + path => '/etc/init.d:/usr/bin:/usr/sbin:/bin:/sbin', + refreshonly => true; + } }