From c09e9bba2e193126b4a65771722ad99ce4a0225f Mon Sep 17 00:00:00 2001
From: Michael Hierweck <michael@hierweck.de>
Date: Wed, 06 Mar 2019 19:39:22 +0100
Subject: [PATCH] merge IPv6 changes

---
 hsarback/src/de/hsadmin/mods/dom/apache-vhost.vm          |   32 ++++++----
 hsarback/src/de/hsadmin/mods/pac/hosts.vm                 |   21 +++---
 hsarback/src/de/hsadmin/mods/pac/proftpd-pacs-conf.vm     |    9 --
 hsarback/src/de/hsadmin/mods/dom/zonefile.vm              |   34 ++++++-----
 hsarback/src/de/hsadmin/mods/pac/PacProcessorFactory.java |   24 +++++--
 hsarback/src/de/hsadmin/mods/pac/httpd-virtual.vm         |    4 
 hsarback/src/de/hsadmin/mods/pac/pac-addr-ipv6.vm         |    8 ++
 7 files changed, 75 insertions(+), 57 deletions(-)

diff --git a/hsarback/src/de/hsadmin/mods/dom/apache-vhost.vm b/hsarback/src/de/hsadmin/mods/dom/apache-vhost.vm
index e1070f4..9ace68f 100644
--- a/hsarback/src/de/hsadmin/mods/dom/apache-vhost.vm
+++ b/hsarback/src/de/hsadmin/mods/dom/apache-vhost.vm
@@ -1,9 +1,9 @@
-# 
+#
 # This file is managed by HSAdmin.
 # Do not edit manually. Changes will be overwritten.
 #
 
-<VirtualHost ${pac.curINetAddr.inetAddr}:80 ${pac.oldINetAddr.inetAddr}:80>
+<VirtualHost ${pac.curINetAddr.inetAddr}:80 ${pac.oldINetAddr.inetAddr}:80 ${pac.curINet6Addr.inetAddr}:80 ${pac.oldINet6Addr.inetAddr}:80>
     ServerName ${dom.name}
     ServerAlias ${dom.serveraliases}
     ServerAdmin webmaster@${dom.name}
@@ -59,8 +59,8 @@
 #end
     RewriteCond %{HTTP_HOST} ^(.+)\.${dom.name}\.?(:[0-9]+)?$ [novary]
     RewriteCond /home/doms/${dom.name}/subs/#[[${tolower:%1} ]]# -d
-    RewriteRule ^(.*) /home/doms/${dom.name}/subs/#[[${tolower:%1}$1 ]]# [last] 
-     
+    RewriteRule ^(.*) /home/doms/${dom.name}/subs/#[[${tolower:%1}$1 ]]# [last]
+
 #if( !${htdocsfallback} )
     RewriteCond %{REQUEST_URI} !^/cgi-bin/
     RewriteCond %{REQUEST_URI} !^/fastcgi-bin/
@@ -70,19 +70,19 @@
     RewriteCond %{HTTP_HOST} ^(.+)\.${dom.name}\.?(:80)?$ [novary]
     RewriteCond /home/doms/${dom.name}/subs/#[[${tolower:%1} ]]# !-d
     RewriteRule ^(.*) - [redirect=404,last]
-    
+
 #end
     AddType application/x-httpd-php .php .php5 .php4 .php3
     Action application/x-httpd-php /fastcgi-bin/phpstub
 </VirtualHost>
 
-<VirtualHost ${pac.curINetAddr.inetAddr}:443 ${pac.oldINetAddr.inetAddr}:443>
+<VirtualHost ${pac.curINetAddr.inetAddr}:443 ${pac.oldINetAddr.inetAddr}:443 ${pac.curINet6Addr.inetAddr}:443 ${pac.oldINet6Addr.inetAddr}:443>
     ServerName ${dom.name}
     ServerAlias ${dom.serveraliases}
     ServerAdmin webmaster@${dom.name}
 
     SuexecUserGroup ${dom.user.name} ${pac.name}
-    
+
     PassengerEnabled Off
     PassengerUser ${dom.user.name}
     PassengerGroup ${pac.name}
@@ -92,7 +92,7 @@
     SSLCertificateFile /etc/apache2/pems-enabled/${dom.name}.crt
     SSLCertificateKeyFile /etc/apache2/pems-enabled/${dom.name}.key
     SSLCertificateChainFile /etc/apache2/pems-enabled/${dom.name}.chain
-       
+
     DocumentRoot /home/doms/${dom.name}/htdocs-ssl
 
     Alias /cgi-bin/ /home/doms/${dom.name}/cgi-ssl/
@@ -123,19 +123,23 @@
         SetHandler fcgid-script
         Options +ExecCGI +IncludesNoExec -Indexes -MultiViews +SymLinksIfOwnerMatch
     </Location>
-    
+
+#if( ${phplatest} )
+    FcgidInitialEnv HTTP_PHP_BIN /usr/lib/cgi-bin/php7.3
+
+#end
     RewriteEngine On
     RewriteOptions Inherit
-    
+
     RewriteCond %{REQUEST_URI} !^/cgi-bin/
-    RewriteCond %{REQUEST_URI} !^/fastcgi-bin/    
+    RewriteCond %{REQUEST_URI} !^/fastcgi-bin/
 #if( ${letsencrypt} )
     RewriteCond %{REQUEST_URI} !^/.well-known/acme-challenge/
 #end
     RewriteCond %{HTTP_HOST} ^(.+)\.${dom.name}\.?(:[0-9]+)?$ [novary]
     RewriteCond /home/doms/${dom.name}/subs-ssl/#[[${tolower:%1} ]]# -d
-    RewriteRule ^(.*) /home/doms/${dom.name}/subs-ssl/#[[${tolower:%1}$1 ]]# [last] 
-          
+    RewriteRule ^(.*) /home/doms/${dom.name}/subs-ssl/#[[${tolower:%1}$1 ]]# [last]
+
 #if( !${htdocsfallback} )
     RewriteCond %{REQUEST_URI} !^/cgi-bin/
     RewriteCond %{REQUEST_URI} !^/fastcgi-bin/
@@ -145,7 +149,7 @@
     RewriteCond %{HTTP_HOST} ^(.+)\.${dom.name}\.?(:443)?$ [novary]
     RewriteCond /home/doms/${dom.name}/subs-ssl/#[[${tolower:%1} ]]# !-d
     RewriteRule ^(.*) - [redirect=404,last]
-    
+
 #end
     AddType application/x-httpd-php .php .php5 .php4 .php3
     Action application/x-httpd-php /fastcgi-bin/phpstub
diff --git a/hsarback/src/de/hsadmin/mods/dom/zonefile.vm b/hsarback/src/de/hsadmin/mods/dom/zonefile.vm
index 7bb5e1a..b5d7a40 100644
--- a/hsarback/src/de/hsadmin/mods/dom/zonefile.vm
+++ b/hsarback/src/de/hsadmin/mods/dom/zonefile.vm
@@ -1,24 +1,26 @@
 $TTL 6H
 ${dom.name}. IN SOA ${dom.dnsMaster}.hostsharing.net. hostmaster.hostsharing.net. (
-				${sio}	; serial secs since Jan 1 1970 
-				6H		; refresh (>=10000)
-				1H		; retry (>=1800)
-				1W		; expire
-				1H		; minimum
+        ${sio}  ; serial secs since Jan 1 1970
+        6H    ; refresh (>=10000)
+        1H    ; retry (>=1800)
+        1W    ; expire
+        1H    ; minimum
 )
 
-${dom.name}.			IN		NS	dns1.hostsharing.net.
-${dom.name}.			IN		NS	dns2.hostsharing.net.
-${dom.name}.			IN		NS	dns3.hostsharing.net.
+${dom.name}.      IN    NS  dns1.hostsharing.net.
+${dom.name}.      IN    NS  dns2.hostsharing.net.
+${dom.name}.      IN    NS  dns3.hostsharing.net.
 
-${dom.name}.			IN		MX	30 mailin1.hostsharing.net.
-${dom.name}.			IN		MX	30 mailin2.hostsharing.net.
-${dom.name}.			IN		MX	30 mailin3.hostsharing.net.
+${dom.name}.      IN    MX  30 mailin1.hostsharing.net.
+${dom.name}.      IN    MX  30 mailin2.hostsharing.net.
+${dom.name}.      IN    MX  30 mailin3.hostsharing.net.
 
-${dom.name}.			IN		A	${pac.curINetAddr.inetAddr}
+${dom.name}.      IN    A ${pac.curINetAddr.inetAddr}
+;${dom.name}.      IN    AAAA ${pac.curINet6Addr.inetAddr}
 
-*.${dom.name}.	   	    IN		MX	30 mailin1.hostsharing.net.
-*.${dom.name}.		    IN		MX	30 mailin2.hostsharing.net.
-*.${dom.name}.		    IN		MX	30 mailin3.hostsharing.net.
+*.${dom.name}.    IN    MX  30 mailin1.hostsharing.net.
+*.${dom.name}.    IN    MX  30 mailin2.hostsharing.net.
+*.${dom.name}.    IN    MX  30 mailin3.hostsharing.net.
 
-*.${dom.name}.		    IN		A   ${pac.curINetAddr.inetAddr}
+*.${dom.name}.    IN    A    ${pac.curINetAddr.inetAddr}
+;*.${dom.name}.    IN    AAAA ${pac.curINet6Addr.inetAddr}
diff --git a/hsarback/src/de/hsadmin/mods/pac/PacProcessorFactory.java b/hsarback/src/de/hsadmin/mods/pac/PacProcessorFactory.java
index 9edd6bd..aafd023 100644
--- a/hsarback/src/de/hsadmin/mods/pac/PacProcessorFactory.java
+++ b/hsarback/src/de/hsadmin/mods/pac/PacProcessorFactory.java
@@ -176,21 +176,29 @@
 	}
 
 	private Processor createIfUp(final Pac pac) {
-//		return new ShellProcessor("ifup eth0:" + pacName);
-		return new ShellProcessor("ip addr add " 
+		return new CompoundProcessor(new ShellProcessor("ip addr add "
 				+ pac.getCurINetAddr().getInetAddr()
-				+ "/32 dev eth0 label eth0:"
+				+ "/32 dev eth0"
 				+ pac.getName()
-			);
+			),
+        new ShellProcessor("ip addr add "
+        + pac.getCurINet6Addr().getInetAddr()
+        + "/128 dev eth0 noprefixroute preferred_lft 0"
+        + pac.getName()
+      ));
 	}
 
 	private Processor createIfDown(final Pac pac) {
-//		return new ShellProcessor("ifdown eth0:" + pacName);
-		return new ShellProcessor("ip addr del " 
+		return new CompoundProcessor(new ShellProcessor("ip addr del "
 				+ pac.getCurINetAddr().getInetAddr()
-				+ "/32 dev eth0 label eth0:"
+				+ "/32 dev eth0"
 				+ pac.getName()
-			);
+			),
+        new ShellProcessor("ip addr add "
+        + pac.getCurINet6Addr().getInetAddr()
+        + "/128 dev eth0 noprefixroute preferred_lft 0"
+        + pac.getName()
+      ));
 	}
 
 	private UnixUser getPacAdminUser(Pac pac) throws ProcessorException {
diff --git a/hsarback/src/de/hsadmin/mods/pac/hosts.vm b/hsarback/src/de/hsadmin/mods/pac/hosts.vm
index e4fbdb1..0a2fdb1 100644
--- a/hsarback/src/de/hsadmin/mods/pac/hosts.vm
+++ b/hsarback/src/de/hsadmin/mods/pac/hosts.vm
@@ -3,17 +3,18 @@
 # Do not edit manually. Changes will be overwritten.
 #
 
-127.0.0.1       localhost
+127.0.0.1                       localhost
+::1                             ip6-localhost ip6-loopback
+fe00::0                         ip6-localnet
+ff00::0                         ip6-mcastprefix
+ff02::1                         ip6-allnodes
+ff02::2                         ip6-allrouters
+ff02::3                         ip6-allhosts
 
-::1             ip6-localhost ip6-loopback
-fe00::0         ip6-localnet
-ff00::0         ip6-mcastprefix
-ff02::1         ip6-allnodes
-ff02::2         ip6-allrouters
-ff02::3         ip6-allhosts
-
-${hive.inetAddr.inetAddr}	${hive.name}.hostsharing.net	${hive.name}	localhive
+${hive.inetAddr.inetAddr} ${hive.name}.hostsharing.net ${hive.name} localhive
+${hive.inet6Addr.inetAddr} ${hive.name}.hostsharing.net ${hive.name} localhive
 
 #foreach( $pac in ${hive.webpacs} )
-${pac.curINetAddr.inetAddr}		${pac.name}.hostsharing.net		${pac.name}
+${pac.curINetAddr.inetAddr} ${pac.name}.hostsharing.net ${pac.name}
+${pac.curINet6Addr.inetAddr} ${pac.name}.hostsharing.net ${pac.name}
 #end
diff --git a/hsarback/src/de/hsadmin/mods/pac/httpd-virtual.vm b/hsarback/src/de/hsadmin/mods/pac/httpd-virtual.vm
index a585e13..5c5fa2b 100644
--- a/hsarback/src/de/hsadmin/mods/pac/httpd-virtual.vm
+++ b/hsarback/src/de/hsadmin/mods/pac/httpd-virtual.vm
@@ -4,7 +4,7 @@
 #
 
 #foreach( $pac in ${hive.webpacs} )
-<VirtualHost ${pac.curINetAddr.inetAddr}:80>
+<VirtualHost ${pac.curINetAddr.inetAddr}:80 ${pac.curINet6Addr.inetAddr}:80>
     ServerName _
     ServerAdmin webmaster@${pac.name}.hostsharing.net
 
@@ -15,7 +15,7 @@
 
 </VirtualHost>
 
-<VirtualHost ${pac.curINetAddr.inetAddr}:443>
+<VirtualHost ${pac.curINetAddr.inetAddr}:443 ${pac.curINet6Addr.inetAddr}:443>
     ServerName _
     ServerAdmin webmaster@${pac.name}.hostsharing.net
 
diff --git a/hsarback/src/de/hsadmin/mods/pac/pac-addr-ipv6.vm b/hsarback/src/de/hsadmin/mods/pac/pac-addr-ipv6.vm
new file mode 100644
index 0000000..577218b
--- /dev/null
+++ b/hsarback/src/de/hsadmin/mods/pac/pac-addr-ipv6.vm
@@ -0,0 +1,8 @@
+# 
+# This file is managed by HSAdmin.
+# Do not edit manually. Changes will be overwritten.
+#
+#
+#foreach( $pac in ${hive.webpacs} )
+eth0:${pac.name}:${pac.curINet6Addr.inetAddr}/128
+#end
diff --git a/hsarback/src/de/hsadmin/mods/pac/proftpd-pacs-conf.vm b/hsarback/src/de/hsadmin/mods/pac/proftpd-pacs-conf.vm
index 58250ad..e35ffb2 100644
--- a/hsarback/src/de/hsadmin/mods/pac/proftpd-pacs-conf.vm
+++ b/hsarback/src/de/hsadmin/mods/pac/proftpd-pacs-conf.vm
@@ -1,21 +1,19 @@
-# 
+#
 # This file is managed by HSAdmin.
 # Do not edit manually. Changes will be overwritten.
 #
 
 #foreach( $pac in ${hive.webpacs} )
-<VirtualHost ${pac.curINetAddr.inetAddr}>
+<VirtualHost ${pac.curINetAddr.inetAddr} ${pac.curINet6Addr.inetAddr}>
         DefaultRoot             ~ ${pac.name}
         ServerName              "${pac.name}.hostsharing.net"
         AllowOverwrite          on
         AllowForeignAddress     on
-
         <Limit LOGIN>
                 Order           allow,deny
                 AllowGroup      ${pac.name}
                 DenyAll
         </Limit>
-
         <Anonymous /home/pacs/${pac.name}/ftp>
                 User    		${pac.name}
                 Group   		${pac.name}
@@ -25,13 +23,10 @@
                 DirFakeGroup    on ftp
                 DirFakeMode     000
                 AuthAliasOnly   on
-                
                 <Limit WRITE>
                         DenyAll
                 </Limit>
-                
         </Anonymous>
 </VirtualHost>
 
 #end
-        
\ No newline at end of file

--
Gitblit v1.9.0-SNAPSHOT