]> git.donarmstrong.com Git - dsa-puppet.git/blob - modules/debian-org/manifests/init.pp
Add myself to samhain reports
[dsa-puppet.git] / modules / debian-org / manifests / init.pp
1 class debian-org {
2         if getfromhash($site::nodeinfo, 'hoster', 'mirror-debian') {
3                 $mirror = getfromhash($site::nodeinfo, 'hoster', 'mirror-debian')
4         } else {
5                 $mirror = 'http://http.debian.net/debian/'
6         }
7         if $::lsbmajdistrelease < 7 {
8                 $mirror_backports = 'http://backports.debian.org/debian-backports/'
9         } else {
10                 $mirror_backports = $mirror
11         }
12
13         $debianadmin = [
14                 'debian-archive-debian-samhain-reports@master.debian.org',
15                 'debian-admin@ftbfs.de',
16                 'weasel@debian.org',
17                 'steve@lobefin.net',
18                 'paravoid@debian.org'
19                 'zumbi@kos.to'
20         ]
21
22         package { [
23                         'klogd',
24                         'sysklogd',
25                         'rsyslog',
26                 ]:
27                 ensure => purged,
28         }
29         package { [
30                         'debian.org',
31                         'dsa-munin-plugins',
32                 ]:
33                 ensure => installed,
34                 tag    => extra_repo,
35         }
36
37         package { [
38                         'apt-utils',
39                         'bash-completion',
40                         'dnsutils',
41                         'less',
42                         'lsb-release',
43                         'libfilesystem-ruby1.8',
44                         'mtr-tiny',
45                         'nload',
46                         'pciutils',
47                 ]:
48                 ensure => installed,
49         }
50
51         if $::lsbmajdistrelease >= 7 {
52                 package { 'libfilesystem-ruby1.9.1':
53                         ensure => installed,
54                 }
55         }
56
57         munin::check { [
58                         'cpu',
59                         'entropy',
60                         'forks',
61                         'interrupts',
62                         'iostat',
63                         'irqstats',
64                         'load',
65                         'memory',
66                         'ntp_offset',
67                         'ntp_states',
68                         'open_files',
69                         'open_inodes',
70                         'processes',
71                         'swap',
72                         'uptime',
73                         'vmstat',
74                 ]:
75         }
76
77         if getfromhash($site::nodeinfo, 'broken-rtc') {
78                 package { 'fake-hwclock':
79                         ensure => installed,
80                         tag    => extra_repo,
81                 }
82         }
83
84         package { 'molly-guard':
85                 ensure => installed,
86         }
87         file { '/etc/molly-guard/run.d/10-check-kvm':
88                 mode    => '0755',
89                 source  => 'puppet:///modules/debian-org/molly-guard/10-check-kvm',
90                 require => Package['molly-guard'],
91         }
92         file { '/etc/molly-guard/run.d/15-acquire-reboot-lock':
93                 mode    => '0755',
94                 source  => 'puppet:///modules/debian-org/molly-guard/15-acquire-reboot-lock',
95                 require => Package['molly-guard'],
96         }
97
98         site::aptrepo { 'security':
99                 url        => 'http://security.debian.org/',
100                 suite      => "${::lsbdistcodename}/updates",
101                 components => ['main','contrib','non-free']
102         }
103
104         site::aptrepo { 'backports.debian.org':
105                 url        => $mirror_backports,
106                 suite      => "${::lsbdistcodename}-backports",
107                 components => ['main','contrib','non-free']
108         }
109         site::aptrepo { 'backports.org':
110                 ensure => absent,
111                 keyid => '16BA136C',
112                 key => 'puppet:///modules/debian-org/backports.org.asc',
113         }
114
115         site::aptrepo { 'volatile':
116                 url        => $mirror,
117                 suite      => "${::lsbdistcodename}-updates",
118                 components => ['main','contrib','non-free']
119         }
120
121         site::aptrepo { 'debian.org':
122                 ensure => absent,
123         }
124
125         site::aptrepo { 'db.debian.org':
126                 url        => 'http://db.debian.org/debian-admin',
127                 suite      => 'lenny',
128                 components => 'main',
129                 key        => 'puppet:///modules/debian-org/db.debian.org.asc',
130         }
131
132         if getfromhash($site::nodeinfo, 'hoster', 'mirror-debian') {
133                 site::aptrepo { 'debian':
134                         url        => getfromhash($site::nodeinfo, 'hoster', 'mirror-debian'),
135                         suite      => $::lsbdistcodename,
136                         components => ['main','contrib','non-free']
137                 }
138         }
139
140         file { '/etc/facter':
141                 ensure  => directory,
142                 purge   => true,
143                 force   => true,
144                 recurse => true,
145                 source  => 'puppet:///files/empty/',
146         }
147         file { '/etc/facter/facts.d':
148                 ensure => directory,
149         }
150         file { '/etc/facter/facts.d/debian_facts.yaml':
151                 content => template('debian-org/debian_facts.yaml.erb')
152         }
153         file { '/etc/apt/preferences':
154                 source => 'puppet:///modules/debian-org/apt.preferences',
155         }
156         file { '/etc/apt/trusted-keys.d/':
157                 ensure => directory,
158                 purge  => true,
159         }
160         file { '/etc/apt/apt.conf.d/local-compression':
161                 source => 'puppet:///modules/debian-org/apt.conf.d/local-compression',
162         }
163         file { '/etc/apt/apt.conf.d/local-recommends':
164                 source => 'puppet:///modules/debian-org/apt.conf.d/local-recommends',
165         }
166         file { '/etc/apt/apt.conf.d/local-pdiffs':
167                 source => 'puppet:///modules/debian-org/apt.conf.d/local-pdiffs',
168         }
169         file { '/etc/timezone':
170                 source => 'puppet:///modules/debian-org/timezone',
171                 notify => Exec['dpkg-reconfigure tzdata -pcritical -fnoninteractive'],
172         }
173         if $::hostname == handel {
174                 include puppetmaster::db
175                 $dbpassword = $puppetmaster::db::password
176         }
177         file { '/etc/puppet/puppet.conf':
178                 content => template('debian-org/puppet.conf.erb'),
179         }
180         file { '/etc/default/puppet':
181                 source => 'puppet:///modules/debian-org/puppet.default',
182         }
183         file { '/etc/cron.d/dsa-puppet-stuff':
184                 source => 'puppet:///modules/debian-org/dsa-puppet-stuff.cron',
185                 require => Package['debian.org'],
186         }
187         file { '/etc/ldap/ldap.conf':
188                 require => Package['debian.org'],
189                 source => 'puppet:///modules/debian-org/ldap.conf',
190         }
191         file { '/etc/pam.d/common-session':
192                 require => Package['debian.org'],
193                 content => template('debian-org/pam.common-session.erb'),
194         }
195         file { '/etc/pam.d/common-session-noninteractive':
196                 require => Package['debian.org'],
197                 content => template('debian-org/pam.common-session-noninteractive.erb'),
198         }
199         file { '/etc/rc.local':
200                 mode   => '0755',
201                 source => 'puppet:///modules/debian-org/rc.local',
202                 notify => Exec['rc.local start'],
203         }
204         file { '/etc/dsa':
205                 ensure => directory,
206                 mode   => '0755',
207         }
208         file { '/etc/dsa/cron.ignore.dsa-puppet-stuff':
209                 source  => 'puppet:///modules/debian-org/dsa-puppet-stuff.cron.ignore',
210                 require => Package['debian.org']
211         }
212         file { '/etc/nsswitch.conf':
213                 mode   => '0755',
214                 source => 'puppet:///modules/debian-org/nsswitch.conf',
215         }
216
217         # set mmap_min_addr to 4096 to mitigate
218         # Linux NULL-pointer dereference exploits
219         site::sysctl { 'mmap_min_addr':
220                 ensure => absent
221         }
222         site::sysctl { 'perf_event_paranoid':
223                 key   => 'kernel.perf_event_paranoid',
224                 value => '2',
225         }
226         site::alternative { 'editor':
227                 linkto => '/usr/bin/vim.basic',
228         }
229         site::alternative { 'view':
230                 linkto => '/usr/bin/vim.basic',
231         }
232         mailalias { 'samhain-reports':
233                 ensure => present,
234                 recipient => $debianadmin,
235                 require => Package['debian.org']
236         }
237
238         exec { 'apt-get update':
239                 path        => '/usr/bin:/usr/sbin:/bin:/sbin',
240                 refreshonly => true,
241         }
242         Exec['apt-get update']->Package<| tag == extra_repo |>
243
244         exec { 'dpkg-reconfigure tzdata -pcritical -fnoninteractive':
245                 path        => '/usr/bin:/usr/sbin:/bin:/sbin',
246                 refreshonly => true
247         }
248         exec { 'puppetmaster restart':
249                 path        => '/etc/init.d:/usr/bin:/usr/sbin:/bin:/sbin',
250                 refreshonly => true
251         }
252         exec { 'rc.local start':
253                 path        => '/etc/init.d:/usr/bin:/usr/sbin:/bin:/sbin',
254                 refreshonly => true
255         }
256         exec { 'init q':
257                 refreshonly => true
258         }
259 }