3 # Standard apache config debian.org hosts
9 # @param smaller_number_of_threads by default the worker config is geared towards
10 # serving static/cheap content. If the host is very
11 # script heavy (say the bug tracking system), set this
12 # to reduce the number of worker threads.
13 # @param rlimitnproc A resource limit for number of processes. The default is usually fine.
14 # @param rlimitmem A resource limit for memory usage. The default is usually fine.
15 # @param public Whether this host's apache should be accessible from the public internet.
16 # Sets appropriate firewall rules and optionally rate limits.
17 # @param mpm Which Multi-Processing Modules to use. Defaults to worker;
18 # the alternative is prefork.
19 # @param rate_limit Rate limit incoming connections at the netfilter level. If false,
20 # (and public is true), all incoming connections to the http
21 # and https ports get sent to the http chain, and accepted at
22 # ferm prio 90, so other things can be done to web traffic
25 Boolean $smaller_number_of_threads = false,
26 Integer $rlimitnproc = 256,
27 Integer $rlimitmem = 192 * 1024 * 1024,
28 Boolean $public = true,
29 Enum['prefork','worker'] $mpm = 'worker',
30 Boolean $rate_limit = false,
40 require => Package['apache2'],
43 apache2::module { 'reqtimeout': }
44 apache2::module { 'info': }
45 apache2::module { 'status': }
46 apache2::module { 'headers': }
47 apache2::module { 'macro': }
49 apache2::site { '00-default':
50 site => 'default-debian.org',
51 content => template('apache2/default-debian.org.erb'),
53 apache2::site { 'xx-default-ssl':
54 site => 'default-debian.org-ssl',
55 content => template('apache2/default-debian.org-ssl.erb'),
58 apache2::site { '000-default':
62 apache2::config { 'serve-cgi-bin':
66 apache2::config { 'resource-limits':
67 content => template('apache2/resource-limits.erb'),
70 apache2::config { 'security':
71 source => 'puppet:///modules/apache2/security',
74 apache2::config { 'logformat-privacy':
75 source => 'puppet:///modules/apache2/logformat-privacy',
78 apache2::config { 'local-serverinfo':
79 source => 'puppet:///modules/apache2/local-serverinfo',
82 apache2::config { 'server-status':
83 source => 'puppet:///modules/apache2/server-status',
86 apache2::config { 'puppet-ssl-macros':
87 source => 'puppet:///modules/apache2/puppet-ssl-macros',
90 apache2::config { 'puppet-ftp-macros':
91 source => 'puppet:///modules/apache2/puppet-ftp-macros',
94 apache2::config { 'puppet-config':
95 content => template('apache2/puppet-config.erb'),
98 apache2::config { 'headers':
99 source => 'puppet:///modules/apache2/headers',
102 apache2::config { 'disabled-service':
103 source => 'puppet:///modules/apache2/disabled-service',
106 apache2::module { 'mpm_event': ensure => absent }
107 apache2::module { 'mpm_worker' : ensure => ($mpm == 'worker' ) ? { true => 'present', default => absent } }
108 apache2::module { 'mpm_prefork': ensure => ($mpm == 'prefork') ? { true => 'present', default => absent } }
110 file { '/etc/apache2/mods-available/mpm_worker.conf':
111 content => template('apache2/mpm_worker.erb'),
114 file { '/etc/logrotate.d/apache2':
115 source => 'puppet:///modules/apache2/apache2.logrotate',
118 file { '/var/log/apache2':
122 file { '/var/log/apache2/.nobackup':
127 munin::check { 'apache_accesses': }
128 munin::check { 'apache_processes': }
129 munin::check { 'apache_volume': }
130 munin::check { 'apache_servers': }
131 munin::check { 'ps_apache2':
134 # The munin script needs this
135 package { 'libwww-perl':
140 ferm::rule { 'dsa-http':
142 description => 'A web subchain',
143 domain => '(ip ip6)',
144 rule => 'proto tcp dport (http https 6081) jump http'
148 include apache2::dynamic
150 ferm::rule { 'dsa-http-allow':
151 description => 'http subchain, allow everything',
154 domain => '(ip ip6)',
155 rule => 'jump ACCEPT',
160 exec { 'service apache2 reload':
161 path => '/usr/bin:/usr/sbin:/bin:/sbin',
162 command => 'service apache2 reload',
164 require => Package['apache2'],
167 apache2::config { 'puppet-ssl-key-pins':
168 content => template('apache2/ssl-key-pins.erb'),
169 notify => Exec['service apache2 reload'],
172 apache2::config { 'local-scheduled-shutdown':
173 source => 'puppet:///modules/apache2/local-scheduled-shutdown',