2 include munin-node::apache
5 "apache2": ensure => installed;
6 "logrotate": ensure => installed;
11 "php5-suhosin": ensure => installed;
13 file { "/etc/php5/conf.d/suhosin.ini":
14 source => [ "puppet:///apache2/per-host/$fqdn/etc/php5/conf.d/suhosin.ini",
15 "puppet:///apache2/common/etc/php5/conf.d/suhosin.ini" ],
16 require => Package["apache2", "php5-suhosin"],
17 notify => Exec["force-reload-apache2"];
23 define activate_apache_site($ensure=present, $site=$name) {
26 default: { $base = $site }
31 file { "/etc/apache2/sites-enabled/$name":
32 ensure => "/etc/apache2/sites-available/$base",
33 require => Package["apache2"],
34 notify => Exec["reload-apache2"];
38 file { "/etc/apache2/sites-enabled/$name":
40 notify => Exec["reload-apache2"];
43 default: { err ( "Unknown ensure value: '$ensure'" ) }
47 define enable_module($ensure=present) {
50 exec { "/usr/sbin/a2enmod $name":
51 unless => "/bin/sh -c '[ -L /etc/apache2/mods-enabled/${name}.load ]'",
52 notify => Exec["force-reload-apache2"],
56 exec { "/usr/sbin/a2dismod $name":
57 onlyif => "/bin/sh -c '[ -L /etc/apache2/mods-enabled/${name}.load ]'",
58 notify => Exec["force-reload-apache2"],
61 default: { err ( "Unknown ensure value: '$ensure'" ) }
70 activate_apache_site {
71 "00-default": site => "default-debian.org";
72 "000-default": ensure => absent;
76 "/etc/apache2/conf.d/ressource-limits":
77 content => template("apache2/ressource-limits.erb"),
78 require => Package["apache2"],
79 notify => Exec["reload-apache2"];
80 "/etc/apache2/conf.d/security":
81 source => [ "puppet:///apache2/per-host/$fqdn/etc/apache2/conf.d/security",
82 "puppet:///apache2/common/etc/apache2/conf.d/security" ],
83 require => Package["apache2"],
84 notify => Exec["reload-apache2"];
85 "/etc/apache2/conf.d/local-serverinfo":
86 source => [ "puppet:///apache2/per-host/$fqdn/etc/apache2/conf.d/local-serverinfo",
87 "puppet:///apache2/common/etc/apache2/conf.d/local-serverinfo" ],
88 require => Package["apache2"],
89 notify => Exec["reload-apache2"];
90 "/etc/apache2/conf.d/server-status":
91 source => [ "puppet:///apache2/per-host/$fqdn/etc/apache2/conf.d/server-status",
92 "puppet:///apache2/common/etc/apache2/conf.d/server-status" ],
93 require => Package["apache2"],
94 notify => Exec["reload-apache2"];
96 "/etc/apache2/sites-available/default-debian.org":
97 content => template("apache2/default-debian.org.erb"),
98 require => Package["apache2"],
99 notify => Exec["reload-apache2"];
101 "/etc/logrotate.d/apache2":
102 source => [ "puppet:///apache2/per-host/$fqdn/etc/logrotate.d/apache2",
103 "puppet:///apache2/common/etc/logrotate.d/apache2" ];
108 "/srv/www/default.debian.org":
111 "/srv/www/default.debian.org/htdocs":
114 "/srv/www/default.debian.org/htdocs/index.html":
115 content => template("apache2/default-index.html");
117 # sometimes this is a symlink
120 # ensure => directory;
123 exec { "reload-apache2":
124 command => "/etc/init.d/apache2 reload",
128 exec { "force-reload-apache2":
129 command => "/etc/init.d/apache2 force-reload",
132 @ferm::rule { "dsa-http-limit":
134 description => "limit HTTP DOS",
135 rule => "chain 'http_limit' { mod limit limit-burst 60 limit 15/minute jump ACCEPT; jump DROP; }"
137 @ferm::rule { "dsa-http-soso":
139 description => "slow yahoo spider",
140 rule => "chain 'limit_sosospider' { mod connlimit connlimit-above 2 connlimit-mask 21 jump DROP; jump http_limit; }"
142 @ferm::rule { "dsa-http-yahoo":
144 description => "slow yahoo spider",
145 rule => "chain 'limit_yahoo' { mod connlimit connlimit-above 2 connlimit-mask 16 jump DROP; jump http_limit; }"
147 @ferm::rule { "dsa-http-rules":
149 description => "http subchain",
150 rule => "chain 'http' { saddr ( 74.6.22.182 74.6.18.240 ) jump limit_yahoo; saddr 124.115.0.0/21 jump limit_sosospider; mod recent name HTTPDOS update seconds 1800 jump log_or_drop; mod hashlimit hashlimit-name HTTPDOS hashlimit-mode srcip hashlimit-burst 600 hashlimit 30/minute jump ACCEPT; mod recent name HTTPDOS set jump log_or_drop; }"
152 @ferm::rule { "dsa-http":
154 description => "Allow web access",
155 rule => "proto tcp dport http jump http;"
157 @ferm::rule { "dsa-http-v6":
160 description => "Allow web access",
161 rule => "&SERVICE(tcp, 80)"