]> git.donarmstrong.com Git - dsa-puppet.git/blob - modules/debian-org/manifests/init.pp
Try to remove /etc/apt/trusted-keys.d harder
[dsa-puppet.git] / modules / debian-org / manifests / init.pp
1 # == Class: debian-org
2 #
3 # Stuff common to all debian.org servers
4 #
5 class debian-org {
6         if getfromhash($site::nodeinfo, 'hoster', 'mirror-debian') {
7                 $mirror = getfromhash($site::nodeinfo, 'hoster', 'mirror-debian')
8         } else {
9                 $mirror = 'http://http.debian.net/debian/'
10         }
11         if $::lsbmajdistrelease < 7 {
12                 $mirror_backports = 'http://backports.debian.org/debian-backports/'
13         } else {
14                 $mirror_backports = $mirror
15         }
16
17         $debianadmin = [
18                 'debian-archive-debian-samhain-reports@master.debian.org',
19                 'debian-admin@ftbfs.de',
20                 'weasel@debian.org',
21                 'steve@lobefin.net',
22                 'paravoid@debian.org',
23                 'zumbi@kos.to'
24         ]
25
26         package { [
27                         'klogd',
28                         'sysklogd',
29                         'rsyslog',
30                 ]:
31                 ensure => purged,
32         }
33         package { [
34                         'debian.org',
35                         'dsa-munin-plugins',
36                 ]:
37                 ensure => installed,
38                 tag    => extra_repo,
39         }
40
41         package { [
42                         'apt-utils',
43                         'bash-completion',
44                         'dnsutils',
45                         'less',
46                         'lsb-release',
47                         'libfilesystem-ruby1.8',
48                         'mtr-tiny',
49                         'nload',
50                         'pciutils',
51                 ]:
52                 ensure => installed,
53         }
54
55         if $::lsbmajdistrelease >= 7 {
56                 package { 'libfilesystem-ruby1.9.1':
57                         ensure => installed,
58                 }
59         }
60
61         munin::check { [
62                         'cpu',
63                         'entropy',
64                         'forks',
65                         'interrupts',
66                         'iostat',
67                         'irqstats',
68                         'load',
69                         'memory',
70                         'ntp_offset',
71                         'ntp_states',
72                         'open_files',
73                         'open_inodes',
74                         'processes',
75                         'swap',
76                         'uptime',
77                         'vmstat',
78                 ]:
79         }
80
81         if getfromhash($site::nodeinfo, 'broken-rtc') {
82                 package { 'fake-hwclock':
83                         ensure => installed,
84                         tag    => extra_repo,
85                 }
86         }
87
88         package { 'molly-guard':
89                 ensure => installed,
90         }
91         file { '/etc/molly-guard/run.d/10-check-kvm':
92                 mode    => '0755',
93                 source  => 'puppet:///modules/debian-org/molly-guard/10-check-kvm',
94                 require => Package['molly-guard'],
95         }
96         file { '/etc/molly-guard/run.d/15-acquire-reboot-lock':
97                 mode    => '0755',
98                 source  => 'puppet:///modules/debian-org/molly-guard/15-acquire-reboot-lock',
99                 require => Package['molly-guard'],
100         }
101
102         file { '/etc/apt/trusted-keys.d':
103                 ensure => absent,
104                 force  => yes,
105         }
106
107         file { '/etc/apt/trusted.gpg':
108                 mode    => '0600',
109                 content => "",
110         }
111
112         site::aptrepo { 'security':
113                 url        => 'http://security.debian.org/',
114                 suite      => "${::lsbdistcodename}/updates",
115                 components => ['main','contrib','non-free']
116         }
117
118         site::aptrepo { 'backports.debian.org':
119                 url        => $mirror_backports,
120                 suite      => "${::lsbdistcodename}-backports",
121                 components => ['main','contrib','non-free']
122         }
123
124         site::aptrepo { 'volatile':
125                 url        => $mirror,
126                 suite      => "${::lsbdistcodename}-updates",
127                 components => ['main','contrib','non-free']
128         }
129
130         if $::hostname in [ball, corelli, eysler, lucatelli, mayer, mayr, rem] {
131                 site::aptrepo { 'proposed-updates':
132                         url        => $mirror,
133                         suite      => "${::lsbdistcodename}-proposed-updates",
134                         components => ['main','contrib','non-free']
135                 }
136         }
137
138         site::aptrepo { 'debian.org':
139                 ensure => absent,
140         }
141
142         site::aptrepo { 'db.debian.org':
143                 url        => 'http://db.debian.org/debian-admin',
144                 suite      => 'lenny',
145                 components => 'main',
146                 key        => 'puppet:///modules/debian-org/db.debian.org.gpg',
147         }
148
149         augeas { 'inittab_replicate':
150                 context => '/files/etc/inittab',
151                 changes => [
152                         'set ud/runlevels 2345',
153                         'set ud/action respawn',
154                         'set ud/process "/usr/bin/ud-replicated -d"',
155                 ],
156                 notify  => Exec['init q'],
157         }
158
159         if getfromhash($site::nodeinfo, 'hoster', 'mirror-debian') {
160                 site::aptrepo { 'debian':
161                         url        => getfromhash($site::nodeinfo, 'hoster', 'mirror-debian'),
162                         suite      => $::lsbdistcodename,
163                         components => ['main','contrib','non-free']
164                 }
165         }
166
167         file { '/etc/facter':
168                 ensure  => directory,
169                 purge   => true,
170                 force   => true,
171                 recurse => true,
172                 source  => 'puppet:///files/empty/',
173         }
174         file { '/etc/facter/facts.d':
175                 ensure => directory,
176         }
177         file { '/etc/facter/facts.d/debian_facts.yaml':
178                 content => template('debian-org/debian_facts.yaml.erb')
179         }
180         file { '/etc/apt/preferences':
181                 source => 'puppet:///modules/debian-org/apt.preferences',
182         }
183         file { '/etc/apt/apt.conf.d/local-compression':
184                 source => 'puppet:///modules/debian-org/apt.conf.d/local-compression',
185         }
186         file { '/etc/apt/apt.conf.d/local-recommends':
187                 source => 'puppet:///modules/debian-org/apt.conf.d/local-recommends',
188         }
189         file { '/etc/apt/apt.conf.d/local-pdiffs':
190                 source => 'puppet:///modules/debian-org/apt.conf.d/local-pdiffs',
191         }
192         file { '/etc/timezone':
193                 source => 'puppet:///modules/debian-org/timezone',
194                 notify => Exec['dpkg-reconfigure tzdata -pcritical -fnoninteractive'],
195         }
196         if $::hostname == handel {
197                 include puppetmaster::db
198                 $dbpassword = $puppetmaster::db::password
199         }
200         file { '/etc/puppet/puppet.conf':
201                 content => template('debian-org/puppet.conf.erb'),
202         }
203         file { '/etc/default/puppet':
204                 source => 'puppet:///modules/debian-org/puppet.default',
205         }
206         file { '/etc/cron.d/dsa-puppet-stuff':
207                 source  => 'puppet:///modules/debian-org/dsa-puppet-stuff.cron',
208                 require => Package['debian.org'],
209         }
210         file { '/etc/ldap/ldap.conf':
211                 require => Package['debian.org'],
212                 source  => 'puppet:///modules/debian-org/ldap.conf',
213         }
214         file { '/etc/pam.d/common-session':
215                 require => Package['debian.org'],
216                 content => template('debian-org/pam.common-session.erb'),
217         }
218         file { '/etc/pam.d/common-session-noninteractive':
219                 require => Package['debian.org'],
220                 content => template('debian-org/pam.common-session-noninteractive.erb'),
221         }
222         file { '/etc/rc.local':
223                 mode   => '0755',
224                 source => 'puppet:///modules/debian-org/rc.local',
225                 notify => Exec['rc.local start'],
226         }
227         file { '/etc/dsa':
228                 ensure => directory,
229                 mode   => '0755',
230         }
231         file { '/etc/dsa/cron.ignore.dsa-puppet-stuff':
232                 source  => 'puppet:///modules/debian-org/dsa-puppet-stuff.cron.ignore',
233                 require => Package['debian.org']
234         }
235         file { '/etc/nsswitch.conf':
236                 mode   => '0755',
237                 source => 'puppet:///modules/debian-org/nsswitch.conf',
238         }
239
240         # set mmap_min_addr to 4096 to mitigate
241         # Linux NULL-pointer dereference exploits
242         site::sysctl { 'mmap_min_addr':
243                 ensure => absent
244         }
245         site::sysctl { 'perf_event_paranoid':
246                 key   => 'kernel.perf_event_paranoid',
247                 value => '2',
248         }
249         site::alternative { 'editor':
250                 linkto => '/usr/bin/vim.basic',
251         }
252         site::alternative { 'view':
253                 linkto => '/usr/bin/vim.basic',
254         }
255         mailalias { 'samhain-reports':
256                 ensure    => present,
257                 recipient => $debianadmin,
258                 require   => Package['debian.org']
259         }
260
261         file { '/usr/local/bin/check_for_updates':
262                 source => 'puppet:///modules/debian-org/check_for_updates',
263                 mode   => '0755',
264                 owner  => root,
265                 group  => root,
266         }
267
268         exec { 'apt-get update':
269                 path    => '/usr/bin:/usr/sbin:/bin:/sbin',
270                 onlyif  => '/usr/local/bin/check_for_updates',
271                 require => File['/usr/local/bin/check_for_updates']
272         }
273         Exec['apt-get update']->Package<| tag == extra_repo |>
274
275         exec { 'dpkg-reconfigure tzdata -pcritical -fnoninteractive':
276                 path        => '/usr/bin:/usr/sbin:/bin:/sbin',
277                 refreshonly => true
278         }
279         exec { 'puppetmaster restart':
280                 path        => '/etc/init.d:/usr/bin:/usr/sbin:/bin:/sbin',
281                 refreshonly => true
282         }
283         exec { 'rc.local start':
284                 path        => '/etc/init.d:/usr/bin:/usr/sbin:/bin:/sbin',
285                 refreshonly => true
286         }
287         exec { 'init q':
288                 refreshonly => true
289         }
290
291         tidy { '/var/lib/puppet/clientbucket/':
292                 age      => '2w',
293                 recurse  => 9,
294                 type     => ctime,
295                 matches  => [ 'paths', 'contents' ],
296                 schedule => weekly
297         }
298 }