Mercurial > repos > other > Puppet
diff manifests/templates.pp @ 284:9431aec4d998
Switch to using IPv6 prefix and IP per site
This is because the proxy seems to break SNI, so we need an IP
per SSL cert. We're not short of IPv6 addresses, though!
Also corrected to "4to6" naming, because we're letting IPv4 access
an IPv6 site
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sun, 16 Feb 2020 12:07:35 +0000 |
parents | af7df930a670 |
children | 61e90445c899 |
line wrap: on
line diff
--- a/manifests/templates.pp Sat Feb 15 20:11:23 2020 +0000 +++ b/manifests/templates.pp Sun Feb 16 12:07:35 2020 +0000 @@ -27,7 +27,7 @@ class basevpsnode ( $primary_ip, - $proxy_6to4_ip = undef, + $proxy_4to6_ip_prefix = undef, $proxy_upstream = undef, $mailserver, $imapserver, @@ -56,7 +56,7 @@ include vcs::client class { 'webserver': primary_ip => $primary_ip, - proxy_6to4_ip => $proxy_6to4_ip, + proxy_4to6_ip_prefix => $proxy_4to6_ip_prefix, proxy_upstream => $proxy_upstream, } include cronjobs @@ -410,14 +410,24 @@ #Our web server with our configs, not just a stock one class webserver ( $primary_ip, - $proxy_6to4_ip = undef, + $proxy_4to6_ip_prefix = undef, $proxy_upstream = undef, ) { + + if $proxy_4to6_ip_prefix == undef { + $ipv6_addresses = [] + } + else { + $ipv6_addresses = [1, 2, 3, 4, 5, 6, 7, 8, 9].map |$octet| { "$proxy_4to6_ip_prefix:$octet" } + } + #Setup base website parameters class { 'website': base_dir => '/srv/sites', primary_ip => $primary_ip, - proxy_6to4_ip => $proxy_6to4_ip, + proxy_4to6_ip_prefix => $proxy_4to6_ip_prefix, + proxy_4to6_mask => 124, + proxy_4to6_addresses => $ipv6_addresses, proxy_upstream => $proxy_upstream, default_owner => $defaultusers::default_user, default_group => $defaultusers::default_user, @@ -517,7 +527,7 @@ class ibboardvpsnode ( $primary_ip, - $proxy_6to4_ip = undef, + $proxy_4to6_ip_prefix = undef, $proxy_upstream = undef, $mailserver, $imapserver, @@ -525,7 +535,7 @@ ){ class { 'basevpsnode': primary_ip => $primary_ip, - proxy_6to4_ip => $proxy_6to4_ip, + proxy_4to6_ip_prefix => $proxy_4to6_ip_prefix, proxy_upstream => $proxy_upstream, mailserver => $mailserver, imapserver => $imapserver, @@ -555,8 +565,14 @@ } #Configure our sites, using templates for the custom fragments where the extra content is too long - include adminsite + class { "devsite": + proxy_4to6_ip => $proxy_4to6_ip_prefix != undef ? { true => "$proxy_4to6_ip_prefix:01", default => undef } + } + class { "adminsite": + proxy_4to6_ip => $proxy_4to6_ip_prefix != undef ? { true => "$proxy_4to6_ip_prefix:02", default => undef } + } website::https::multitld { 'www.ibboard': + proxy_4to6_ip => $proxy_4to6_ip_prefix != undef ? { true => "$proxy_4to6_ip_prefix:03", default => undef }, custom_fragment => template("privat/apache/ibboard.fragment"), letsencrypt_name => 'ibboard.co.uk', csp_override => { @@ -570,20 +586,33 @@ "connect-src" => "'self'", } } - include hiveworldterrasite - include bdstrikesite - include devsite + class { "hiveworldterrasite": + proxy_4to6_ip => $proxy_4to6_ip_prefix != undef ? { true => "$proxy_4to6_ip_prefix:04", default => undef } + } + class { "bdstrikesite": + proxy_4to6_ip => $proxy_4to6_ip_prefix != undef ? { true => "$proxy_4to6_ip_prefix:05", default => undef } + } website::https::multitld { 'www.abiknight': + proxy_4to6_ip => $proxy_4to6_ip_prefix != undef ? { true => "$proxy_4to6_ip_prefix:06", default => undef }, custom_fragment => "$website::htmlphpfragment ErrorDocument 404 /error.php", letsencrypt_name => 'abiknight.co.uk', } - include webmailpimsite + website::https::multitld { 'www.warfoundry': + proxy_4to6_ip => $proxy_4to6_ip_prefix != undef ? { true => "$proxy_4to6_ip_prefix:07", default => undef }, + letsencrypt_name => 'warfoundry.co.uk', + custom_fragment => template("privat/apache/warfoundry.fragment"), + } + class { "webmailpimsite": + proxy_4to6_ip_pim => $proxy_4to6_ip_prefix != undef ? { true => "$proxy_4to6_ip_prefix:08", default => undef }, + proxy_4to6_ip_webmail => $proxy_4to6_ip_prefix != undef ? { true => "$proxy_4to6_ip_prefix:09", default => undef }, + } } -class adminsite{ +class adminsite ($proxy_4to6_ip) { apache::mod { 'info':; 'status':; 'cgi':; } website::https::multitld { 'admin.ibboard': + proxy_4to6_ip => $proxy_4to6_ip, force_no_index => false, ssl_ca_chain => '', custom_fragment => template("privat/apache/admin.fragment"), @@ -601,29 +630,34 @@ } } -class hiveworldterrasite { +class hiveworldterrasite ($proxy_4to6_ip) { website::https::multitld { 'www.hiveworldterra': + proxy_4to6_ip => $proxy_4to6_ip, force_no_www => false, letsencrypt_name => 'hiveworldterra.co.uk', custom_fragment => template("privat/apache/hwt.fragment"), } website::https::multitld { 'forums.hiveworldterra': + proxy_4to6_ip => $proxy_4to6_ip, letsencrypt_name => 'hiveworldterra.co.uk', custom_fragment => template("privat/apache/forums.fragment"), } website::https::multitld { 'skins.hiveworldterra': + proxy_4to6_ip => $proxy_4to6_ip, letsencrypt_name => 'hiveworldterra.co.uk', custom_fragment => template("privat/apache/skins.fragment"), } website::https::redir { 'hiveworldterra.ibboard.co.uk': + proxy_4to6_ip => $proxy_4to6_ip, redir => 'https://www.hiveworldterra.co.uk/', docroot => "${website::basedir}/hiveworldterra", letsencrypt_name => 'hiveworldterra.co.uk', separate_log => true, } } -class bdstrikesite { +class bdstrikesite ($proxy_4to6_ip) { website::https::multitld { 'www.bdstrike': + proxy_4to6_ip => $proxy_4to6_ip, docroot_owner => $defaultusers::secondary_user, docroot_group => 'editors', letsencrypt_name => 'bdstrike.co.uk', @@ -641,6 +675,7 @@ 'www.strikecreations.com' ] website::https::redir { 'www.strikecreations.co.uk': + proxy_4to6_ip => $proxy_4to6_ip, redir => 'https://bdstrike.co.uk/', serveraliases => $aliases, docroot => "${website::basedir}/bdstrike", @@ -657,7 +692,7 @@ minute => '*/15', } } -class devsite { +class devsite ($proxy_4to6_ip) { if versioncmp($operatingsystemrelease, '8') >= 0 { # Apache::Mod doesn't map this correctly for CentOS 8 yet $mod_wsgi_lib = 'mod_wsgi_python3.so' @@ -693,11 +728,8 @@ ensure => installed, } - website::https::multitld { 'www.warfoundry': - letsencrypt_name => 'warfoundry.co.uk', - custom_fragment => template("privat/apache/warfoundry.fragment"), - } website::https::multitld { 'dev.ibboard': + proxy_4to6_ip => $proxy_4to6_ip, #Make sure we're the first one hit for the tiny fraction of "no support" cases we care about (potentially Python for Mercurial!) # http://en.wikipedia.org/wiki/Server_Name_Indication#No_support priority => 1, @@ -708,14 +740,16 @@ } } -class webmailpimsite { +class webmailpimsite ($proxy_4to6_ip_pim, $proxy_4to6_ip_webmail) { # Webmail and Personal Information Management (PIM) sites website::https { 'webmail.ibboard.co.uk': + proxy_4to6_ip => $proxy_4to6_ip_webmail, force_no_index => false, ssl_ca_chain => '', custom_fragment => template("privat/apache/webmail.fragment"), } website::https { 'pim.ibboard.co.uk': + proxy_4to6_ip => $proxy_4to6_ip_pim, docroot_owner => 'apache', docroot_group => 'editors', force_no_index => false,