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