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