onions for standard static vhosts
authorPeter Palfrader <peter@palfrader.org>
Fri, 29 Jul 2016 17:49:38 +0000 (17:49 +0000)
committerPeter Palfrader <peter@palfrader.org>
Fri, 29 Jul 2016 17:49:38 +0000 (17:49 +0000)
modules/roles/templates/static-mirroring/static-vhost.conf.erb
modules/roles/templates/static-mirroring/vhost/static-vhosts-simple.erb

index e041357..c2d2252 100644 (file)
 </Macro>
 
 
-<Macro common-static-vhost-with-extra $name>
+
+
+<Macro common-static-vhost-with-extra $name $onion>
        <Virtualhost <%= vhost_listen %> >
                ServerName $name
+               ServerAlias $onion
                ServerAdmin debian-admin@lists.debian.org
 
                ErrorLog /var/log/apache2/$name-error.log
        </VirtualHost>
 </Macro>
 
-<Macro common-static-vhost $name>
+<Macro common-static-vhost $name $onion>
        <Macro vhost-$name-extra>
                # mod macro does not like empty macros, so here's some content:
                <Directory /non-existant>
                </Directory>
        </Macro>
-       Use common-static-vhost-with-extra $name
+       Use common-static-vhost-with-extra $name $onion
 </Macro>
 
 
-<Macro common-static-vhost-ssl $name>
+<Macro common-static-vhost-ssl $name $onion>
        Use common-dsa-vhost-https-redirect $name
 
        <Virtualhost <%= vhost_listen_443 %> >
 
                Use common-static-base $name
        </VirtualHost>
+
+       <Virtualhost <%= vhost_listen %> >
+               ServerName $onion
+               ServerAdmin debian-admin@lists.debian.org
+
+               ErrorLog /var/log/apache2/$name-error.log
+               CustomLog /var/log/apache2/$name-access.log privacyssl
+
+               Use common-static-base $name
+       </VirtualHost>
 </Macro>
 
 # vim:ft=apache:
index 728c345..fe85884 100644 (file)
@@ -22,7 +22,10 @@ def vhost(lines, sn, type=nil)
     t = 'common-static-vhost'
     if type then t += "-#{type}"; end
 
-    lines << "Use #{t} #{sn}"
+    onion = scope.function_onion_global_service_hostname([sn])
+    onion = "unavailable-onion.invalid" if onion.nil?
+
+    lines << "Use #{t} #{sn} #{onion}"
   end
 end