X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=modules%2Fdebian-org%2Fmanifests%2Finit.pp;h=aa90ad0309482d270076fa9e9a014f5a82bcf583;hb=d36e70cc1c6db90f82342133df02d29a01b974c3;hp=da54711e5eebc3d37ee08aa808adea9cf087ccb6;hpb=97b80c63870174dd9ca6e92b04da0f110a8150b3;p=dsa-puppet.git diff --git a/modules/debian-org/manifests/init.pp b/modules/debian-org/manifests/init.pp index da54711e..aa90ad03 100644 --- a/modules/debian-org/manifests/init.pp +++ b/modules/debian-org/manifests/init.pp @@ -1,35 +1,85 @@ +# == Class: debian-org +# +# Stuff common to all debian.org servers +# class debian-org { + if getfromhash($site::nodeinfo, 'hoster', 'mirror-debian') { + $mirror = getfromhash($site::nodeinfo, 'hoster', 'mirror-debian') + } else { + $mirror = 'http://ftp.debian.org/debian/' + } + if $::lsbmajdistrelease < 7 { + $mirror_backports = 'http://backports.debian.org/debian-backports/' + } else { + $mirror_backports = $mirror + } + + if $::lsbmajdistrelease <= 7 { + $mungedcodename = $::lsbdistcodename + } elsif ($::debarchitecture in ['kfreebsd-amd64', 'kfreebsd-i386']) { + $mungedcodename = "${::lsbdistcodename}-kfreebsd" + } else { + $mungedcodename = $::lsbdistcodename + } + + if $systemd { + include systemd + $servicefiles = 'present' + } else { + $servicefiles = 'absent' + } $debianadmin = [ 'debian-archive-debian-samhain-reports@master.debian.org', 'debian-admin@ftbfs.de', 'weasel@debian.org', 'steve@lobefin.net', - 'paravoid@debian.org' + 'paravoid@debian.org', + 'zumbi@kos.to' ] package { [ 'klogd', 'sysklogd', 'rsyslog', + 'os-prober', + 'apt-listchanges', ]: - ensure => purged, + ensure => purged, + } + package { [ + 'debian.org', + 'dsa-munin-plugins', + ]: + 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 ($::lsbmajdistrelease >= 8) { + $rubyfs_package = 'ruby-filesystem' + } elsif $::lsbmajdistrelease == 7 { + $rubyfs_package = 'libfilesystem-ruby1.9' + } else { + $rubyfs_package = 'libfilesystem-ruby1.8' } package { [ 'apt-utils', 'bash-completion', - 'debian.org', 'dnsutils', - 'dsa-munin-plugins', 'less', 'lsb-release', - 'libfilesystem-ruby1.8', - 'molly-guard', + $rubyfs_package, 'mtr-tiny', 'nload', 'pciutils', ]: - ensure => installed, + ensure => installed, } munin::check { [ @@ -54,36 +104,109 @@ class debian-org { if getfromhash($site::nodeinfo, 'broken-rtc') { package { 'fake-hwclock': - ensure => installed + ensure => installed, + tag => extra_repo, } } - # This really means 'not wheezy' + package { 'molly-guard': + ensure => installed, + } + file { '/etc/molly-guard/run.d/10-check-kvm': + mode => '0755', + source => 'puppet:///modules/debian-org/molly-guard/10-check-kvm', + require => Package['molly-guard'], + } + file { '/etc/molly-guard/run.d/15-acquire-reboot-lock': + mode => '0755', + source => 'puppet:///modules/debian-org/molly-guard/15-acquire-reboot-lock', + require => Package['molly-guard'], + } + + file { '/etc/apt/trusted-keys.d': + ensure => absent, + force => true, + } - if $::debarchitecture != 'armhf' { - site::aptrepo { 'security': - template => 'debian-org/etc/apt/sources.list.d/security.list.erb', - } - site::aptrepo { 'backports.debian.org': - template => 'debian-org/etc/apt/sources.list.d/backports.debian.org.list.erb', + file { '/etc/apt/trusted.gpg': + mode => '0600', + content => "", + } + + site::aptrepo { 'security': + url => 'http://security.debian.org/', + suite => "${mungedcodename}/updates", + components => ['main','contrib','non-free'] + } + if $::lsbmajdistrelease < 7 { + site::aptrepo { 'debian-lts': + url => $mirror, + suite => "${::lsbdistcodename}-lts", + components => ['main','contrib','non-free'] } - site::aptrepo { 'volatile': - template => 'debian-org/etc/apt/sources.list.d/volatile.list.erb', + } else { + site::aptrepo { 'debian-lts': + ensure => absent, } } - site::aptrepo { 'backports.org': - ensure => absent, - keyid => '16BA136C', - key => 'puppet:///modules/debian-org/backports.org.asc', + + site::aptrepo { 'backports.debian.org': + url => $mirror_backports, + suite => "${::lsbdistcodename}-backports", + components => ['main','contrib','non-free'] } + site::aptrepo { 'volatile': + url => $mirror, + suite => "${::lsbdistcodename}-updates", + components => ['main','contrib','non-free'] + } + + #if ($::hostname in [corelli, eysler, lucatelli, mayr, pettersson]) or + # ($::hoster and ($::hoster in [bytemark, man-da, brown])) { + # site::aptrepo { 'proposed-updates': + # url => $mirror, + # suite => "${::lsbdistcodename}-proposed-updates", + # components => ['main','contrib','non-free'] + # } + #} else { + site::aptrepo { 'proposed-updates': + ensure => absent, + } + #} + site::aptrepo { 'debian.org': ensure => absent, } site::aptrepo { 'db.debian.org': - template => 'debian-org/etc/apt/sources.list.d/debian.org.list.erb', - key => 'puppet:///modules/debian-org/db.debian.org.asc', + url => 'http://db.debian.org/debian-admin', + suite => 'debian-all', + components => 'main', + key => 'puppet:///modules/debian-org/db.debian.org.gpg', + } + site::aptrepo { 'db.debian.org-suite': + url => 'http://db.debian.org/debian-admin', + suite => $::lsbdistcodename, + components => 'main', + } + + augeas { 'inittab_replicate': + context => '/files/etc/inittab', + changes => [ + 'set ud/runlevels 2345', + 'set ud/action respawn', + 'set ud/process "/usr/bin/ud-replicated -d"', + ], + notify => Exec['init q'], + } + + if getfromhash($site::nodeinfo, 'hoster', 'mirror-debian') { + site::aptrepo { 'debian': + url => getfromhash($site::nodeinfo, 'hoster', 'mirror-debian'), + suite => $mungedcodename, + components => ['main','contrib','non-free'] + } } file { '/etc/facter': @@ -102,10 +225,6 @@ class debian-org { file { '/etc/apt/preferences': source => 'puppet:///modules/debian-org/apt.preferences', } - file { '/etc/apt/trusted-keys.d/': - ensure => directory, - purge => true, - } file { '/etc/apt/apt.conf.d/local-compression': source => 'puppet:///modules/debian-org/apt.conf.d/local-compression', } @@ -119,33 +238,62 @@ class debian-org { source => 'puppet:///modules/debian-org/timezone', notify => Exec['dpkg-reconfigure tzdata -pcritical -fnoninteractive'], } + if $::hostname == handel { + include puppetmaster::db + $dbpassword = $puppetmaster::db::password + } file { '/etc/puppet/puppet.conf': - source => 'puppet:///modules/debian-org/puppet.conf', + content => template('debian-org/puppet.conf.erb'), } file { '/etc/default/puppet': source => 'puppet:///modules/debian-org/puppet.default', } + file { '/etc/systemd': + ensure => directory, + mode => 0755, + } + file { '/etc/systemd/system': + ensure => directory, + mode => 0755, + } + file { '/etc/systemd/system/ud-replicated.service': + ensure => $servicefiles, + source => 'puppet:///modules/debian-org/ud-replicated.service', + notify => Exec['systemctl daemon-reload'], + } + if $systemd { + file { '/etc/systemd/system/multi-user.target.wants/ud-replicated.service': + ensure => 'link', + target => '../ud-replicated.service', + notify => Exec['systemctl daemon-reload'], + } + } + file { '/etc/systemd/system/puppet.service': + ensure => 'link', + target => '/dev/null', + notify => Exec['systemctl daemon-reload'], + } + file { '/etc/cron.d/dsa-puppet-stuff': - source => 'puppet:///modules/debian-org/dsa-puppet-stuff.cron', + content => template('debian-org/dsa-puppet-stuff.cron.erb'), require => Package['debian.org'], } file { '/etc/ldap/ldap.conf': require => Package['debian.org'], - source => 'puppet:///modules/debian-org/ldap.conf', + content => template('debian-org/ldap.conf.erb'), } file { '/etc/pam.d/common-session': require => Package['debian.org'], content => template('debian-org/pam.common-session.erb'), } + file { '/etc/pam.d/common-session-noninteractive': + require => Package['debian.org'], + content => template('debian-org/pam.common-session-noninteractive.erb'), + } file { '/etc/rc.local': mode => '0755', - source => 'puppet:///modules/debian-org/rc.local', - notify => Exec['rc.local start'], - } - file { '/etc/molly-guard/run.d/15-acquire-reboot-lock': - mode => '0755', - source => 'puppet:///modules/debian-org/molly-guard-acquire-reboot-lock', - require => Package['molly-guard'], + content => template('debian-org/rc.local.erb'), + notify => Exec['service rc.local start'], } file { '/etc/dsa': ensure => directory, @@ -155,39 +303,88 @@ class debian-org { source => 'puppet:///modules/debian-org/dsa-puppet-stuff.cron.ignore', require => Package['debian.org'] } + file { '/etc/nsswitch.conf': + mode => '0755', + source => 'puppet:///modules/debian-org/nsswitch.conf', + } # set mmap_min_addr to 4096 to mitigate # Linux NULL-pointer dereference exploits site::sysctl { 'mmap_min_addr': - key => 'vm.mmap_min_addr', - value => '4096', + ensure => absent + } + site::sysctl { 'perf_event_paranoid': + key => 'kernel.perf_event_paranoid', + value => '2', } site::alternative { 'editor': linkto => '/usr/bin/vim.basic', } + site::alternative { 'view': + linkto => '/usr/bin/vim.basic', + } mailalias { 'samhain-reports': - ensure => present, + ensure => present, recipient => $debianadmin, + require => Package['debian.org'] + } + + file { '/usr/local/bin/check_for_updates': + source => 'puppet:///modules/debian-org/check_for_updates', + mode => '0755', + owner => root, + group => root, } exec { 'apt-get update': - path => '/usr/bin:/usr/sbin:/bin:/sbin', - refreshonly => true, - }-> Package <| |> + path => '/usr/bin:/usr/sbin:/bin:/sbin', + onlyif => '/usr/local/bin/check_for_updates', + require => File['/usr/local/bin/check_for_updates'] + } + Exec['apt-get update']->Package<| tag == extra_repo |> exec { 'dpkg-reconfigure tzdata -pcritical -fnoninteractive': path => '/usr/bin:/usr/sbin:/bin:/sbin', refreshonly => true } - exec { 'puppetmaster restart': - path => '/etc/init.d:/usr/bin:/usr/sbin:/bin:/sbin', + exec { 'service puppetmaster restart': refreshonly => true } - exec { 'rc.local start': - path => '/etc/init.d:/usr/bin:/usr/sbin:/bin:/sbin', + exec { 'service rc.local start': refreshonly => true } exec { 'init q': refreshonly => true } + + exec { 'systemctl daemon-reload': + refreshonly => true, + onlyif => "test -x /bin/systemctl" + } + + exec { 'systemd-tmpfiles --create --exclude-prefix=/dev': + refreshonly => true, + onlyif => "test -x /bin/systemd-tmpfiles" + } + + tidy { '/var/lib/puppet/clientbucket/': + age => '2w', + recurse => 9, + type => ctime, + matches => [ 'paths', 'contents' ], + schedule => weekly + } + + file { '/root/.bashrc': + source => 'puppet:///modules/debian-org/root-dotfiles/bashrc', + } + file { '/root/.profile': + source => 'puppet:///modules/debian-org/root-dotfiles/profile', + } + file { '/root/.screenrc': + source => 'puppet:///modules/debian-org/root-dotfiles/screenrc', + } + file { '/root/.vimrc': + source => 'puppet:///modules/debian-org/root-dotfiles/vimrc', + } }