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