puppet-ssl-key-pins.conf
[mirror/dsa-puppet.git] / modules / apache2 / manifests / init.pp
1 # = Class: apache2
2 #
3 # Standard apache config debian.org hosts
4 #
5 # == Sample Usage:
6 #
7 #   include apache2
8 #
9 class apache2 {
10         package { 'apache2':
11                 ensure => installed,
12         }
13
14         service { 'apache2':
15                 ensure  => running,
16                 require => Package['apache2'],
17         }
18
19         apache2::module { 'info': }
20         apache2::module { 'status': }
21         apache2::module { 'headers': }
22
23         package { 'libapache2-mod-macro':
24                 ensure => installed
25         }
26
27         apache2::module { 'macro':
28                 require => Package['libapache2-mod-macro']
29         }
30
31         apache2::site { '00-default':
32                 site     => 'default-debian.org',
33                 content  => template('apache2/default-debian.org.erb'),
34         }
35         apache2::site { 'xx-default-ssl':
36                 site     => 'default-debian.org-ssl',
37                 content  => template('apache2/default-debian.org-ssl.erb'),
38         }
39
40         apache2::site { '000-default':
41                 ensure => absent,
42         }
43
44         apache2::config { 'serve-cgi-bin':
45                 ensure => absent,
46         }
47
48         apache2::config { 'ressource-limits':
49                 ensure => absent,
50         }
51
52         if has_role('udd') {
53                 $memlimit = 512 * 1024 * 1024
54         } elsif has_role('dgit_git') {
55                 $memlimit = 512 * 1024 * 1024
56         } elsif has_role('sso') {
57                 $memlimit = 512 * 1024 * 1024
58         } elsif has_role('popcon') {
59                 $memlimit = 512 * 1024 * 1024
60         } elsif has_role('qamaster') {
61                 $memlimit = 300 * 1024 * 1024
62         } else {
63                 $memlimit = 192 * 1024 * 1024
64         }
65
66         apache2::config { 'resource-limits':
67                 content => template('apache2/resource-limits.erb'),
68         }
69
70         apache2::config { 'security':
71                 source => 'puppet:///modules/apache2/security',
72         }
73
74         apache2::config { 'logformat-privacy':
75                 source => 'puppet:///modules/apache2/logformat-privacy',
76         }
77
78         apache2::config { 'local-serverinfo':
79                 source => 'puppet:///modules/apache2/local-serverinfo',
80         }
81
82         apache2::config { 'server-status':
83                 source => 'puppet:///modules/apache2/server-status',
84         }
85
86         apache2::config { 'puppet-ssl-macros':
87                 source => 'puppet:///modules/apache2/puppet-ssl-macros',
88         }
89
90         apache2::config { 'puppet-ftp-macros':
91                 source => 'puppet:///modules/apache2/puppet-ftp-macros',
92         }
93
94         apache2::config { 'puppet-config':
95                 content => template('apache2/puppet-config.erb'),
96         }
97
98         apache2::config { 'pratchett':
99                 source => 'puppet:///modules/apache2/pratchett',
100         }
101
102         if $::lsbmajdistrelease > 7 {
103                 file { '/etc/apache2/mods-available/mpm_worker.conf':
104                         content => template('apache2/mpm_worker.erb'),
105                 }
106         }
107
108         file { '/etc/apache2/sites-available/common-ssl.inc':
109                 ensure => absent,
110         }
111
112         file { '/etc/logrotate.d/apache2':
113                 source => 'puppet:///modules/apache2/apache2.logrotate',
114         }
115
116         file { [ '/srv/www', '/srv/www/default.debian.org', '/srv/www/default.debian.org/htdocs', '/srv/www/default.debian.org/htdocs-disabled' ]:
117                 ensure  => directory,
118                 mode    => '0755',
119         }
120
121         file { '/srv/www/default.debian.org/htdocs/index.html':
122                 content => template('apache2/default-index.html'),
123         }
124
125         file { '/srv/www/default.debian.org/htdocs-disabled/index.html':
126                 content => template('apache2/disabled-index.html'),
127         }
128
129         file { '/var/log/apache2/.nobackup':
130                 mode    => '0644',
131                 content => '',
132         }
133
134         munin::check { 'apache_accesses': }
135         munin::check { 'apache_processes': }
136         munin::check { 'apache_volume': }
137         munin::check { 'apache_servers': }
138         munin::check { 'ps_apache2':
139                 script => 'ps_',
140         }
141
142         if $::hostname in [beach,buxtehude,picconi,pkgmirror-1and1,pkgmirror-csail] {
143                 include apache2::dynamic
144         } else {
145                 @ferm::rule { 'dsa-http':
146                         prio        => '23',
147                         description => 'Allow web access',
148                         rule        => '&SERVICE(tcp, (http https))'
149                 }
150         }
151
152         @ferm::rule { 'dsa-http-v6':
153                 domain          => '(ip6)',
154                 prio            => '23',
155                 description     => 'Allow web access',
156                 rule            => '&SERVICE(tcp, (http https))'
157         }
158
159         exec { 'service apache2 reload':
160                 path        => '/usr/bin:/usr/sbin:/bin:/sbin',
161                 command     => 'service apache2 reload',
162                 refreshonly => true,
163                 require =>  Package['apache2'],
164         }
165
166         concat { '/etc/apache2/conf-available/puppet-ssl-key-pins.conf':
167                 owner   => root,
168                 group   => root,
169                 mode    => '0644',
170                 require =>  Package['apache2'],
171         }
172         apache2::config { 'puppet-ssl-key-pins': }
173 }