Make metadata-backend.ftp-master hopefully work
[mirror/dsa-puppet.git] / modules / roles / templates / static-mirroring / vhost / static-vhosts-simple.erb
1 # puppet maintained
2
3 ######################
4 # deb.debian.org
5 <% if scope.function_has_static_component(['deb.debian.org']) -%>
6 <Macro vstatic-vhost-extra-deb.debian.org>
7         ServerAlias httpredir.debian.org
8         ServerAlias cdn.debian.net
9         ServerAlias http.debian.net
10
11         Redirect /debian            http://cdn-fastly.deb.debian.org/debian
12         Redirect /debian-debug      http://cdn-fastly.deb.debian.org/debian-debug
13         Redirect /debian-ports      http://cdn-fastly.deb.debian.org/debian-ports
14         Redirect /debian-security   http://cdn-fastly.deb.debian.org/debian-security
15 </Macro>
16
17 <VirtualHost <%= @vhost_listen_443 %> >
18         ServerName deb.debian.org
19
20         ErrorLog /var/log/apache2/deb.debian.org-error.log
21         CustomLog /var/log/apache2/deb.debian.org-access.log privacyssl
22
23         Use common-debian-service-ssl deb.debian.org
24         Use common-ssl-HSTS
25
26         ServerAdmin debian-admin@lists.debian.org
27         <IfModule mod_userdir.c>
28                 UserDir disabled
29         </IfModule>
30         ServerSignature On
31
32         DocumentRoot /srv/static.debian.org/mirrors/deb.debian.org/cur
33         <Directory /srv/static.debian.org/mirrors/deb.debian.org/cur>
34                 AllowOverride FileInfo Indexes Options=Multiviews
35                 Options Indexes SymLinksIfOwnerMatch
36                 Require all granted
37         </Directory>
38
39         Header set Surrogate-Key <%= @hostname %>
40
41         AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css
42
43         Redirect /debian            https://cdn-aws.deb.debian.org/debian
44         Redirect /debian-debug      https://cdn-aws.deb.debian.org/debian-debug
45         Redirect /debian-ports      https://cdn-aws.deb.debian.org/debian-ports
46         Redirect /debian-security   https://cdn-aws.deb.debian.org/debian-security
47 </VirtualHost>
48 <% end -%>
49
50 <Macro vstatic-vhost-extra-network-test.debian.org>
51         ServerAlias network-test-backend.debian.org
52         <Location /nm>
53                 Header set Cache-Control "must-revalidate, max-age=0"
54         </Location>
55 </Macro>
56
57 <Macro vstatic-vhost-extra-bits.debian.org>
58         <IfModule mod_geoip.c>
59                 CustomLog /var/log/apache2/bits.debian.org-public-access.log privacy+geo
60         </IfModule>
61 </Macro>
62
63 <Macro vstatic-vhost-extra-metadata.ftp-master.debian.org>
64         AddDefaultCharset utf-8
65
66         # Rewrite away double slashes
67         RewriteEngine on
68         RewriteCond %{REQUEST_URI} ^(.*)//(.*)$ [NC]
69         RewriteRule . %1/%2 [R=301,L,NE]
70
71         <LocationMatch "/changelogs/(main|contrib|non-free)">
72                 ForceType text/plain
73         </LocationMatch>
74 </Macro>
75
76 <Macro vstatic-vhost-extra-release.debian.org>
77         RewriteEngine   on
78         RewriteRule             ^/migration/$                   /migration/testing.pl
79         RewriteRule             ^/migration/search/(.+)/$       /migration/testing.pl?package=$1
80         RewriteCond             %{QUERY_STRING} package=((.)(.*))
81         RewriteRule             ^/migration/testing.pl          /migration/cache/%2/%1.html [PT,L]
82         RewriteRule             ^/migration/testing.pl          /migration/cache/_index.html
83
84         Alias /oldstable-proposed-updates/ /srv/static.debian.org/mirrors/release.debian.org-pu/cur/
85         Alias /proposed-updates/ /srv/static.debian.org/mirrors/release.debian.org-pu/cur/
86         <Directory /srv/static.debian.org/mirrors/release.debian.org-pu/cur>
87                 Require all granted
88                 Options Indexes SymLinksIfOwnerMatch MultiViews
89
90                 AddEncoding gzip .gz
91                 FilterDeclare gzip CONTENT_SET
92                 FilterProvider gzip inflate "%{req:Accept-Encoding} !~ /gzip/"
93                 FilterChain gzip
94                 <Files *.debdiff.gz>
95                         ForceType text/plain
96                         AddDefaultCharset utf-8
97                 </Files>
98                 <Files *.debdiff.html.gz>
99                         ForceType text/html
100                         AddDefaultCharset utf-8
101                 </Files>
102         </Directory>
103 </Macro>
104
105 <Macro vstatic-vhost-extra-www.ports.debian.org>
106         <Directory /srv/static.debian.org/mirrors/www.ports.debian.org/cur>
107                 AllowOverride FileInfo Indexes Options=Multiviews
108                 Options Multiviews Indexes FollowSymLinks Includes
109                 Require all granted
110         </Directory>
111
112         AddOutputFilter INCLUDES .xhtml
113 </Macro>
114
115
116 <Macro vstatic-vhost-extra-lintian.debian.org>
117         AddDefaultCharset utf-8
118
119         <Directory /srv/static.debian.org/mirrors/lintian.debian.org/cur>
120                 Require all granted
121
122                 # These three lines makes apache serve
123                 # "lintian.log.gz" as a text/plain with encoding gzip
124                 # making it easier to view the log in the browser.
125                 RemoveType .gz
126                 AddEncoding x-gzip .gz
127                 AddType text/plain .log
128
129                 AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css image/svg+xml
130         </Directory>
131
132         <Directory /srv/static.debian.org/mirrors/lintian.debian.org/cur/resources>
133                 # Cache these for a year (3600 * 24 * 365.25)
134                 # Files in here will change name if their content change
135                 Header set Cache-Control "max-age=31557600, public"
136         </Directory>
137
138         RewriteEngine on
139         RewriteMap source-map txt:/srv/static.debian.org/mirrors/lintian.debian.org/cur/lookup-tables/source-packages
140
141         # Re-direct from the "old" locations to the new ones
142         RewriteRule ^/reports/T(.*)\.html$ /tags/$1.html [L,R=permanent]
143         RewriteRule ^/reports/(.*)$ /$1 [L,R=permanent]
144
145         # Map source packages to reports (this mapping is re-written once per lintian run,
146         # serve it as a 302 rather than a permanent redirect)
147         # Version-less request
148         RewriteRule ^/source/([a-z0-9-]+)/?$ /${source-map:$1} [L,R,NE]
149         # Versioned request
150         RewriteRule ^/source/([a-z0-9-]+)/([a-zA-Z0-9.+:~-]+)$ /${source-map:$1/$2} [L,R,NE]
151
152         Header always set Content-Security-Policy "default-src 'self'; media-src 'none'; object-src 'none';"
153         <FilesMatch "\.(svg)$">
154                 Header always set Content-Security-Policy "default-src 'none'; frame-ancestors 'none'; style-src 'self' 'unsafe-inline';"
155         </FilesMatch>
156 </Macro>
157
158 <%=
159
160 def vhost(lines, sn, kwargs={})
161         if scope.function_has_static_component([sn])
162                 if not kwargs[:extra]
163                                 lines << "<Macro vstatic-vhost-extra-#{sn}>"
164                                 lines << "  # mod macro does not like empty macros, so here's some content:"
165                                 lines << "  <Directory /non-existant>"
166                                 lines << "  </Directory>"
167                                 lines << "</Macro>"
168                 end
169
170                 lines << "Use prepare-static-vhost #{sn}"
171
172                 if kwargs[:ssl] and kwargs[:ssl_optional]
173                         lines << "Use static-vhost-plain-#{sn}"
174                         lines << "Use static-vhost-ssl-#{sn}"
175                 elsif kwargs[:ssl]
176                         lines << "Use common-dsa-vhost-https-redirect #{sn}"
177                         lines << "Use static-vhost-ssl-#{sn}"
178                 else
179                         lines << "Use static-vhost-plain-#{sn}"
180                 end
181
182                 onion = scope.function_onion_global_service_hostname([sn])
183                 lines << "Use static-vhost-onion-#{sn} #{onion}" if onion
184
185                 lines << ""
186         end
187 end
188
189 lines = []
190 vhost(lines, "mozilla.debian.net"            , :ssl => true, :ssl_optional => true)
191 vhost(lines, "backports.debian.org"          , :ssl => true)
192 vhost(lines, "incoming.debian.org"           , :ssl => true, :ssl_optional => true)
193 vhost(lines, "incoming.ports.debian.org"     , :ssl => true, :ssl_optional => true)
194 vhost(lines, "debdeltas.debian.net"          , :ssl => true, :ssl_optional => true)
195 vhost(lines, "news.debian.net"               , :ssl => true)
196 vhost(lines, "bootstrap.debian.net"          , :ssl => true)
197 vhost(lines, "debaday.debian.net"            , :ssl => true)
198 vhost(lines, "timeline.debian.net"           , :ssl => true)
199 vhost(lines, "network-test.debian.org"       , :extra => true)
200 vhost(lines, "blends.debian.org"             , :ssl => true)
201 vhost(lines, "wnpp-by-tags.debian.net"       , :ssl => true)
202 vhost(lines, "security-team.debian.org"      , :ssl => true)
203 vhost(lines, "d-i.debian.org"                , :ssl => true)
204 vhost(lines, "appstream.debian.org"          , :ssl => true)
205 vhost(lines, "apt.buildd.debian.org"         , :ssl => true)
206 vhost(lines, "dpl.debian.org"                , :ssl => true)
207 vhost(lines, "dsa.debian.org"                , :ssl => true)
208 vhost(lines, "rtc.debian.org"                , :ssl => true)
209 vhost(lines, "mirror-master.debian.org"      , :ssl => true)
210 vhost(lines, "onion.debian.org"              , :ssl => true)
211 vhost(lines, "manpages.debian.org"           , :ssl => true, :extra => true)
212 vhost(lines, "cdbuilder-logs.debian.org"     , :ssl => true)
213
214 vhost(lines, "bits.debian.org"               , :ssl => true, :extra => true)
215 vhost(lines, "micronews.debian.org"          , :ssl => true)
216 vhost(lines, "metadata.ftp-master.debian.org", :extra => true)
217
218 vhost(lines, "10years.debconf.org"           , :ssl => true)
219 vhost(lines, "debconf0.debconf.org"          , :ssl => true)
220 vhost(lines, "debconf1.debconf.org"          , :ssl => true)
221 vhost(lines, "debconf2.debconf.org"          , :ssl => true)
222 vhost(lines, "debconf3.debconf.org"          , :ssl => true)
223 vhost(lines, "debconf4.debconf.org"          , :ssl => true)
224 vhost(lines, "debconf5.debconf.org"          , :ssl => true)
225 vhost(lines, "debconf6.debconf.org"          , :ssl => true)
226 vhost(lines, "debconf7.debconf.org"          , :ssl => true)
227 vhost(lines, "debconf16.debconf.org"         , :ssl => true)
228 vhost(lines, "debconf17.debconf.org"         , :ssl => true)
229 vhost(lines, "debconf18.debconf.org"         , :ssl => true)
230 vhost(lines, "es.debconf.org"                , :ssl => true)
231 vhost(lines, "fr.debconf.org"                , :ssl => true)
232 vhost(lines, "miniconf10.debconf.org"        , :ssl => true)
233
234 vhost(lines, "deb.debian.org"                , :extra => true)
235 vhost(lines, "release.debian.org"            , :ssl => true, :extra => true)
236 vhost(lines, "www.ports.debian.org"          , :ssl => true, :extra => true)
237 vhost(lines, "lintian.debian.org"            , :ssl => true, :extra => true)
238
239 lines.join("\n")
240 -%>
241
242 # www.backports.org
243 ###################
244 # www.backports.org is the historical place for the backports
245 # website and archive.  It is now a CNAME to backports.debian.org:
246 # redirect http requests.
247 <VirtualHost <%= @vhost_listen %> >
248         ServerName www.backports.org
249         ServerAlias lists.backports.org
250         ServerAdmin debian-admin@debian.org
251         RedirectPermanent / https://backports.debian.org/
252 </VirtualHost>
253
254 ######################
255 <VirtualHost <%= @vhost_listen %> >
256         ServerName www.debian-ports.org
257         ServerAlias debian-ports.org
258         ServerAdmin debian-admin@debian.org
259         RedirectPermanent / https://www.ports.debian.org/
260 </VirtualHost>
261
262 <VirtualHost <%= @vhost_listen %> >
263         ServerName ports.debian.org
264         ServerAlias ports.debian.net
265         ServerAdmin debian-admin@debian.org
266         RedirectPermanent / https://www.ports.debian.org/
267 </VirtualHost>
268
269 <VirtualHost <%= @vhost_listen %> >
270         ServerName incoming.debian-ports.org
271         ServerAdmin debian-admin@debian.org
272         RedirectPermanent / http://incoming.ports.debian.org/
273 </VirtualHost>
274
275 <VirtualHost <%= @vhost_listen %> >
276         ServerName ftp.debian-ports.org
277         ServerAdmin debian-admin@debian.org
278         RedirectPermanent /archive https://www.ports.debian.org
279         RedirectPermanent /debian http://ftp.ports.debian.org/debian-ports
280         RedirectPermanent /debian-cd https://cdimage.debian.org/cdimage/ports/
281         RedirectPermanent / http://ftp.ports.debian.org/
282 </VirtualHost>
283
284 <Macro vstatic-vhost-video.debian.net>
285         ServerName video.debian.net
286         ServerAdmin debian-admin@debian.org
287         Redirect / https://meetings-archive.debian.net/pub/debian-meetings/
288 </Macro>
289
290 <VirtualHost <%= @vhost_listen %> >
291         Use vstatic-vhost-video.debian.net
292 </VirtualHost>
293
294 <VirtualHost <%= @vhost_listen_443 %> >
295         Use vstatic-vhost-video.debian.net
296         Use common-debian-service-ssl video.debian.net
297         Use common-ssl-HSTS
298 </VirtualHost>
299
300 Use common-dsa-vhost-https-redirect lists.alioth.debian.org
301 <VirtualHost <%= @vhost_listen_443 %> >
302         ServerName lists.alioth.debian.org
303         ServerAdmin debian-admin@debian.org
304         Use common-debian-service-ssl lists.alioth.debian.org
305         Use common-ssl-HSTS
306         Redirect / https://alioth-lists.debian.net/
307 </VirtualHost>
308
309 Use common-dsa-vhost-https-redirect pkg-ruby-extras.alioth.debian.org
310 <VirtualHost <%= @vhost_listen_443 %> >
311         ServerName pkg-ruby-extras.alioth.debian.org
312         ServerAdmin debian-admin@debian.org
313         Use common-debian-service-ssl pkg-ruby-extras.alioth.debian.org
314         Use common-ssl-HSTS
315         Redirect / https://gemwatch.debian.net/
316 </VirtualHost>
317
318 Use common-dsa-vhost-https-redirect video.debconf.org
319 <VirtualHost <%= @vhost_listen_443 %> >
320         ServerName video.debconf.org
321         ServerAdmin debian-admin@debian.org
322         Use common-debian-service-ssl video.debconf.org
323         Use common-ssl-HSTS
324         Redirect / https://debconf-video-team.pages.debian.net/docs/
325 </VirtualHost>
326
327 <% if scope.function_has_static_component(['metadata.ftp-master.debian.org']) -%>
328 <VirtualHost <%= @vhost_listen_443 %> >
329         ServerName metadata-backend.ftp-master.debian.org
330         Use common-debian-service-ssl metadata-backend.ftp-master.debian.org
331         ErrorLog /var/log/apache2/metadata-backend.ftp-master.debian.org-error.log
332         CustomLog /var/log/apache2/metadata-backend.ftp-master.debian.org-access.log privacy
333
334         Use static-vhost-base-metadata.ftp-master.debian.org
335 </VirtualHost>
336 <% end -%>
337
338 # historical sites
339 ##################
340 # now only redirects remain
341 <VirtualHost <%= @vhost_listen %> >
342         ServerName women.debian.org
343         ServerAdmin debian-admin@debian.org
344
345         RedirectPermanent / https://www.debian.org/women/
346
347         RedirectPermanent /about/ https://www.debian.org/women/about
348         RedirectPermanent /contact/ https://www.debian.org/women/contact
349         RedirectPermanent /faqs/ https://www.debian.org/women/faq
350         RedirectPermanent /home/ https://www.debian.org/women/
351         RedirectPermanent /images/dw.png https://www.debian.org/women/dw.png
352         RedirectPermanent /involvement/ https://www.debian.org/women/participate
353         RedirectPermanent /mentoring/ https://www.debian.org/women/mentoring
354         RedirectPermanent /press/ https://wiki.debian.org/DebianWomen/Press
355         RedirectPermanent /profiles/ https://www.debian.org/women/profiles/
356 </VirtualHost>
357
358 <VirtualHost <%= @vhost_listen %> >
359         ServerName volatile.debian.org
360         ServerAlias volatile-master.debian.org
361         ServerAdmin debian-admin@debian.org
362         RedirectPermanent / https://www.debian.org/volatile/
363 </VirtualHost>
364
365 <VirtualHost <%= @vhost_listen %> >
366         ServerName ftp-master.metadata.debian.org
367         ServerAdmin debian-admin@debian.org
368         RedirectPermanent / http://metadata.ftp-master.debian.org/
369 </VirtualHost>
370
371 <VirtualHost <%= @vhost_listen %> >
372         ServerName backports-master.debian.org
373         ServerAdmin debian-admin@debian.org
374         RedirectPermanent / https://backports.debian.org/
375 </VirtualHost>
376
377 <VirtualHost <%= @vhost_listen %> >
378         ServerName manpages.debian.net
379         ServerAdmin debian-admin@debian.org
380         Redirect / https://manpages.debian.org/
381 </VirtualHost>
382
383 Use common-dsa-vhost-https-redirect sources.debian.net
384 <VirtualHost <%= @vhost_listen_443 %> >
385         ServerName sources.debian.net
386         ServerAdmin debian-admin@debian.org
387         Use common-debian-service-ssl sources.debian.net
388         Use common-ssl-HSTS
389         Redirect permanent / https://sources.debian.org/
390 </VirtualHost>
391
392 # error pages
393 #############
394
395 Use common-dsa-vhost-https-redirect archive.debian.net
396 <VirtualHost <%= @vhost_listen_443 %> >
397         ServerName archive.debian.net
398         ServerAdmin debian-admin@debian.org
399         ErrorLog /var/log/apache2/archive.debian.net-error.log
400         CustomLog /var/log/apache2/archive.debian.net-access.log privacyssl
401         Use common-debian-service-ssl archive.debian.net
402         Use common-ssl-HSTS
403         Use common-disabled-service
404 </VirtualHost>
405
406
407 # vim:ft=apache: