amended policy
[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 </Macro>
53
54 <Macro vstatic-vhost-extra-bits.debian.org>
55         <IfModule mod_geoip.c>
56                 CustomLog /var/log/apache2/bits.debian.org-public-access.log privacy+geo
57         </IfModule>
58 </Macro>
59
60 <Macro vstatic-vhost-extra-metadata.ftp-master.debian.org>
61         AddDefaultCharset utf-8
62
63         # Rewrite away double slashes
64         RewriteEngine on
65         RewriteCond %{REQUEST_URI} ^(.*)//(.*)$ [NC]
66         RewriteRule . %1/%2 [R=301,L,NE]
67
68         <LocationMatch "/changelogs/(main|contrib|non-free)">
69                 ForceType text/plain
70         </LocationMatch>
71 </Macro>
72
73 <Macro vstatic-vhost-extra-release.debian.org>
74         RewriteEngine   on
75         RewriteRule             ^/migration/$                   /migration/testing.pl
76         RewriteRule             ^/migration/search/(.+)/$       /migration/testing.pl?package=$1
77         RewriteCond             %{QUERY_STRING} package=((.)(.*))
78         RewriteRule             ^/migration/testing.pl          /migration/cache/%2/%1.html [PT,L]
79         RewriteRule             ^/migration/testing.pl          /migration/cache/_index.html
80
81         Alias /proposed-updates/ /srv/static.debian.org/mirrors/release.debian.org-pu/cur/
82         <Directory /srv/static.debian.org/mirrors/release.debian.org-pu/cur>
83                 Require all granted
84                 Options Indexes SymLinksIfOwnerMatch MultiViews
85
86                 AddEncoding gzip .gz
87                 FilterDeclare gzip CONTENT_SET
88                 FilterProvider gzip inflate "%{req:Accept-Encoding} !~ /gzip/"
89                 FilterChain gzip
90                 <Files *.debdiff.gz>
91                         ForceType text/plain
92                         AddDefaultCharset utf-8
93                 </Files>
94                 <Files *.debdiff.html.gz>
95                         ForceType text/html
96                         AddDefaultCharset utf-8
97                 </Files>
98         </Directory>
99 </Macro>
100
101 <Macro vstatic-vhost-extra-www.ports.debian.org>
102         <Directory /srv/static.debian.org/mirrors/www.ports.debian.org/cur>
103                 AllowOverride FileInfo Indexes Options=Multiviews
104                 Options Multiviews Indexes FollowSymLinks Includes
105                 Require all granted
106         </Directory>
107
108         AddOutputFilter INCLUDES .xhtml
109 </Macro>
110
111
112 <Macro vstatic-vhost-extra-lintian.debian.org>
113         AddDefaultCharset utf-8
114
115         <Directory /srv/static.debian.org/mirrors/lintian.debian.org/cur>
116                 Require all granted
117
118                 # These three lines makes apache serve
119                 # "lintian.log.gz" as a text/plain with encoding gzip
120                 # making it easier to view the log in the browser.
121                 RemoveType .gz
122                 AddEncoding x-gzip .gz
123                 AddType text/plain .log
124
125                 <IfModule mod_userdir.c>
126                         AddOutputFilterByType DEFLATE image/svg+xml
127                         AddOutputFilterByType DEFLATE text/plain
128                 </IfModule>
129         </Directory>
130
131         <Directory /srv/static.debian.org/mirrors/lintian.debian.org/cur/resources>
132                 # Cache these for a year (3600 * 24 * 365.25)
133                 # Files in here will change name if their content change
134                 Header set Cache-Control "max-age=31557600, public"
135         </Directory>
136
137         RewriteEngine on
138         RewriteMap source-map txt:/srv/static.debian.org/mirrors/lintian.debian.org/cur/lookup-tables/source-packages
139
140         # Re-direct from the "old" locations to the new ones
141         RewriteRule ^/reports/T(.*)\.html$ /tags/$1.html [L,R=permanent]
142         RewriteRule ^/reports/(.*)$ /$1 [L,R=permanent]
143
144         # Map source packages to reports (this mapping is re-written once per lintian run,
145         # serve it as a 302 rather than a permanent redirect)
146         # Version-less request
147         RewriteRule ^/source/([a-z0-9-]+)/?$ /${source-map:$1} [L,R,NE]
148         # Versioned request
149         RewriteRule ^/source/([a-z0-9-]+)/([a-zA-Z0-9.+:~-]+)$ /${source-map:$1/$2} [L,R,NE]
150
151         Header always set Content-Security-Policy "default-src 'self'; media-src 'none'; object-src 'none';"
152 </Macro>
153
154 <%=
155
156 def vhost(lines, sn, kwargs={})
157         if scope.function_has_static_component([sn])
158                 if not kwargs[:extra]
159                                 lines << "<Macro vstatic-vhost-extra-#{sn}>"
160                                 lines << "  # mod macro does not like empty macros, so here's some content:"
161                                 lines << "  <Directory /non-existant>"
162                                 lines << "  </Directory>"
163                                 lines << "</Macro>"
164                 end
165
166                 lines << "Use prepare-static-vhost #{sn}"
167
168                 if kwargs[:ssl] and kwargs[:ssl_optional]
169                         lines << "Use static-vhost-plain-#{sn}"
170                         lines << "Use static-vhost-ssl-#{sn}"
171                 elsif kwargs[:ssl]
172                         lines << "Use common-dsa-vhost-https-redirect #{sn}"
173                         lines << "Use static-vhost-ssl-#{sn}"
174                 else
175                         lines << "Use static-vhost-plain-#{sn}"
176                 end
177
178                 onion = scope.function_onion_global_service_hostname([sn])
179                 lines << "Use static-vhost-onion-#{sn} #{onion}" if onion
180
181                 lines << ""
182         end
183 end
184
185 lines = []
186 vhost(lines, "mozilla.debian.net"            , :ssl => true, :ssl_optional => true)
187 vhost(lines, "backports.debian.org"          , :ssl => true)
188 vhost(lines, "incoming.debian.org"           , :ssl => true, :ssl_optional => true)
189 vhost(lines, "incoming.ports.debian.org"     , :ssl => true, :ssl_optional => true)
190 vhost(lines, "debdeltas.debian.net"          , :ssl => true, :ssl_optional => true)
191 vhost(lines, "news.debian.net"               , :ssl => true)
192 vhost(lines, "bootstrap.debian.net"          , :ssl => true)
193 vhost(lines, "debaday.debian.net"            , :ssl => true)
194 vhost(lines, "timeline.debian.net"           , :ssl => true)
195 vhost(lines, "network-test.debian.org"       , :extra => true)
196 vhost(lines, "blends.debian.org"             , :ssl => true)
197 vhost(lines, "wnpp-by-tags.debian.net"       , :ssl => true)
198 vhost(lines, "security-team.debian.org"      , :ssl => true)
199 vhost(lines, "d-i.debian.org"                , :ssl => true)
200 vhost(lines, "appstream.debian.org"          , :ssl => true)
201 vhost(lines, "apt.buildd.debian.org"         , :ssl => true)
202 vhost(lines, "dsa.debian.org"                , :ssl => true)
203 vhost(lines, "rtc.debian.org"                , :ssl => true)
204 vhost(lines, "mirror-master.debian.org"      , :ssl => true)
205 vhost(lines, "onion.debian.org"              , :ssl => true)
206 vhost(lines, "manpages.debian.org"           , :ssl => true, :extra => true)
207
208 vhost(lines, "bits.debian.org"               , :ssl => true, :extra => true)
209 vhost(lines, "micronews.debian.org"          , :ssl => true)
210 vhost(lines, "metadata.ftp-master.debian.org", :extra => true)
211
212 vhost(lines, "10years.debconf.org"           , :ssl => true)
213 vhost(lines, "debconf0.debconf.org"          , :ssl => true)
214 vhost(lines, "debconf1.debconf.org"          , :ssl => true)
215 vhost(lines, "debconf2.debconf.org"          , :ssl => true)
216 vhost(lines, "debconf3.debconf.org"          , :ssl => true)
217 vhost(lines, "debconf4.debconf.org"          , :ssl => true)
218 vhost(lines, "debconf5.debconf.org"          , :ssl => true)
219 vhost(lines, "debconf6.debconf.org"          , :ssl => true)
220 vhost(lines, "debconf7.debconf.org"          , :ssl => true)
221 vhost(lines, "debconf16.debconf.org"         , :ssl => true)
222 vhost(lines, "es.debconf.org"                , :ssl => true)
223 vhost(lines, "fr.debconf.org"                , :ssl => true)
224 vhost(lines, "miniconf10.debconf.org"        , :ssl => true)
225
226 vhost(lines, "deb.debian.org"                , :extra => true)
227 vhost(lines, "release.debian.org"            , :ssl => true, :extra => true)
228 vhost(lines, "www.ports.debian.org"          , :ssl => true, :extra => true)
229 vhost(lines, "lintian.debian.org"            , :ssl => true, :extra => true)
230
231 lines.join("\n")
232 -%>
233
234 # www.backports.org
235 ###################
236 # www.backports.org is the historical place for the backports
237 # website and archive.  It is now a CNAME to backports.debian.org:
238 # redirect http requests.
239 <VirtualHost <%= vhost_listen %> >
240         ServerName www.backports.org
241         ServerAlias lists.backports.org
242         ServerAdmin debian-admin@debian.org
243         RedirectPermanent / http://backports.debian.org/
244 </VirtualHost>
245
246 ######################
247 <VirtualHost <%= vhost_listen %> >
248         ServerName www.debian-ports.org
249         ServerAlias debian-ports.org
250         ServerAdmin debian-admin@debian.org
251         RedirectPermanent / https://www.ports.debian.org/
252 </VirtualHost>
253
254 <VirtualHost <%= vhost_listen %> >
255         ServerName ports.debian.org
256         ServerAlias ports.debian.net
257         ServerAdmin debian-admin@debian.org
258         RedirectPermanent / https://www.ports.debian.org/
259 </VirtualHost>
260
261 <VirtualHost <%= vhost_listen %> >
262         ServerName incoming.debian-ports.org
263         ServerAdmin debian-admin@debian.org
264         RedirectPermanent / http://incoming.ports.debian.org/
265 </VirtualHost>
266
267 <VirtualHost <%= vhost_listen %> >
268         ServerName ftp.debian-ports.org
269         ServerAdmin debian-admin@debian.org
270         RedirectPermanent /archive http://www.ports.debian.org
271         RedirectPermanent /debian http://ftp.ports.debian.org/debian-ports
272         RedirectPermanent /debian-cd http://ftp.ports.debian.org/debian-ports-cd
273         RedirectPermanent / http://ftp.ports.debian.org/
274 </VirtualHost>
275
276 <VirtualHost <%= vhost_listen %> >
277         ServerName video.debian.net
278         ServerAdmin debian-admin@debian.org
279         Redirect / http://meetings-archive.debian.net/pub/debian-meetings/
280 </VirtualHost>
281
282 # historical sites
283 ##################
284 # now only redirects remain
285 <VirtualHost <%= vhost_listen %> >
286         ServerName women.debian.org
287         ServerAdmin debian-admin@debian.org
288
289         RedirectPermanent / http://www.debian.org/women/
290
291         RedirectPermanent /about/ http://www.debian.org/women/about
292         RedirectPermanent /contact/ http://www.debian.org/women/contact
293         RedirectPermanent /faqs/ http://www.debian.org/women/faq
294         RedirectPermanent /home/ http://www.debian.org/women/
295         RedirectPermanent /images/dw.png http://www.debian.org/women/dw.png
296         RedirectPermanent /involvement/ http://www.debian.org/women/participate
297         RedirectPermanent /mentoring/ http://www.debian.org/women/mentoring
298         RedirectPermanent /press/ http://wiki.debian.org/DebianWomen/Press
299         RedirectPermanent /profiles/ http://www.debian.org/women/profiles/
300 </VirtualHost>
301
302 <VirtualHost <%= vhost_listen %> >
303         ServerName volatile.debian.org
304         ServerAlias volatile-master.debian.org
305         ServerAdmin debian-admin@debian.org
306         RedirectPermanent / http://www.debian.org/volatile/
307 </VirtualHost>
308
309 <VirtualHost <%= vhost_listen %> >
310         ServerName ftp-master.metadata.debian.org
311         ServerAdmin debian-admin@debian.org
312         RedirectPermanent / http://metadata.ftp-master.debian.org/
313 </VirtualHost>
314
315 <VirtualHost <%= vhost_listen %> >
316         ServerName backports-master.debian.org
317         ServerAdmin debian-admin@debian.org
318         RedirectPermanent / https://backports.debian.org/
319 </VirtualHost>
320
321 <VirtualHost <%= vhost_listen %> >
322         ServerName manpages.debian.net
323         ServerAdmin debian-admin@debian.org
324         Redirect / https://manpages.debian.org/
325 </VirtualHost>
326
327 # vim:ft=apache: