]> git.donarmstrong.com Git - dsa-puppet.git/blob - modules/debian-org/manifests/init.pp
Add squeeze-lts
[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  => true,
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         if $::lsbmajdistrelease < 7 {
118                 site::aptrepo { 'debian-lts':
119                         url        => $mirror,
120                         suite      => "${::lsbdistcodename}-lts",
121                         components => ['main','contrib','non-free']
122                 }
123         }
124
125         site::aptrepo { 'backports.debian.org':
126                 url        => $mirror_backports,
127                 suite      => "${::lsbdistcodename}-backports",
128                 components => ['main','contrib','non-free']
129         }
130
131         site::aptrepo { 'volatile':
132                 url        => $mirror,
133                 suite      => "${::lsbdistcodename}-updates",
134                 components => ['main','contrib','non-free']
135         }
136
137         if $::hostname in [ball, corelli, eysler, lucatelli, mayer, mayr, rem] {
138                 site::aptrepo { 'proposed-updates':
139                         url        => $mirror,
140                         suite      => "${::lsbdistcodename}-proposed-updates",
141                         components => ['main','contrib','non-free']
142                 }
143         }
144
145         site::aptrepo { 'debian.org':
146                 ensure => absent,
147         }
148
149         site::aptrepo { 'db.debian.org':
150                 url        => 'http://db.debian.org/debian-admin',
151                 suite      => 'lenny',
152                 components => 'main',
153                 key        => 'puppet:///modules/debian-org/db.debian.org.gpg',
154         }
155
156         augeas { 'inittab_replicate':
157                 context => '/files/etc/inittab',
158                 changes => [
159                         'set ud/runlevels 2345',
160                         'set ud/action respawn',
161                         'set ud/process "/usr/bin/ud-replicated -d"',
162                 ],
163                 notify  => Exec['init q'],
164         }
165
166         if getfromhash($site::nodeinfo, 'hoster', 'mirror-debian') {
167                 site::aptrepo { 'debian':
168                         url        => getfromhash($site::nodeinfo, 'hoster', 'mirror-debian'),
169                         suite      => $::lsbdistcodename,
170                         components => ['main','contrib','non-free']
171                 }
172         }
173
174         file { '/etc/facter':
175                 ensure  => directory,
176                 purge   => true,
177                 force   => true,
178                 recurse => true,
179                 source  => 'puppet:///files/empty/',
180         }
181         file { '/etc/facter/facts.d':
182                 ensure => directory,
183         }
184         file { '/etc/facter/facts.d/debian_facts.yaml':
185                 content => template('debian-org/debian_facts.yaml.erb')
186         }
187         file { '/etc/apt/preferences':
188                 source => 'puppet:///modules/debian-org/apt.preferences',
189         }
190         file { '/etc/apt/apt.conf.d/local-compression':
191                 source => 'puppet:///modules/debian-org/apt.conf.d/local-compression',
192         }
193         file { '/etc/apt/apt.conf.d/local-recommends':
194                 source => 'puppet:///modules/debian-org/apt.conf.d/local-recommends',
195         }
196         file { '/etc/apt/apt.conf.d/local-pdiffs':
197                 source => 'puppet:///modules/debian-org/apt.conf.d/local-pdiffs',
198         }
199         file { '/etc/timezone':
200                 source => 'puppet:///modules/debian-org/timezone',
201                 notify => Exec['dpkg-reconfigure tzdata -pcritical -fnoninteractive'],
202         }
203         if $::hostname == handel {
204                 include puppetmaster::db
205                 $dbpassword = $puppetmaster::db::password
206         }
207         file { '/etc/puppet/puppet.conf':
208                 content => template('debian-org/puppet.conf.erb'),
209         }
210         file { '/etc/default/puppet':
211                 source => 'puppet:///modules/debian-org/puppet.default',
212         }
213         file { '/etc/cron.d/dsa-puppet-stuff':
214                 source  => 'puppet:///modules/debian-org/dsa-puppet-stuff.cron',
215                 require => Package['debian.org'],
216         }
217         file { '/etc/ldap/ldap.conf':
218                 require => Package['debian.org'],
219                 source  => 'puppet:///modules/debian-org/ldap.conf',
220         }
221         file { '/etc/pam.d/common-session':
222                 require => Package['debian.org'],
223                 content => template('debian-org/pam.common-session.erb'),
224         }
225         file { '/etc/pam.d/common-session-noninteractive':
226                 require => Package['debian.org'],
227                 content => template('debian-org/pam.common-session-noninteractive.erb'),
228         }
229         file { '/etc/rc.local':
230                 mode   => '0755',
231                 source => 'puppet:///modules/debian-org/rc.local',
232                 notify => Exec['rc.local start'],
233         }
234         file { '/etc/dsa':
235                 ensure => directory,
236                 mode   => '0755',
237         }
238         file { '/etc/dsa/cron.ignore.dsa-puppet-stuff':
239                 source  => 'puppet:///modules/debian-org/dsa-puppet-stuff.cron.ignore',
240                 require => Package['debian.org']
241         }
242         file { '/etc/nsswitch.conf':
243                 mode   => '0755',
244                 source => 'puppet:///modules/debian-org/nsswitch.conf',
245         }
246
247         # set mmap_min_addr to 4096 to mitigate
248         # Linux NULL-pointer dereference exploits
249         site::sysctl { 'mmap_min_addr':
250                 ensure => absent
251         }
252         site::sysctl { 'perf_event_paranoid':
253                 key   => 'kernel.perf_event_paranoid',
254                 value => '2',
255         }
256         site::alternative { 'editor':
257                 linkto => '/usr/bin/vim.basic',
258         }
259         site::alternative { 'view':
260                 linkto => '/usr/bin/vim.basic',
261         }
262         mailalias { 'samhain-reports':
263                 ensure    => present,
264                 recipient => $debianadmin,
265                 require   => Package['debian.org']
266         }
267
268         file { '/usr/local/bin/check_for_updates':
269                 source => 'puppet:///modules/debian-org/check_for_updates',
270                 mode   => '0755',
271                 owner  => root,
272                 group  => root,
273         }
274
275         exec { 'apt-get update':
276                 path    => '/usr/bin:/usr/sbin:/bin:/sbin',
277                 onlyif  => '/usr/local/bin/check_for_updates',
278                 require => File['/usr/local/bin/check_for_updates']
279         }
280         Exec['apt-get update']->Package<| tag == extra_repo |>
281
282         exec { 'dpkg-reconfigure tzdata -pcritical -fnoninteractive':
283                 path        => '/usr/bin:/usr/sbin:/bin:/sbin',
284                 refreshonly => true
285         }
286         exec { 'puppetmaster restart':
287                 path        => '/etc/init.d:/usr/bin:/usr/sbin:/bin:/sbin',
288                 refreshonly => true
289         }
290         exec { 'rc.local start':
291                 path        => '/etc/init.d:/usr/bin:/usr/sbin:/bin:/sbin',
292                 refreshonly => true
293         }
294         exec { 'init q':
295                 refreshonly => true
296         }
297
298         tidy { '/var/lib/puppet/clientbucket/':
299                 age      => '2w',
300                 recurse  => 9,
301                 type     => ctime,
302                 matches  => [ 'paths', 'contents' ],
303                 schedule => weekly
304         }
305 }