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