Enable lingering for the contributors user
[mirror/dsa-puppet.git] / modules / roles / manifests / static_mirror_web.pp
1 # a static web mirror
2 #
3 # @param listen_addr IP addresses to have apache listen on
4 # @param onion_service provide the onion service from this host
5 class roles::static_mirror_web(
6   Array[Stdlib::IP::Address] $listen_addr = [],
7   Boolean $onion_service = false,
8 ) {
9   $_enclosed_addresses = empty($listen_addr) ? {
10     true    => ['*'],
11     default => enclose_ipv6($listen_addr),
12   }
13   $vhost_listen     = $_enclosed_addresses.map |$a| { "${a}:80"  } .join(' ')
14   $vhost_listen_443 = $_enclosed_addresses.map |$a| { "${a}:443" } .join(' ')
15
16   include roles::static_mirror
17   include roles::weblog_provider
18
19   include apache2
20   include apache2::expires
21   include apache2::rewrite
22
23   package { 'libapache2-mod-geoip': ensure => installed, }
24   package { 'geoip-database': ensure => installed, }
25
26   include apache2::ssl
27   apache2::module { 'include': }
28   apache2::module { 'geoip': require => [Package['libapache2-mod-geoip'], Package['geoip-database']]; }
29   apache2::module { 'deflate': }
30   apache2::module { 'filter': }
31
32   $redirect_vhosts = true
33
34   apache2::config { 'local-static-vhost.conf':
35     ensure => absent,
36   }
37   apache2::config { 'local-static-vhost':
38     content => template('roles/static-mirroring/static-vhost.conf.erb'),
39   }
40
41   apache2::site { '010-planet.debian.org':
42     ensure  => has_static_component('planet.debian.org') ? { true => 'present', false => 'absent' },
43     site    => 'planet.debian.org',
44     content => template('roles/static-mirroring/vhost/planet.debian.org.erb'),
45   }
46
47   apache2::site { '010-lintian.debian.org':
48     ensure => absent,
49     site   => 'lintian.debian.org',
50   }
51
52   apache2::site { '010-static-vhosts-00-manpages':
53     ensure  => has_static_component('manpages.debian.org') ? { true => 'present', false => 'absent' },
54     site    => 'static-manpages.debian.org',
55     content => template('roles/static-mirroring/vhost/manpages.debian.org.erb'),
56   }
57   apache2::site { '010-static-vhosts-simple':
58     site    => 'static-vhosts-simple',
59     content => template('roles/static-mirroring/vhost/static-vhosts-simple.erb'),
60   }
61
62   $wwwdo_server_name = 'www.debian.org'
63   $wwwdo_document_root = '/srv/static.debian.org/mirrors/www.debian.org/cur'
64   apache2::site { '005-www.debian.org':
65     ensure  => has_static_component('www.debian.org') ? { true => 'present', false => 'absent' },
66     site    => 'www.debian.org',
67     content => template('roles/apache-www.debian.org.erb'),
68   }
69
70   ssl::service { 'www.debian.org'      : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
71   ssl::service { 'debian.org' :
72     ensure => has_static_component('www.debian.org') ? { true => 'present', false => 'absent' },
73     notify => Exec['service apache2 reload'],
74     key    => true,
75   }
76
77   # do
78   ssl::service { 'appstream.debian.org'          : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
79   ssl::service { 'backports.debian.org'          : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
80   ssl::service { 'bits.debian.org'               : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
81   ssl::service { 'blends.debian.org'             : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
82   ssl::service { 'cdbuilder-logs.debian.org'     : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true }
83   ssl::service { 'd-i.debian.org'                : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true }
84   ssl::service { 'deb.debian.org'                : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true }
85   ssl::service { 'dpl.debian.org'                : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true }
86   ssl::service { 'dsa.debian.org'                : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true }
87   ssl::service { 'incoming.debian.org'           : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
88   ssl::service { 'incoming.ports.debian.org'     : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
89   ssl::service { 'lintian.debian.org'            : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
90   ssl::service { 'lists.alioth.debian.org'       : ensure => 'present',  notify  => Exec['service apache2 reload'], key => true, }
91   ssl::service { 'manpages.debian.org'           : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
92   ssl::service { 'metadata-backend.ftp-master.debian.org':
93     ensure => has_static_component('metadata.ftp-master.debian.org') ? { true => 'present', false => 'absent' },
94     notify => Exec['service apache2 reload'],
95     key    => true,
96   }
97   ssl::service { 'mirror-master.debian.org'      : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
98   ssl::service { 'onion.debian.org'              : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
99   ssl::service { 'openpgpkey.debian.org'         : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
100   ssl::service { 'pkg-ruby-extras.alioth.debian.org' : ensure => 'present',  notify  => Exec['service apache2 reload'], key => true, }
101   ssl::service { 'planet-backend.debian.org'     :
102     ensure => has_static_component('planet.debian.org') ? { true => 'present', false => 'absent' },
103     notify => Exec['service apache2 reload'],
104     key    => true,
105   }
106   ssl::service { 'release.debian.org'            : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
107   ssl::service { 'rtc.debian.org'                : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true }
108   ssl::service { 'security-team.debian.org'      : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
109   ssl::service { 'www.ports.debian.org'          : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
110   # dn
111   ssl::service { 'bootstrap.debian.net'          : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
112   ssl::service { 'debaday.debian.net'            : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
113   ssl::service { 'debdeltas.debian.net'          : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
114   ssl::service { 'micronews.debian.org'          : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
115   ssl::service { 'mozilla.debian.net'            : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
116   ssl::service { 'news.debian.net'               : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
117   ssl::service { 'sources.debian.net'            : ensure => 'present',  notify  => Exec['service apache2 reload'], key => true, }
118   ssl::service { 'timeline.debian.net'           : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
119   ssl::service { 'video.debian.net'              : ensure => 'present',  notify  => Exec['service apache2 reload'], key => true, }
120   ssl::service { 'wnpp-by-tags.debian.net'       : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
121   # dc
122   ssl::service { 'debconf.org'                   : ensure => 'present', notify  => Exec['service apache2 reload'], key => true, }
123   ssl::service { '10years.debconf.org'           : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
124   ssl::service { 'debconf0.debconf.org'          : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
125   ssl::service { 'debconf1.debconf.org'          : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
126   ssl::service { 'debconf16.debconf.org'         : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
127   ssl::service { 'debconf17.debconf.org'         : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
128   ssl::service { 'debconf18.debconf.org'         : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
129   ssl::service { 'debconf2.debconf.org'          : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
130   ssl::service { 'debconf3.debconf.org'          : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
131   ssl::service { 'debconf4.debconf.org'          : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
132   ssl::service { 'debconf5.debconf.org'          : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
133   ssl::service { 'debconf6.debconf.org'          : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
134   ssl::service { 'debconf7.debconf.org'          : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
135   ssl::service { 'es.debconf.org'                : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
136   ssl::service { 'fr.debconf.org'                : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
137   ssl::service { 'miniconf10.debconf.org'        : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
138   ssl::service { 'video.debconf.org'             : ensure => 'present',  notify  => Exec['service apache2 reload'], key => true, }
139   ssl::service { 'wiki.debconf.org'              : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
140   include apache2::proxy_http
141   ssl::service { 'www.debconf.org'               : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
142
143
144   if $onion_service {
145     $onion_addr = empty($listen_addr) ? {
146       true    => $base::public_address,
147       default => filter_ipv4($listen_addr)[0]
148     }
149     if ! $onion_addr {
150       fail("Do not have a useable address for the onionservice on ${::hostname}.  Is \$listen_addr empty or does it not have an IPv4 address?.")
151     }
152
153     onion::service { 'd-i.debian.org'      : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_addr }
154     onion::service { 'dpl.debian.org'      : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_addr }
155     onion::service { 'dsa.debian.org'      : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_addr }
156     onion::service { 'rtc.debian.org'      : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_addr }
157     onion::service { 'www.debian.org'      : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_addr }
158
159     # do
160     onion::service { 'appstream.debian.org'          : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_addr }
161     onion::service { 'backports.debian.org'          : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_addr }
162     onion::service { 'bits.debian.org'               : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_addr }
163     onion::service { 'blends.debian.org'             : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_addr }
164     onion::service { 'cdbuilder-logs.debian.org'     : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_addr }
165     onion::service { 'incoming.debian.org'           : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_addr }
166     onion::service { 'incoming.ports.debian.org'     : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_addr }
167     onion::service { 'lintian.debian.org'            : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_addr }
168     onion::service { 'manpages.debian.org'           : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_addr }
169     onion::service { 'mirror-master.debian.org'      : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_addr }
170     onion::service { 'onion.debian.org'              : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_addr }
171     onion::service { 'openpgpkey.debian.org'         : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_addr }
172     onion::service { 'release.debian.org'            : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_addr }
173     onion::service { 'security-team.debian.org'      : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_addr }
174     onion::service { 'www.ports.debian.org'          : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_addr }
175     # dn
176     onion::service { 'bootstrap.debian.net'          : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_addr }
177     onion::service { 'debaday.debian.net'            : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_addr }
178     onion::service { 'debdeltas.debian.net'          : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_addr }
179     onion::service { 'micronews.debian.org'          : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_addr }
180     onion::service { 'mozilla.debian.net'            : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_addr }
181     onion::service { 'news.debian.net'               : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_addr }
182     onion::service { 'timeline.debian.net'           : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_addr }
183     onion::service { 'wnpp-by-tags.debian.net'       : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_addr }
184     # dc
185     onion::service { '10years.debconf.org'           : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_addr }
186     onion::service { 'debconf0.debconf.org'          : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_addr }
187     onion::service { 'debconf1.debconf.org'          : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_addr }
188     onion::service { 'debconf16.debconf.org'         : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_addr }
189     onion::service { 'debconf17.debconf.org'         : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_addr }
190     onion::service { 'debconf18.debconf.org'         : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_addr }
191     onion::service { 'debconf2.debconf.org'          : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_addr }
192     onion::service { 'debconf3.debconf.org'          : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_addr }
193     onion::service { 'debconf4.debconf.org'          : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_addr }
194     onion::service { 'debconf5.debconf.org'          : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_addr }
195     onion::service { 'debconf6.debconf.org'          : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_addr }
196     onion::service { 'debconf7.debconf.org'          : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_addr }
197     onion::service { 'es.debconf.org'                : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_addr }
198     onion::service { 'fr.debconf.org'                : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_addr }
199     onion::service { 'miniconf10.debconf.org'        : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_addr }
200
201     # non-SSL
202     onion::service { 'metadata.ftp-master.debian.org': ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_addr }
203     onion::service { 'planet.debian.org'             : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_addr }
204   }
205
206   file { '/srv/static.debian.org/puppet':
207     ensure => directory,
208     mode   => '2755'
209   }
210   file { '/srv/static.debian.org/puppet/disabled-service':
211     ensure => directory,
212     mode   => '2755'
213   }
214   file { '/srv/static.debian.org/puppet/disabled-service/503.html':
215     source => 'puppet:///modules/roles/static-htdocs/disabled-service/503.html',
216   }
217
218   ssl::service { 'archive.debian.net': ensure => present, notify  => Exec['service apache2 reload'], key => true, }
219   file { '/srv/static.debian.org/puppet/archive.debian.net':
220     ensure => absent,
221   }
222   file { '/srv/static.debian.org/puppet/archive.debian.net/503.html':
223     ensure => absent,
224   }
225
226   ssl::service { 'cdimage.debian.org': ensure => present, notify => Exec['service apache2 reload'], key => true, }
227   file { '/srv/static.debian.org/puppet/cdimage.debian.org':
228     ensure => directory,
229   }
230   file { '/srv/static.debian.org/puppet/cdimage.debian.org/503.html':
231     source => 'puppet:///modules/roles/static-htdocs/cdimage-maintenance.html',
232   }
233 }