Enable HTTP PKP for syncproxy vhosts
[mirror/dsa-puppet.git] / modules / roles / templates / syncproxy / syncproxy.debian.org-apache.erb
1 ##
2 ## THIS FILE IS UNDER PUPPET CONTROL. DON'T EDIT IT HERE.
3 ## USE: git clone git+ssh://$USER@puppet.debian.org/srv/puppet.debian.org/git/dsa-puppet.git
4 ##
5
6 <%
7   vhost_listen = [ (bind != '') ? "#{bind}:80" : "*:80",  (bind6 != '') ? "#{bind6}:80" : "*:80"].uniq.join(' ')
8   vhost_listen_443 = [ (bind != '') ? "#{bind}:443" : "*:443",  (bind6 != '') ? "#{bind6}:443" : "*:443"].uniq.join(' ')
9 %>
10
11 Use common-debian-service-https-redirect "<%= vhost_listen %>" <%= syncproxy_name %>
12 <Virtualhost <%= vhost_listen_443 %> >
13    ServerName <%= syncproxy_name %>
14    DocumentRoot /srv/www/syncproxy.debian.org/htdocs
15
16    Use common-debian-service-ssl <%= syncproxy_name %>
17    Use common-ssl-HSTS
18    Use http-pkp-<%= syncproxy_name %>
19
20    <Directory /srv/www/syncproxy.debian.org/htdocs>
21       Require all granted
22    </Directory>
23
24    CustomLog /var/log/apache2/syncproxy.debian.org-access.log privacy
25    ErrorLog /var/log/apache2/syncproxy.debian.org-error.log
26
27 <%=
28 lines = []
29 %w{debian debian-debug debian-ports debian-security}.each do |archive|
30   varname = 'has_srv_mirrors_' + archive.gsub(/[\/-]/,'_')
31   if has_variable?(varname) and (eval(varname)) == 'true'
32     lines << "  Alias /#{archive}/project/trace/ /srv/mirrors/#{archive}/project/trace/"
33     lines << "  <Directory /srv/mirrors/#{archive}/project/trace/>"
34     lines << "    Require all granted"
35     lines << "    IndexOptions NameWidth=* +SuppressDescription"
36     lines << "    Options +Indexes"
37     lines << "  </Directory>"
38   end
39 end
40
41 lines.join("\n")
42 %>
43
44 </VirtualHost>
45
46 # vim: set ts=3 sw=3 et: