re-enable puppet access
[mirror/dsa-puppet.git] / modules / roles / manifests / static_mirror.pp
1 # a static mirror
2 #
3 # this receives pushes from the master and then usually serves the content to the public
4 class roles::static_mirror {
5   include roles::static::base
6   include roles::static::srvdir
7
8   # mirrors talk only to masters
9   class { 'roles::static::ssh':
10     add_tag     => 'staticsync-master',
11     collect_tag => 'staticsync-mirror',
12   }
13
14   include apache2::expires
15   include apache2::rewrite
16
17   package { 'libapache2-mod-geoip': ensure => installed, }
18   package { 'geoip-database': ensure => installed, }
19
20   include apache2::ssl
21   apache2::module { 'include': }
22   apache2::module { 'geoip': require => [Package['libapache2-mod-geoip'], Package['geoip-database']]; }
23   apache2::module { 'deflate': }
24   apache2::module { 'filter': }
25
26   file { '/usr/local/bin/static-mirror-run':
27     source => 'puppet:///modules/roles/static-mirroring/static-mirror-run',
28     mode   => '0555',
29   }
30
31   file { '/usr/local/bin/static-mirror-run-all':
32     source => 'puppet:///modules/roles/static-mirroring/static-mirror-run-all',
33     mode   => '0555',
34   }
35
36   file { '/etc/cron.d/puppet-static-mirror': ensure => absent, }
37   concat::fragment { 'dsa-puppet-stuff--static-mirror':
38     target => '/etc/cron.d/dsa-puppet-stuff',
39     content  => @(EOF)
40       @reboot staticsync sleep 60; chronic static-mirror-run-all
41       | EOF
42   }
43
44   $onion_v4_addr = $::hostname ? {
45     klecker    => '130.89.148.14',
46     mirror-isc => '149.20.4.15',
47     senfter    => '5.153.231.4',
48     default    => undef,
49   }
50   $vhost_listen = $::hostname ? {
51     klecker    => '130.89.148.14:80 [2001:67c:2564:a119::148:14]:80',
52     mirror-isc => '149.20.4.15:80 [2001:4f8:1:c::15]:80',
53     mirror-anu => '150.203.164.62:80 [2001:388:1034:2900::3e]:80',
54     default    => '*:80',
55   }
56   $vhost_listen_443 = $::hostname ? {
57     klecker    => '130.89.148.14:443 [2001:67c:2564:a119::148:14]:443',
58     mirror-isc => '149.20.4.15:443 [2001:4f8:1:c::15]:443',
59     mirror-anu => '150.203.164.62:443 [2001:388:1034:2900::3e]:443',
60     default    => '*:443',
61   }
62   $redirect_vhosts = true
63
64   apache2::config { 'local-static-vhost.conf':
65     ensure => absent,
66   }
67   apache2::config { 'local-static-vhost':
68     content => template('roles/static-mirroring/static-vhost.conf.erb'),
69   }
70
71   apache2::site { '010-planet.debian.org':
72     site    => 'planet.debian.org',
73     ensure  => has_static_component('planet.debian.org') ? { true => 'present', false => 'absent' },
74     content => template('roles/static-mirroring/vhost/planet.debian.org.erb'),
75   }
76
77   apache2::site { '010-lintian.debian.org':
78     site    => 'lintian.debian.org',
79     ensure  => absent,
80   }
81
82   apache2::site { '010-static-vhosts-00-manpages':
83     site   => 'static-manpages.debian.org',
84     ensure  => has_static_component('manpages.debian.org') ? { true => 'present', false => 'absent' },
85     content => template('roles/static-mirroring/vhost/manpages.debian.org.erb'),
86   }
87   apache2::site { '010-static-vhosts-simple':
88     site => 'static-vhosts-simple',
89     content => template('roles/static-mirroring/vhost/static-vhosts-simple.erb'),
90   }
91
92   $wwwdo_server_name = 'www.debian.org'
93   $wwwdo_document_root = '/srv/static.debian.org/mirrors/www.debian.org/cur'
94   apache2::site { '005-www.debian.org':
95     site   => 'www.debian.org',
96     ensure  => has_static_component('www.debian.org') ? { true => 'present', false => 'absent' },
97     content => template('roles/apache-www.debian.org.erb'),
98   }
99
100   ssl::service { 'www.debian.org'      : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
101   ssl::service { 'debian.org' :
102     ensure  => has_static_component('www.debian.org') ? { true => 'present', false => 'absent' },
103     notify  => Exec['service apache2 reload'],
104     key => true,
105   }
106
107   # do
108   ssl::service { 'appstream.debian.org'          : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
109   ssl::service { 'backports.debian.org'          : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
110   ssl::service { 'bits.debian.org'               : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
111   ssl::service { 'blends.debian.org'             : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
112   ssl::service { 'cdbuilder-logs.debian.org'     : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true }
113   ssl::service { 'd-i.debian.org'                : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true }
114   ssl::service { 'deb.debian.org'                : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true }
115   ssl::service { 'dpl.debian.org'                : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true }
116   ssl::service { 'dsa.debian.org'                : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true }
117   ssl::service { 'incoming.debian.org'           : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
118   ssl::service { 'incoming.ports.debian.org'     : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
119   ssl::service { 'lintian.debian.org'            : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
120   ssl::service { 'lists.alioth.debian.org'       : ensure => 'present',  notify  => Exec['service apache2 reload'], key => true, }
121   ssl::service { 'manpages.debian.org'           : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
122   ssl::service { 'metadata-backend.ftp-master.debian.org':
123     ensure => has_static_component('metadata.ftp-master.debian.org') ? { true => 'present', false => 'absent' },
124     notify  => Exec['service apache2 reload'],
125     key => true,
126   }
127   ssl::service { 'mirror-master.debian.org'      : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
128   ssl::service { 'onion.debian.org'              : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
129   ssl::service { 'openpgpkey.debian.org'         : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
130   ssl::service { 'pkg-ruby-extras.alioth.debian.org' : ensure => 'present',  notify  => Exec['service apache2 reload'], key => true, }
131   ssl::service { 'planet-backend.debian.org'     :
132     ensure => has_static_component('planet.debian.org') ? { true => 'present', false => 'absent' },
133     notify => Exec['service apache2 reload'],
134     key    => true,
135   }
136   ssl::service { 'release.debian.org'            : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
137   ssl::service { 'rtc.debian.org'                : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true }
138   ssl::service { 'security-team.debian.org'      : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
139   ssl::service { 'www.ports.debian.org'          : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
140   # dn
141   ssl::service { 'bootstrap.debian.net'          : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
142   ssl::service { 'debaday.debian.net'            : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
143   ssl::service { 'debdeltas.debian.net'          : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
144   ssl::service { 'micronews.debian.org'          : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
145   ssl::service { 'mozilla.debian.net'            : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
146   ssl::service { 'news.debian.net'               : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
147   ssl::service { 'sources.debian.net'            : ensure => 'present',  notify  => Exec['service apache2 reload'], key => true, }
148   ssl::service { 'timeline.debian.net'           : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
149   ssl::service { 'video.debian.net'              : ensure => 'present',  notify  => Exec['service apache2 reload'], key => true, }
150   ssl::service { 'wnpp-by-tags.debian.net'       : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
151   # dc
152   ssl::service { 'debconf.org'                   : ensure => 'present', notify  => Exec['service apache2 reload'], key => true, }
153   ssl::service { '10years.debconf.org'           : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
154   ssl::service { 'debconf0.debconf.org'          : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
155   ssl::service { 'debconf1.debconf.org'          : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
156   ssl::service { 'debconf16.debconf.org'         : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
157   ssl::service { 'debconf17.debconf.org'         : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
158   ssl::service { 'debconf18.debconf.org'         : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
159   ssl::service { 'debconf19.debconf.org'         : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
160   ssl::service { 'debconf2.debconf.org'          : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
161   ssl::service { 'debconf3.debconf.org'          : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
162   ssl::service { 'debconf4.debconf.org'          : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
163   ssl::service { 'debconf5.debconf.org'          : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
164   ssl::service { 'debconf6.debconf.org'          : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
165   ssl::service { 'debconf7.debconf.org'          : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
166   ssl::service { 'es.debconf.org'                : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
167   ssl::service { 'fr.debconf.org'                : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
168   ssl::service { 'miniconf10.debconf.org'        : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
169   ssl::service { 'video.debconf.org'             : ensure => 'present',  notify  => Exec['service apache2 reload'], key => true, }
170   ssl::service { 'wiki.debconf.org'              : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
171   include apache2::proxy_http
172   ssl::service { 'www.debconf.org'               : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
173
174   if has_role('static_mirror_onion') {
175     if ! $onion_v4_addr {
176       fail("Do not have an onion_v4_addr set for $::hostname.")
177     }
178
179     onion::service { 'd-i.debian.org'      : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_v4_addr }
180     onion::service { 'dpl.debian.org'      : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_v4_addr }
181     onion::service { 'dsa.debian.org'      : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_v4_addr }
182     onion::service { 'rtc.debian.org'      : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_v4_addr }
183     onion::service { 'www.debian.org'      : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_v4_addr }
184
185     # do
186     onion::service { 'appstream.debian.org'          : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_v4_addr }
187     onion::service { 'backports.debian.org'          : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_v4_addr }
188     onion::service { 'bits.debian.org'               : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_v4_addr }
189     onion::service { 'blends.debian.org'             : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_v4_addr }
190     onion::service { 'cdbuilder-logs.debian.org'     : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_v4_addr }
191     onion::service { 'incoming.debian.org'           : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_v4_addr }
192     onion::service { 'incoming.ports.debian.org'     : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_v4_addr }
193     onion::service { 'lintian.debian.org'            : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_v4_addr }
194     onion::service { 'manpages.debian.org'           : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_v4_addr }
195     onion::service { 'mirror-master.debian.org'      : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_v4_addr }
196     onion::service { 'onion.debian.org'              : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_v4_addr }
197     onion::service { 'openpgpkey.debian.org'         : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_v4_addr }
198     onion::service { 'release.debian.org'            : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_v4_addr }
199     onion::service { 'security-team.debian.org'      : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_v4_addr }
200     onion::service { 'www.ports.debian.org'          : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_v4_addr }
201     # dn
202     onion::service { 'bootstrap.debian.net'           : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_v4_addr }
203     onion::service { 'debaday.debian.net'            : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_v4_addr }
204     onion::service { 'debdeltas.debian.net'          : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_v4_addr }
205     onion::service { 'micronews.debian.org'          : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_v4_addr }
206     onion::service { 'mozilla.debian.net'            : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_v4_addr }
207     onion::service { 'news.debian.net'               : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_v4_addr }
208     onion::service { 'timeline.debian.net'           : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_v4_addr }
209     onion::service { 'wnpp-by-tags.debian.net'       : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_v4_addr }
210     # dc
211     onion::service { '10years.debconf.org'           : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_v4_addr }
212     onion::service { 'debconf0.debconf.org'          : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_v4_addr }
213     onion::service { 'debconf1.debconf.org'          : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_v4_addr }
214     onion::service { 'debconf16.debconf.org'         : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_v4_addr }
215     onion::service { 'debconf17.debconf.org'         : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_v4_addr }
216     onion::service { 'debconf18.debconf.org'         : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_v4_addr }
217     onion::service { 'debconf2.debconf.org'          : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_v4_addr }
218     onion::service { 'debconf3.debconf.org'          : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_v4_addr }
219     onion::service { 'debconf4.debconf.org'          : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_v4_addr }
220     onion::service { 'debconf5.debconf.org'          : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_v4_addr }
221     onion::service { 'debconf6.debconf.org'          : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_v4_addr }
222     onion::service { 'debconf7.debconf.org'          : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_v4_addr }
223     onion::service { 'es.debconf.org'                : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_v4_addr }
224     onion::service { 'fr.debconf.org'                : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_v4_addr }
225     onion::service { 'miniconf10.debconf.org'        : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_v4_addr }
226
227     # non-SSL
228     onion::service { 'metadata.ftp-master.debian.org': ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_v4_addr }
229     onion::service { 'planet.debian.org'             : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_v4_addr }
230   }
231
232   file { '/srv/static.debian.org/puppet':
233     ensure => directory,
234     mode   => '02755'
235   }
236   file { '/srv/static.debian.org/puppet/disabled-service':
237     ensure => directory,
238     mode   => '02755'
239   }
240   file { '/srv/static.debian.org/puppet/disabled-service/503.html':
241     source => 'puppet:///modules/roles/static-htdocs/disabled-service/503.html',
242   }
243
244   ssl::service { 'archive.debian.net': ensure => present, notify  => Exec['service apache2 reload'], key => true, }
245   file { '/srv/static.debian.org/puppet/archive.debian.net':
246     ensure => absent,
247   }
248   file { '/srv/static.debian.org/puppet/archive.debian.net/503.html':
249     ensure => absent,
250   }
251
252   ssl::service { 'cdimage.debian.org': ensure => present, notify => Exec['service apache2 reload'], key => true, }
253   file { '/srv/static.debian.org/puppet/cdimage.debian.org':
254     ensure => directory,
255   }
256   file { '/srv/static.debian.org/puppet/cdimage.debian.org/503.html':
257     source => 'puppet:///modules/roles/static-htdocs/cdimage-maintenance.html',
258   }
259 }