and onions for ftp.ports.d.o and debug.mirrors.d.o
authorPeter Palfrader <peter@palfrader.org>
Fri, 29 Jul 2016 23:22:54 +0000 (23:22 +0000)
committerPeter Palfrader <peter@palfrader.org>
Fri, 29 Jul 2016 23:22:54 +0000 (23:22 +0000)
hieradata/common.yaml
modules/roles/manifests/debug_mirror.pp
modules/roles/manifests/onionbalance.pp
modules/roles/manifests/ports_mirror.pp
modules/roles/templates/apache-debug.mirrors.debian.org.erb
modules/roles/templates/apache-ftp.ports.debian.org.erb

index 6c154c9..a1dc93d 100644 (file)
@@ -213,9 +213,15 @@ roles:
   debug_mirror:
     - klecker.debian.org
     - mirror-isc.debian.org
+  debug_mirror_onion:
+    - klecker.debian.org
+    - mirror-isc.debian.org
   ports_mirror:
     - klecker.debian.org
     - mirror-isc.debian.org
+  ports_mirror_onion:
+    - klecker.debian.org
+    - mirror-isc.debian.org
   planet_search:
     - philp.debian.org
   i18n.d.o:
index da70581..94c73a5 100644 (file)
@@ -4,9 +4,26 @@ class roles::debug_mirror {
                mirror-isc => '149.20.20.22:80 [2001:4f8:8:36::1deb:22]:80',
                default => '*:80',
        }
+       $onion_v4_addr = $::hostname ? {
+               klecker    => '130.89.148.14',
+               mirror-isc => '149.20.20.22',
+               default    => undef,
+       }
 
        apache2::site { '010-debug.mirrors.debian.org':
                site   => 'debug.mirrors.debian.org',
                content => template('roles/apache-debug.mirrors.debian.org.erb'),
        }
+
+       if has_role('static_mirror_onion') {
+               if ! $onion_v4_addr {
+                       fail("Do not have an onion_v4_addr set for $::hostname.")
+               }
+
+               onion::service { 'debug.mirrors.debian.org':
+                       port => 80,
+                       target_port => 80,
+                       target_address => $onion_v4_addr,
+               }
+       }
 }
index 8935211..ec870b4 100644 (file)
@@ -45,4 +45,6 @@ class roles::onionbalance {
 
        # non-static.d.o
        onion::balance_service { 'security.debian.org': }
+       onion::balance_service { 'debug.mirrors.debian.org': }
+       onion::balance_service { 'ftp.ports.debian.org': }
 }
index ff0d601..31cf1b5 100644 (file)
@@ -4,9 +4,26 @@ class roles::ports_mirror {
                mirror-isc => '149.20.20.22:80 [2001:4f8:8:36::1deb:22]:80',
                default => '*:80',
        }
+       $onion_v4_addr = $::hostname ? {
+               klecker    => '130.89.148.14',
+               mirror-isc => '149.20.20.22',
+               default    => undef,
+       }
 
        apache2::site { '010-ftp.ports.debian.org':
                site   => 'ftp.ports.debian.org',
                content => template('roles/apache-ftp.ports.debian.org.erb'),
        }
+
+       if has_role('static_mirror_onion') {
+               if ! $onion_v4_addr {
+                       fail("Do not have an onion_v4_addr set for $::hostname.")
+               }
+
+               onion::service { 'ftp.ports.debian.org':
+                       port => 80,
+                       target_port => 80,
+                       target_address => $onion_v4_addr,
+               }
+       }
 }
index 51c4545..5d2ac23 100644 (file)
@@ -6,6 +6,9 @@
 <VirtualHost <%= vhost_listen %> >
         ServerAdmin debian-admin@debian.org
         ServerName debug.mirrors.debian.org
+        <% if scope.function_onion_global_service_hostname(['debug.mirrors.debian.org']) -%>
+        ServerAlias <%= scope.function_onion_global_service_hostname(['debug.mirrors.debian.org']) %>
+        <% end %>
 
         RedirectMatch "^/$" /debian-debug/
         Alias /debian-debug /srv/mirrors/debian-debug
index 42c3fb2..5a060ce 100644 (file)
@@ -6,7 +6,9 @@
 <VirtualHost <%= vhost_listen %> >
         ServerAdmin debian-admin@debian.org
         ServerName ftp.ports.debian.org
-
+        <% if scope.function_onion_global_service_hostname(['ftp.ports.debian.org']) -%>
+        ServerAlias <%= scope.function_onion_global_service_hostname(['ftp.ports.debian.org']) %>
+        <% end %>
 
         ErrorLog /var/log/apache2/ftp.ports.debian.org-error.log
         LogLevel warn