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