From 2543cfcbcce14d157658aa23dc89eaf1b28061a2 Mon Sep 17 00:00:00 2001 From: Peter Hormanns Date: Thu, 7 Mar 2013 14:35:30 +0100 Subject: [PATCH 1/4] correct vhost template --- hsarback/src/de/hsadmin/mods/dom/httpd-vhost.vm | 12 ++++++------ hsarback/src/de/hsadmin/mods/pac/Pac.java | 3 +++ .../src/de/hsadmin/mods/pac/PacProcessorFactory.java | 3 +-- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/hsarback/src/de/hsadmin/mods/dom/httpd-vhost.vm b/hsarback/src/de/hsadmin/mods/dom/httpd-vhost.vm index 04aed0c..6474617 100644 --- a/hsarback/src/de/hsadmin/mods/dom/httpd-vhost.vm +++ b/hsarback/src/de/hsadmin/mods/dom/httpd-vhost.vm @@ -51,9 +51,9 @@ RewriteCond %{REQUEST_URI} !^/cgi-bin/ RewriteCond %{REQUEST_URI} !^/fastcgi-bin/ - 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] + 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] #if( !${htdocsfallback} ) RewriteCond %{REQUEST_URI} !^/cgi-bin/ @@ -126,14 +126,14 @@ RewriteCond %{REQUEST_URI} !^/cgi-bin/ RewriteCond %{REQUEST_URI} !^/fastcgi-bin/ 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] + RewriteCond /home/doms/${dom.name}/subs-ssl/${tolower:%1} -d + RewriteRule ^(.*) /home/doms/${dom.name}/subs-ssl/${tolower:%1}$1 [last] #if( !${htdocsfallback} ) RewriteCond %{REQUEST_URI} !^/cgi-bin/ RewriteCond %{REQUEST_URI} !^/fastcgi-bin/ RewriteCond %{HTTP_HOST} ^(.+)\.${dom.name}\.?(:443)?\$ [novary] - RewriteCond /home/doms/${dom.name}/subs-ssl/\$\{tolower:%1\} !-d + RewriteCond /home/doms/${dom.name}/subs-ssl/${tolower:%1} !-d RewriteRule ^(.*) - [redirect=404,last] #end diff --git a/hsarback/src/de/hsadmin/mods/pac/Pac.java b/hsarback/src/de/hsadmin/mods/pac/Pac.java index b1e53be..15ae41e 100644 --- a/hsarback/src/de/hsadmin/mods/pac/Pac.java +++ b/hsarback/src/de/hsadmin/mods/pac/Pac.java @@ -211,6 +211,9 @@ public class Pac extends AbstractEntity implements Serializable { } public INetAddress getOldINetAddr() { + if (oldINetAddr == null) { + return getCurINetAddr(); + } return oldINetAddr; } diff --git a/hsarback/src/de/hsadmin/mods/pac/PacProcessorFactory.java b/hsarback/src/de/hsadmin/mods/pac/PacProcessorFactory.java index c3158de..59d1654 100644 --- a/hsarback/src/de/hsadmin/mods/pac/PacProcessorFactory.java +++ b/hsarback/src/de/hsadmin/mods/pac/PacProcessorFactory.java @@ -27,7 +27,7 @@ public class PacProcessorFactory implements EntityProcessorFactory { Hive hive = pac.getHive(); UnixUser unixUser = getPacAdminUser(pac); String password = PasswordTool.generatePassword(); - Processor processor = new CompoundProcessor( + return new CompoundProcessor( createAddUserProc(pacName, unixUser, password), createSetQuotaProc(pac), createEtcHostsProc(hive), @@ -39,7 +39,6 @@ public class PacProcessorFactory implements EntityProcessorFactory { createIfUp(pacName), createHttpdVirtualProc(hive), createAccountingRulesProc()); - return processor; } private Processor createAccountingRulesProc() { From 272bacae9564fcb4ce65d70766bc4609ac69b17d Mon Sep 17 00:00:00 2001 From: Peter Hormanns Date: Thu, 7 Mar 2013 16:03:10 +0100 Subject: [PATCH 2/4] escape parts of template --- .../src/de/hsadmin/mods/dom/httpd-vhost.vm | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/hsarback/src/de/hsadmin/mods/dom/httpd-vhost.vm b/hsarback/src/de/hsadmin/mods/dom/httpd-vhost.vm index 6474617..05f88c6 100644 --- a/hsarback/src/de/hsadmin/mods/dom/httpd-vhost.vm +++ b/hsarback/src/de/hsadmin/mods/dom/httpd-vhost.vm @@ -51,15 +51,15 @@ RewriteCond %{REQUEST_URI} !^/cgi-bin/ RewriteCond %{REQUEST_URI} !^/fastcgi-bin/ - 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] + 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] #if( !${htdocsfallback} ) RewriteCond %{REQUEST_URI} !^/cgi-bin/ RewriteCond %{REQUEST_URI} !^/fastcgi-bin/ - RewriteCond %{HTTP_HOST} ^(.+)\.{DOM_HOSTNAME}\.?(:80)?\$ [novary] - RewriteCond /home/doms/${dom.name}/subs/\$\{tolower:%1\} !-d + RewriteCond %{HTTP_HOST} ^(.+)\.{DOM_HOSTNAME}\.?(:80)?$ [novary] + RewriteCond /home/doms/${dom.name}/subs/#[[ ${tolower:%1} ]]# !-d RewriteRule ^(.*) - [redirect=404,last] #end @@ -125,15 +125,15 @@ RewriteCond %{REQUEST_URI} !^/cgi-bin/ RewriteCond %{REQUEST_URI} !^/fastcgi-bin/ - 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] + 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] #if( !${htdocsfallback} ) RewriteCond %{REQUEST_URI} !^/cgi-bin/ RewriteCond %{REQUEST_URI} !^/fastcgi-bin/ - RewriteCond %{HTTP_HOST} ^(.+)\.${dom.name}\.?(:443)?\$ [novary] - RewriteCond /home/doms/${dom.name}/subs-ssl/${tolower:%1} !-d + RewriteCond %{HTTP_HOST} ^(.+)\.${dom.name}\.?(:443)?$ [novary] + RewriteCond /home/doms/${dom.name}/subs-ssl/#[[ ${tolower:%1} ]]# !-d RewriteRule ^(.*) - [redirect=404,last] #end From 747bf3ec7bd025921273c097e20b342e6b01bb47 Mon Sep 17 00:00:00 2001 From: Peter Hormanns Date: Thu, 7 Mar 2013 16:03:10 +0100 Subject: [PATCH 3/4] escape parts of template --- .../src/de/hsadmin/mods/dom/httpd-vhost.vm | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/hsarback/src/de/hsadmin/mods/dom/httpd-vhost.vm b/hsarback/src/de/hsadmin/mods/dom/httpd-vhost.vm index 6474617..709794b 100644 --- a/hsarback/src/de/hsadmin/mods/dom/httpd-vhost.vm +++ b/hsarback/src/de/hsadmin/mods/dom/httpd-vhost.vm @@ -51,15 +51,15 @@ RewriteCond %{REQUEST_URI} !^/cgi-bin/ RewriteCond %{REQUEST_URI} !^/fastcgi-bin/ - 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] + 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] #if( !${htdocsfallback} ) RewriteCond %{REQUEST_URI} !^/cgi-bin/ RewriteCond %{REQUEST_URI} !^/fastcgi-bin/ - RewriteCond %{HTTP_HOST} ^(.+)\.{DOM_HOSTNAME}\.?(:80)?\$ [novary] - RewriteCond /home/doms/${dom.name}/subs/\$\{tolower:%1\} !-d + RewriteCond %{HTTP_HOST} ^(.+)\.{DOM_HOSTNAME}\.?(:80)?$ [novary] + RewriteCond /home/doms/${dom.name}/subs/#[[${tolower:%1} ]]# !-d RewriteRule ^(.*) - [redirect=404,last] #end @@ -125,15 +125,15 @@ RewriteCond %{REQUEST_URI} !^/cgi-bin/ RewriteCond %{REQUEST_URI} !^/fastcgi-bin/ - 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] + 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] #if( !${htdocsfallback} ) RewriteCond %{REQUEST_URI} !^/cgi-bin/ RewriteCond %{REQUEST_URI} !^/fastcgi-bin/ - RewriteCond %{HTTP_HOST} ^(.+)\.${dom.name}\.?(:443)?\$ [novary] - RewriteCond /home/doms/${dom.name}/subs-ssl/${tolower:%1} !-d + RewriteCond %{HTTP_HOST} ^(.+)\.${dom.name}\.?(:443)?$ [novary] + RewriteCond /home/doms/${dom.name}/subs-ssl/#[[${tolower:%1} ]]# !-d RewriteRule ^(.*) - [redirect=404,last] #end From aee9884aa8fa9bf2bec010ad8f5eb95e01a37c8b Mon Sep 17 00:00:00 2001 From: Peter Hormanns Date: Thu, 7 Mar 2013 16:48:30 +0100 Subject: [PATCH 4/4] fix error in htaccess template --- hsarback/src/de/hsadmin/mods/dom/htaccess.vm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hsarback/src/de/hsadmin/mods/dom/htaccess.vm b/hsarback/src/de/hsadmin/mods/dom/htaccess.vm index c0c8540..dd5e6d3 100644 --- a/hsarback/src/de/hsadmin/mods/dom/htaccess.vm +++ b/hsarback/src/de/hsadmin/mods/dom/htaccess.vm @@ -1 +1 @@ -Redirect permanent / ${protocol}://www.{domain.name}/ +Redirect permanent / ${protocol}://www.${domain.name}/