patch-acng-ssl-support
authormdklapwijk <m.d.klapwijk@linuxvoid.org>
Wed, 27 May 2020 17:25:03 +0000 (19:25 +0200)
committermdklapwijk <m.d.klapwijk@linuxvoid.org>
Wed, 27 May 2020 18:48:09 +0000 (20:48 +0200)
Support for https repositories via caching proxy apt-cacher-ng using the "tell-me-what-you-need" method as described in the documentation:
- https://www.unix-ag.uni-kl.de/~bloch/acng/html/howtos.html#ssluse

manifests/params.pp
manifests/source.pp
types/proxy.pp

index b0c367ca109cb4858df14ee0fbcdc56263d19332..149e4c96d86ca65ae6820639d6dc193a4909093f 100644 (file)
@@ -54,11 +54,12 @@ class apt::params {
   }
 
   $proxy_defaults = {
-    'ensure' => undef,
-    'host'   => undef,
-    'port'   => 8080,
-    'https'  => false,
-    'direct' => false,
+    'ensure'     => undef,
+    'host'       => undef,
+    'port'       => 8080,
+    'https'      => false,
+    'https_acng' => false,
+    'direct'     => false,
   }
 
   $purge_defaults = {
index cb75635797ca882832467d64be7d8228b86765aa..365ba13dedc69382dc317772285638f075a6f745 100644 (file)
@@ -86,11 +86,19 @@ define apt::source(
     if ! $location {
       fail(translate('cannot create a source entry without specifying a location'))
     }
+    elsif ($::apt::proxy['https_acng']) and ($location =~ /(?i:^https:\/\/)/) {
+      $_location = regsubst($location, 'https://','http://HTTPS///')
+    }
+    else {
+      $_location = $location
+    }
     # Newer oses, do not need the package for HTTPS transport.
     $_transport_https_releases = [ 'wheezy', 'jessie', 'stretch', 'trusty', 'xenial' ]
-    if ($facts['lsbdistcodename'] in $_transport_https_releases) and $location =~ /(?i:^https:\/\/)/ {
+    if ($facts['lsbdistcodename'] in $_transport_https_releases) and $_location =~ /(?i:^https:\/\/)/ {
       ensure_packages('apt-transport-https')
     }
+  } else {
+    $_location = undef
   }
 
   $includes = merge($::apt::include_defaults, $include)
@@ -113,7 +121,7 @@ define apt::source(
     'includes'         => $includes,
     'opt_architecture' => $architecture,
     'allow_unsigned'   => $allow_unsigned,
-    'location'         => $location,
+    'location'         => $_location,
     'release'          => $_release,
     'repos'            => $repos,
   })
index 0aae3954a87521555b1ff2fe189c000494fe79e8..20cbfecf9a6d1af44ff9d4cb8d81b84d991061cf 100644 (file)
 #
 type Apt::Proxy = Struct[
   {
-    ensure => Optional[Enum['file', 'present', 'absent']],
-    host   => Optional[String],
-    port   => Optional[Integer[0, 65535]],
-    https  => Optional[Boolean],
-    direct => Optional[Boolean],
+    ensure     => Optional[Enum['file', 'present', 'absent']],
+    host       => Optional[String],
+    port       => Optional[Integer[0, 65535]],
+    https      => Optional[Boolean],
+    https_acng => Optional[Boolean],
+    direct     => Optional[Boolean],
   }
 ]