diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..9ddf3ec
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,40 @@
+SHELL := /bin/bash
+
+info:
+ @echo "Achtung: nur auf Entwicklungs- und Testservern einsetzen!"
+ @echo "make build: build the jar files"
+ @echo "make psql: start psql shell on the database"
+ @echo "make resetdata: reset the data in the database"
+ @echo "make run: run catalina and watch the output"
+ @echo "make test: run all continuous integration tests"
+ @echo "make testdomain: run one specific test for domains"
+
+build:
+ source ~/.profile
+ cd ~/hsadmin/util && mvn clean install
+ cd ~/hsadmin/qserv && mvn clean install
+ cd ~/hsadmin/hsarback && mvn package -DskipTests
+ cp ~/hsadmin/qserv/target/hsadmin-*.jar ~/tomcat7/webapps/hsar/WEB-INF/lib/
+ cp ~/hsadmin/util/target/hsadmin-*.jar ~/tomcat7/webapps/hsar/WEB-INF/lib/
+ cp ~/hsadmin/hsarback/target/hsar.war ~/tomcat7/webapps
+
+
+resetdata:
+ psql -U tim03_hsatest < ~/hsadmin/hsarback/database/dropschema.sql
+ psql -U tim03_hsatest < ~/hsadmin/hsarback/database/schema.sql
+ psql -U tim03_hsatest < ~/hsadmin/hsarback/database/data.sql
+
+test: resetdata
+ source ~/.profile
+ cd ~/hsadmin/hsarback && mvn test -Dtest=ContinuousIntegrationTest
+
+testdomain: resetdata
+ source ~/.profile
+ cd ~/hsadmin/hsarback && mvn test -Dtest=InitDataTest && mvn test -Dtest=DomainTest
+
+run:
+ source ~/.profile
+ cd ~/tomcatmq && ./bin/catalina.sh run
+
+psql:
+ WHOAMI=`whoami` && psql -U $${WHOAMI//\-/_}
diff --git a/hsarback/database/data.sql b/hsarback/database/data.sql
index 363b0c0..8600003 100644
--- a/hsarback/database/data.sql
+++ b/hsarback/database/data.sql
@@ -209,6 +209,14 @@ INSERT INTO domain_option (domain_option_name)
VALUES ('autoconfig');
INSERT INTO domain_option (domain_option_name)
VALUES ('dkim');
+INSERT INTO domain_option (domain_option_name)
+ VALUES ('passenger');
+INSERT INTO domain_option (domain_option_name)
+ VALUES ('passengerfriendlyerrorpages');
+INSERT INTO domain_option (domain_option_name)
+ VALUES ('cgi');
+INSERT INTO domain_option (domain_option_name)
+ VALUES ('fastcgi');
--
-- table: price_list
diff --git a/hsarback/database/database_update.sql b/hsarback/database/database_update.sql
index ee09d66..e3398af 100644
--- a/hsarback/database/database_update.sql
+++ b/hsarback/database/database_update.sql
@@ -1,85 +1,19 @@
-DROP VIEW ipconfig;
-ALTER TABLE packet
- ALTER COLUMN packet_name TYPE VARCHAR(6);
-ALTER TABLE packet
- ALTER COLUMN hive_id DROP NOT NULL;
+ALTER TABLE domain
+ ADD COLUMN passenger_python character varying(256) DEFAULT '/usr/bin/python3',
+ ADD COLUMN passenger_nodejs character varying(256) DEFAULT '/usr/bin/node',
+ ADD COLUMN passenger_ruby character varying(256) DEFAULT '/usr/bin/ruby',
+ ADD COLUMN fcgi_php_bin character varying(256) DEFAULT '/usr/lib/cgi-bin/php';
+
+INSERT INTO domain_option (domain_option_name) VALUES
+ ('passenger'),
+ ('passengerfriendlyerrorpages'),
+ ('cgi'),
+ ('fastcgi');
-UPDATE packet SET packet_name='vm10' || substr(packet_name,4,2) WHERE packet_name LIKE 'srv%';
-
-CREATE VIEW ipconfig AS
- SELECT DISTINCT ON (theunion.ipv4) theunion.ipv4,
- theunion.name,
- theunion.alias,
- theunion.hivename
- FROM ( SELECT h.hive_name AS hivename,
- ip.inet_addr AS ipv4,
- 'eth0:'::text || p.packet_name::text AS alias,
- p.packet_name AS name,
- 2 AS prio
- FROM inet_addr ip
- JOIN packet p ON p.cur_inet_addr_id = ip.inet_addr_id
- JOIN hive h ON h.hive_id = p.hive_id
- UNION
- SELECT h.hive_name AS hivename,
- ip.inet_addr AS ipv4,
- 'eth0'::text AS alias,
- h.hive_name AS name,
- 1 AS prio
- FROM inet_addr ip
- JOIN hive h ON h.inet_addr_id = ip.inet_addr_id
- ORDER BY 2, 5) theunion;
-
-INSERT INTO basepacket (basepacket_code, description, sorting, valid, article_number)
- VALUES ('SRV/CLD', 'Cloud Server', 0, true, 3000);
-
-INSERT INTO basecomponent (basecomponent_code, description, sorting, valid)
- VALUES ('BANDWIDTH', 'Bandbreite 95/5 (Mbit/s)', 0, true);
-
-INSERT INTO basecomponent (basecomponent_code, description, sorting, valid)
- VALUES ('SLAINFR8H', 'HS Ext. Support (24x7 8h) for Infrastructure', 0, true);
-INSERT INTO basecomponent (basecomponent_code, description, sorting, valid)
- VALUES ('SLAINFR4H', 'HS Ext. Support (24x7 4h) for Infrastructure', 0, true);
-INSERT INTO basecomponent (basecomponent_code, description, sorting, valid)
- VALUES ('SLAINFR2H', 'HS Ext. Support (24x7 2h) for Infrastructure', 0, true);
-
-INSERT INTO component (basepacket_id, basecomponent_id, min_quantity, max_quantity, default_quantity, increment_quantity, include_quantity, admin_only, article_number)
- SELECT basepacket_id, basecomponent_id, 1, 102400000, 1, 1, 0, false, 3011 FROM basepacket, basecomponent WHERE basepacket_code='SRV/CLD' AND basecomponent_code='CPU';
-INSERT INTO component (basepacket_id, basecomponent_id, min_quantity, max_quantity, default_quantity, increment_quantity, include_quantity, admin_only, article_number)
- SELECT basepacket_id, basecomponent_id, 1024, 102400000, 1024, 1024, 0, false, 3012 FROM basepacket, basecomponent WHERE basepacket_code='SRV/CLD' AND basecomponent_code='RAM';
-INSERT INTO component (basepacket_id, basecomponent_id, min_quantity, max_quantity, default_quantity, increment_quantity, include_quantity, admin_only, article_number)
- SELECT basepacket_id, basecomponent_id, 0, 102400000, 250, 250, 0, false, 3013 FROM basepacket, basecomponent WHERE basepacket_code='SRV/CLD' AND basecomponent_code='TRAFFIC';
-INSERT INTO component (basepacket_id, basecomponent_id, min_quantity, max_quantity, default_quantity, increment_quantity, include_quantity, admin_only, article_number)
- SELECT basepacket_id, basecomponent_id, 0, 1000, 0, 1, 0, false, 3017 FROM basepacket, basecomponent WHERE basepacket_code='SRV/CLD' AND basecomponent_code='BANDWIDTH';
-INSERT INTO component (basepacket_id, basecomponent_id, min_quantity, max_quantity, default_quantity, increment_quantity, include_quantity, admin_only, article_number)
- SELECT basepacket_id, basecomponent_id, 25600, 102400000, 25600, 25600, 0, false, 3014 FROM basepacket, basecomponent WHERE basepacket_code='SRV/CLD' AND basecomponent_code='QUOTA';
-INSERT INTO component (basepacket_id, basecomponent_id, min_quantity, max_quantity, default_quantity, increment_quantity, include_quantity, admin_only, article_number)
- SELECT basepacket_id, basecomponent_id, 0, 102400000, 0, 256000, 0, false, 3015 FROM basepacket, basecomponent WHERE basepacket_code='SRV/CLD' AND basecomponent_code='STORAGE';
-
-INSERT INTO component (basepacket_id, basecomponent_id, min_quantity, max_quantity, default_quantity, increment_quantity, include_quantity, admin_only, article_number)
- SELECT basepacket_id, basecomponent_id, 1, 1, 1, 1, 0, false, 3136 FROM basepacket, basecomponent WHERE basepacket_code='SRV/CLD' AND basecomponent_code='SLABASIC';
-
-INSERT INTO component (basepacket_id, basecomponent_id, min_quantity, max_quantity, default_quantity, increment_quantity, include_quantity, admin_only, article_number)
- SELECT basepacket_id, basecomponent_id, 0, 1, 0, 1, 0, false, 3122 FROM basepacket, basecomponent WHERE basepacket_code='SRV/CLD' AND basecomponent_code='SLAINFR8H';
-INSERT INTO component (basepacket_id, basecomponent_id, min_quantity, max_quantity, default_quantity, increment_quantity, include_quantity, admin_only, article_number)
- SELECT basepacket_id, basecomponent_id, 0, 1, 0, 1, 0, false, 3125 FROM basepacket, basecomponent WHERE basepacket_code='SRV/CLD' AND basecomponent_code='SLAINFR4H';
-INSERT INTO component (basepacket_id, basecomponent_id, min_quantity, max_quantity, default_quantity, increment_quantity, include_quantity, admin_only, article_number)
- SELECT basepacket_id, basecomponent_id, 0, 1, 0, 1, 0, false, 3151 FROM basepacket, basecomponent WHERE basepacket_code='SRV/CLD' AND basecomponent_code='SLAINFR2H';
-
-INSERT INTO component (basepacket_id, basecomponent_id, min_quantity, max_quantity, default_quantity, increment_quantity, include_quantity, admin_only, article_number)
- SELECT basepacket_id, basecomponent_id, 0, 1000, 0, 1, 0, false, 2017 FROM basepacket, basecomponent WHERE basepacket_code='SRV/MGD' AND basecomponent_code='BANDWIDTH';
-UPDATE component SET min_quantity=0 WHERE component_id=38; -- min. Traffic für Managed Server auf 0
-
-INSERT INTO price (article_number, price, vat, price_list) VALUES (3011, 15, 19.0, 1);
-INSERT INTO price (article_number, price, vat, price_list) VALUES (3012, 5, 19.0, 1);
-INSERT INTO price (article_number, price, vat, price_list) VALUES (3013, 5, 19.0, 1);
-INSERT INTO price (article_number, price, vat, price_list) VALUES (3014, 5, 19.0, 1);
-INSERT INTO price (article_number, price, vat, price_list) VALUES (3015, 5, 19.0, 1);
-INSERT INTO price (article_number, price, vat, price_list) VALUES (3017, 2, 19.0, 1);
-
-INSERT INTO price (article_number, price, vat, price_list) VALUES (3136, 10, 19.0, 1);
-INSERT INTO price (article_number, price, vat, price_list) VALUES (3122, 40, 19.0, 1);
-INSERT INTO price (article_number, price, vat, price_list) VALUES (3125, 80, 19.0, 1);
-INSERT INTO price (article_number, price, vat, price_list) VALUES (3151, 160, 19.0, 1);
-
-INSERT INTO price (article_number, price, vat, price_list) VALUES (2017, 2, 19.0, 1);
+INSERT INTO domain__domain_option ( domain_option_id, domain_id )
+ SELECT ( SELECT domain_option_id FROM domain_option WHERE domain_option_name='cgi' ), domain_id FROM domain;
+INSERT INTO domain__domain_option ( domain_option_id, domain_id )
+ SELECT ( SELECT domain_option_id FROM domain_option WHERE domain_option_name='fastcgi' ), domain_id FROM domain;
+INSERT INTO domain__domain_option ( domain_option_id, domain_id )
+ SELECT ( SELECT domain_option_id FROM domain_option WHERE domain_option_name='passenger' ), domain_id FROM domain;
diff --git a/hsarback/database/schema.sql b/hsarback/database/schema.sql
index a0de244..be464b0 100644
--- a/hsarback/database/schema.sql
+++ b/hsarback/database/schema.sql
@@ -319,7 +319,11 @@ CREATE TABLE domain (
domain_dns_master character varying(64),
domain_id integer DEFAULT nextval('domain_domain_id_seq'::regclass) NOT NULL,
domain_owner integer NOT NULL,
- valid_subdomain_names character varying(256) DEFAULT 'www' NOT NULL
+ valid_subdomain_names character varying(256) DEFAULT 'www' NOT NULL,
+ passenger_python character varying(256) NULL,
+ passenger_nodejs character varying(256) NULL,
+ passenger_ruby character varying(256) NULL,
+ fcgi_php_bin character varying(256) NULL
);
diff --git a/hsarback/pom.xml b/hsarback/pom.xml
index 89331f5..290d540 100644
--- a/hsarback/pom.xml
+++ b/hsarback/pom.xml
@@ -11,8 +11,8 @@
UTF-8
UTF-8
- 11
- 11
+ 8
+ 8
@@ -70,13 +70,13 @@
org.apache.velocity
- velocity-engine-core
- 2.3
+ velocity
+ 1.7
org.apache.openjpa
openjpa
- 3.2.2
+ 2.4.3
junit
@@ -93,7 +93,7 @@
org.apache.activemq
activemq-all
- 5.18.1
+ 5.5.0
provided
@@ -116,8 +116,8 @@
maven-compiler-plugin
3.11.0
-
- 11
+
+ 8
diff --git a/hsarback/src/main/java/de/hsadmin/remote/DomainRemote.java b/hsarback/src/main/java/de/hsadmin/remote/DomainRemote.java
index 134787b..6ed410a 100644
--- a/hsarback/src/main/java/de/hsadmin/remote/DomainRemote.java
+++ b/hsarback/src/main/java/de/hsadmin/remote/DomainRemote.java
@@ -51,6 +51,14 @@ public class DomainRemote extends AbstractRemote {
}
final String validsubdomains = dom.getValidsubdomainnames();
resultMap.put("validsubdomainnames", validsubdomains);
+ final String passengerpython = dom.getPassengerpython();
+ resultMap.put("passengerpython", passengerpython);
+ final String passengernodejs = dom.getPassengernodejs();
+ resultMap.put("passengernodejs", passengernodejs);
+ final String passengerruby = dom.getPassengerruby();
+ resultMap.put("passengerruby", passengerruby);
+ final String fcgiphpbin = dom.getFcgiphpbin();
+ resultMap.put("fcgiphpbin", fcgiphpbin);
}
@Override
@@ -92,6 +100,22 @@ public class DomainRemote extends AbstractRemote {
if (validsubdomains != null && validsubdomains instanceof String) {
dom.setValidsubdomainnames((String) validsubdomains);
}
+ final Object passengerpython = setParams.get("passengerpython");
+ if (passengerpython != null && passengerpython instanceof String) {
+ dom.setPassengerpython((String) passengerpython);
+ }
+ final Object passengernodejs = setParams.get("passengernodejs");
+ if (passengernodejs != null && passengernodejs instanceof String) {
+ dom.setPassengernodejs((String) passengernodejs);
+ }
+ final Object passengerruby = setParams.get("passengerruby");
+ if (passengerruby != null && passengerruby instanceof String) {
+ dom.setPassengerruby((String) passengerruby);
+ }
+ final Object fcgiphpbin = setParams.get("fcgiphpbin");
+ if (fcgiphpbin != null && fcgiphpbin instanceof String) {
+ dom.setFcgiphpbin((String) fcgiphpbin);
+ }
}
@Override
diff --git a/hsarback/src/main/java/de/hsadmin/servlets/JsonPillarServlet.java b/hsarback/src/main/java/de/hsadmin/servlets/JsonPillarServlet.java
index f15b183..c6a76de 100644
--- a/hsarback/src/main/java/de/hsadmin/servlets/JsonPillarServlet.java
+++ b/hsarback/src/main/java/de/hsadmin/servlets/JsonPillarServlet.java
@@ -121,6 +121,10 @@ public class JsonPillarServlet extends HttpServlet {
domainadmins.add(domUserName);
final Pac domPac = domUser.getPac();
final String validSubdomainNames = dom.getValidsubdomainnames();
+ final String passengerPython = dom.getPassengerpython();
+ final String passengerNodejs = dom.getPassengernodejs();
+ final String passengerRuby = dom.getPassengerruby();
+ final String fcgiPhpBin = dom.getFcgiphpbin();
final INetAddress domINetAddr = domPac.getCurINetAddr();
writer.println(" \"domain\": \"" + domName + "\"");
writer.println(" , \"pac\": \"" + domPac.getName() + "\"");
@@ -148,6 +152,18 @@ public class JsonPillarServlet extends HttpServlet {
}
writer.println(" }");
writer.println(" , \"validsubdomains\": \"" + validSubdomainNames + "\"");
+ if (passengerPython != null && passengerPython.length() > 0) {
+ writer.println(" , \"passengerpython\": \"" + passengerPython + "\"");
+ }
+ if (passengerNodejs != null && passengerNodejs.length() > 0) {
+ writer.println(" , \"passengernodejs\": \"" + passengerNodejs + "\"");
+ }
+ if (passengerRuby != null && passengerRuby.length() > 0) {
+ writer.println(" , \"passengerruby\": \"" + passengerRuby + "\"");
+ }
+ if (fcgiPhpBin != null && fcgiPhpBin.length() > 0) {
+ writer.println(" , \"fcgiphpbin\": \"" + fcgiPhpBin + "\"");
+ }
writer.println(" }");
}
writer.println(" ]");
diff --git a/hsarback/src/main/java/de/hsadmin/servlets/QueueStatusReceiverServlet.java b/hsarback/src/main/java/de/hsadmin/servlets/QueueStatusReceiverServlet.java
index 3c72b77..eed9ffa 100644
--- a/hsarback/src/main/java/de/hsadmin/servlets/QueueStatusReceiverServlet.java
+++ b/hsarback/src/main/java/de/hsadmin/servlets/QueueStatusReceiverServlet.java
@@ -16,8 +16,6 @@ import javax.jms.QueueSession;
import javax.jms.Session;
import javax.naming.Context;
import javax.naming.InitialContext;
-import javax.naming.NameClassPair;
-import javax.naming.NamingEnumeration;
import javax.naming.NamingException;
import javax.persistence.EntityManager;
import javax.servlet.ServletConfig;
@@ -26,12 +24,9 @@ import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import org.apache.activemq.ActiveMQConnectionFactory;
-
import de.hsadmin.core.model.TechnicalException;
import de.hsadmin.core.model.TicketValidator;
import de.hsadmin.core.model.Transaction;
-import de.hsadmin.core.qserv.NullProcessor;
import de.hsadmin.core.qserv.Processor;
import de.hsadmin.core.qserv.QueueTask;
import de.hsadmin.core.util.Config;
@@ -41,8 +36,6 @@ public class QueueStatusReceiverServlet extends HttpServlet
private static final long serialVersionUID = -5701350884034782083L;
- private static boolean initQueuesDone = false;
-
private String jmsUser;
private String jmsPass;
private QueueConnectionFactory queueConnectionFactory;
@@ -61,14 +54,6 @@ public class QueueStatusReceiverServlet extends HttpServlet
isConnected = false;
messageCount = 0;
errorCount = 0;
- try {
- if (!initQueuesDone) {
- initQueues();
- }
- initQueuesDone = true;
- } catch (NamingException e) {
- throw new ServletException(e);
- }
try {
connect();
} catch (NamingException e) {
@@ -83,10 +68,6 @@ public class QueueStatusReceiverServlet extends HttpServlet
InitialContext ctx = new InitialContext();
Context env = (Context) ctx.lookup("java:comp/env");
queueConnectionFactory = (QueueConnectionFactory) env.lookup("jms/QueueCF");
- if (queueConnectionFactory instanceof ActiveMQConnectionFactory) {
- ActiveMQConnectionFactory activeMQConnectionFactory = (ActiveMQConnectionFactory) queueConnectionFactory;
- activeMQConnectionFactory.setTrustAllPackages(true);
- }
int timeoutCounter = 10;
while (!isConnected && (timeoutCounter > 0)) {
try {
@@ -108,29 +89,6 @@ public class QueueStatusReceiverServlet extends HttpServlet
}
}
- private void initQueues() throws NamingException {
- InitialContext ctx = new InitialContext();
- NamingEnumeration list = ctx.list("java:comp/env/jms");
- Transaction transaction = new Transaction("anonymous");
- transaction.beginTransaction();
- EntityManager entityManager = transaction.getEntityManager();
- while (list.hasMore()) {
- NameClassPair pair = list.next();
- String jndiName = pair.getName();
- if (jndiName != null && jndiName.startsWith("hsadminSystem-")) {
- QueueTask task = new QueueTask();
- task.setProcessor(new NullProcessor());
- entityManager.persist(task);
- entityManager.flush();
- String hive = jndiName.substring(14);
- transaction.enqueue(hive, task);
- }
- }
- transaction.commitTransaction();
- transaction.close();
- ctx.close();
- }
-
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
diff --git a/hsarback/src/main/resources/de/hsadmin/mods/dom/apache-vhost.vm b/hsarback/src/main/resources/de/hsadmin/mods/dom/apache-vhost.vm
index 91f9ef0..964011d 100644
--- a/hsarback/src/main/resources/de/hsadmin/mods/dom/apache-vhost.vm
+++ b/hsarback/src/main/resources/de/hsadmin/mods/dom/apache-vhost.vm
@@ -17,8 +17,12 @@
DocumentRoot /home/doms/${dom.name}/htdocs
+#if( ${cgi} )
Alias /cgi-bin/ /home/doms/${dom.name}/cgi/
+#end
+#if( ${fastcgi} )
Alias /fastcgi-bin/ /home/doms/${dom.name}/fastcgi/
+#end
PassengerEnabled Off
@@ -26,21 +30,42 @@
+#if( ${passenger} )
PassengerEnabled On
- AllowOverride AuthConfig FileInfo Indexes Limit Options=ExecCGI,IncludesNoExec,Indexes,MultiViews,SymLinksIfOwnerMatch,PassengerNodejs,PassengerPython,PassengerRuby,PassengerAppEnv
+ # PassengerPreloadBundler On
+#else
+ PassengerEnabled Off
+#end
+#if( ${passengerfriendlyerrorpages} )
+ PassengerFriendlyErrorPages On
+#end
+#if( ${passengerpython} )
+ PassengerPython ${passengerpython}
+#end
+#if( ${passengernodejs} )
+ PassengerNodejs ${passengernodejs}
+#end
+#if( ${passengerruby} )
+ PassengerRuby ${passengerruby}
+#end
+ AllowOverride AuthConfig FileInfo Indexes Limit Options=ExecCGI,Includes,Indexes,MultiViews,SymLinksIfOwnerMatch,PassengerNodejs,PassengerPython,PassengerRuby,PassengerAppEnv
+#if( ${cgi} )
PassengerEnabled Off
SetHandler cgi-script
- Options +ExecCGI +IncludesNoExec -Indexes -MultiViews +SymLinksIfOwnerMatch
+ Options +ExecCGI +Includes -Indexes -MultiViews +SymLinksIfOwnerMatch
+#end
+#if( ${fastcgi} )
PassengerEnabled Off
SetHandler fcgid-script
- Options +ExecCGI +IncludesNoExec -Indexes -MultiViews +SymLinksIfOwnerMatch
+ Options +ExecCGI +Includes -Indexes -MultiViews +SymLinksIfOwnerMatch
+#end
#if( ${autoconfig} )
@@ -57,8 +82,12 @@
RewriteEngine On
RewriteOptions Inherit
+#if( ${cgi} )
RewriteCond %{REQUEST_URI} !^/cgi-bin/
+#end
+#if( ${fastcgi} )
RewriteCond %{REQUEST_URI} !^/fastcgi-bin/
+#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]
@@ -71,8 +100,13 @@
RewriteRule ^(.*) - [redirect=404,last]
#end
- AddType application/x-httpd-php .php .php5 .php4 .php3
- Action application/x-httpd-php /fastcgi-bin/phpstub
+#if( ${fastcgi} )
+#if( ${fcgiphpbin} )
+ FcgidInitialEnv HTTP_PHP_BIN ${fcgiphpbin}
+#end
+ AddType application/x-httpd-php .php
+ Action application/x-httpd-php /fastcgi-bin/hs-phpstub
+#end
@@ -94,8 +128,12 @@
DocumentRoot /home/doms/${dom.name}/htdocs-ssl
+#if( ${cgi} )
Alias /cgi-bin/ /home/doms/${dom.name}/cgi-ssl/
+#end
+#if( ${fastcgi} )
Alias /fastcgi-bin/ /home/doms/${dom.name}/fastcgi-ssl/
+#end
SSLRequireSSL On
@@ -104,21 +142,42 @@
+#if( ${passenger} )
PassengerEnabled On
- AllowOverride AuthConfig FileInfo Indexes Limit Options=ExecCGI,IncludesNoExec,Indexes,MultiViews,SymLinksIfOwnerMatch,PassengerNodejs,PassengerPython,PassengerRuby,PassengerAppEnv
+ # PassengerPreloadBundler On
+#else
+ PassengerEnabled Off
+#end
+#if( ${passengerfriendlyerrorpages} )
+ PassengerFriendlyErrorPages On
+#end
+#if( ${passengerpython} )
+ PassengerPython ${passengerpython}
+#end
+#if( ${passengernodejs} )
+ PassengerNodejs ${passengernodejs}
+#end
+#if( ${passengerruby} )
+ PassengerRuby ${passengerruby}
+#end
+ AllowOverride AuthConfig FileInfo Indexes Limit Options=ExecCGI,Includes,Indexes,MultiViews,SymLinksIfOwnerMatch,PassengerNodejs,PassengerPython,PassengerRuby,PassengerAppEnv
+#if( ${cgi} )
PassengerEnabled Off
SetHandler cgi-script
- Options +ExecCGI +IncludesNoExec -Indexes -MultiViews +SymLinksIfOwnerMatch
+ Options +ExecCGI +Includes -Indexes -MultiViews +SymLinksIfOwnerMatch
+#end
+#if( ${fastcgi} )
PassengerEnabled Off
SetHandler fcgid-script
- Options +ExecCGI +IncludesNoExec -Indexes -MultiViews +SymLinksIfOwnerMatch
+ Options +ExecCGI +Includes -Indexes -MultiViews +SymLinksIfOwnerMatch
+#end
#if( ${autoconfig} )
@@ -135,8 +194,12 @@
RewriteEngine On
RewriteOptions Inherit
+#if( ${cgi} )
RewriteCond %{REQUEST_URI} !^/cgi-bin/
+#end
+#if( ${fastcgi} )
RewriteCond %{REQUEST_URI} !^/fastcgi-bin/
+#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]
@@ -149,7 +212,11 @@
RewriteRule ^(.*) - [redirect=404,last]
#end
- AddType application/x-httpd-php .php .php5 .php4 .php3
- Action application/x-httpd-php /fastcgi-bin/phpstub
-
+#if( ${fastcgi} )
+#if( ${fcgiphpbin} )
+ FcgidInitialEnv HTTP_PHP_BIN ${fcgiphpbin}
+#end
+ AddType application/x-httpd-php .php
+ Action application/x-httpd-php /fastcgi-bin/hs-phpstub
+#end
diff --git a/hsarback/src/test/java/de/hsadmin/remote/DomainTest.java b/hsarback/src/test/java/de/hsadmin/remote/DomainTest.java
index f2f8421..82c712f 100644
--- a/hsarback/src/test/java/de/hsadmin/remote/DomainTest.java
+++ b/hsarback/src/test/java/de/hsadmin/remote/DomainTest.java
@@ -9,6 +9,7 @@ import java.io.IOException;
import java.net.UnknownHostException;
import java.util.HashMap;
import java.util.Map;
+import java.util.Arrays;
import org.apache.xmlrpc.XmlRpcException;
import org.apache.xmlrpc.client.XmlRpcClient;
@@ -19,7 +20,7 @@ import org.junit.Test;
public class DomainTest {
private static final String MODULE = "domain";
-
+
private XmlRpcClient client;
private RemoteCASHelper cas;
@@ -40,8 +41,8 @@ public class DomainTest {
String user = "aaa00";
String grantingTicketURL = cas.getGrantingTicketURL(user);
Map whereParams = new HashMap();
- Object[] params = new Object[] { user,
- cas.getServiceTicket(grantingTicketURL, RemoteTestHelper.getBackendURL()),
+ Object[] params = new Object[] { user,
+ cas.getServiceTicket(grantingTicketURL, RemoteTestHelper.getBackendURL()),
whereParams };
try {
Object execute = client.execute(MODULE + ".search", params);
@@ -61,15 +62,15 @@ public class DomainTest {
}
@Test
- public void testUpdate() {
+ public void testUpdateWithoutPermissionFail() {
String user = "aaa00";
String grantingTicketURL = cas.getGrantingTicketURL(user);
Map setParams = new HashMap();
Map whereParams = new HashMap();
setParams.put("user", "aaa00");
whereParams.put("name", "example01.org");
- Object[] params = new Object[] { user,
- cas.getServiceTicket(grantingTicketURL, RemoteTestHelper.getBackendURL()),
+ Object[] params = new Object[] { user,
+ cas.getServiceTicket(grantingTicketURL, RemoteTestHelper.getBackendURL()),
setParams, whereParams };
try {
Object execute = client.execute(MODULE + ".update", params);
@@ -87,8 +88,8 @@ public class DomainTest {
Map setParams = new HashMap();
setParams.put("name", "f8n.de");
setParams.put("user", "aaa00-admin");
- Object[] params = new Object[] { user,
- cas.getServiceTicket(grantingTicketURL, RemoteTestHelper.getBackendURL()),
+ Object[] params = new Object[] { user,
+ cas.getServiceTicket(grantingTicketURL, RemoteTestHelper.getBackendURL()),
setParams };
try {
Object execute = client.execute(MODULE + ".add", params);
@@ -99,6 +100,129 @@ public class DomainTest {
assertEquals(count + 1, getDomsCount());
}
+ @Test
+ public void testUpdateDomain() {
+ String user = "aaa00";
+ String grantingTicketURL = cas.getGrantingTicketURL(user);
+
+ // first create the domain
+ Map setParams = new HashMap();
+ setParams.put("name", "exampleupdate.de");
+ setParams.put("user", "aaa00-admin");
+ Object[] params = new Object[] { user,
+ cas.getServiceTicket(grantingTicketURL, RemoteTestHelper.getBackendURL()),
+ setParams };
+ try {
+ Object execute = client.execute(MODULE + ".add", params);
+ assertTrue(execute instanceof Map, ?>);
+ } catch (XmlRpcException e) {
+ fail(e.getMessage());
+ }
+
+ // check initial values
+ Map whereParams = new HashMap();
+ whereParams.put("name", "exampleupdate.de");
+ params = new Object[] { user,
+ cas.getServiceTicket(grantingTicketURL, RemoteTestHelper.getBackendURL()),
+ whereParams };
+ try {
+ Object execute = client.execute(MODULE + ".search", params);
+ if (execute instanceof Object[]) {
+ Object[] result = (Object[]) execute;
+ assertTrue("expected 1 result, but got " + result.length, 1 == result.length);
+ for (Object o : result) {
+ if (o instanceof Map, ?>) {
+ Map, ?> row = (Map, ?>) o;
+ assertTrue("Domain name should be exampleupdate.de but is " + row.get("name"), "exampleupdate.de".equals(row.get("name")));
+ assertTrue("ValidSubdomainNames should be * but is " + row.get("validsubdomainnames"), "*".equals(row.get("validsubdomainnames")));
+ String defaultPassengerPython = "";
+
+ assertTrue("PassengerPython should be empty but is " + row.get("passengerpython"), isNullOrEmpty(row.get("passengerpython")));
+ assertTrue("PassengerNodejs should be empty but is " + row.get("passengernodejs"), isNullOrEmpty(row.get("passengernodejs")));
+ assertTrue("PassengerRuby should be empty but is " + row.get("passengerruby"), isNullOrEmpty(row.get("passengerruby")));
+ assertTrue("FcgiPhpBin should be empty but is " + row.get("fcgiphpbin"), isNullOrEmpty(row.get("fcgiphpbin")));
+
+ String[] checkDomainOptions = Arrays.asList((Object[]) row.get("domainoptions")).toArray(new String[0]);
+ String[] expectedDomainOptions = new String[] {"htdocsfallback", "cgi", "fastcgi", "passenger", "indexes", "dkim", "autoconfig", "greylisting", "includes", "letsencrypt", "multiviews"};
+ Arrays.sort(expectedDomainOptions);
+ Arrays.sort(checkDomainOptions);
+ assertTrue("Default Domainoptions should be " + Arrays.toString(expectedDomainOptions) + " but are " + Arrays.toString(checkDomainOptions),
+ Arrays.toString(expectedDomainOptions).equals(Arrays.toString(checkDomainOptions)));
+ }
+ else {
+ fail("Map, ?> expected");
+ }
+ }
+ }
+ else {
+ fail("Object[] expected");
+ }
+ } catch (XmlRpcException e) {
+ fail(e.getMessage());
+ }
+
+ // now update the domain
+ setParams = new HashMap();
+ setParams.put("validsubdomainnames", "www2");
+
+ String newPassengerPython = "/home/pacs/aaa00/users/admin/.venv/bin/python3";
+ setParams.put("passengerpython", newPassengerPython);
+ String newPassengerRuby = "/home/pacs/aaa00/users/admin/.rbenv/shims/ruby";
+ setParams.put("passengerruby", newPassengerRuby);
+ String newPassengerNodejs = "/home/pacs/aaa00/users/admin/.nvm/versions/node/v18.19.0/bin/node";
+ setParams.put("passengernodejs", newPassengerNodejs);
+ String newFcgiPhpBin = "/usr/lib/cgi-bin/php8.1";
+ setParams.put("fcgiphpbin", newFcgiPhpBin);
+
+ String[] newDomainOptions = new String[] {"greylisting", "letsencrypt", "passenger", "passengerfriendlyerrorpages", "cgi", "fastcgi"};
+ setParams.put("domainoptions", newDomainOptions);
+
+ whereParams = new HashMap();
+ whereParams.put("name", "exampleupdate.de");
+ params = new Object[] { user,
+ cas.getServiceTicket(grantingTicketURL, RemoteTestHelper.getBackendURL()),
+ setParams, whereParams };
+ try {
+ Object execute = client.execute(MODULE + ".update", params);
+ if (execute instanceof Object[]) {
+ Object[] result = (Object[]) execute;
+ assertTrue("expected 1 result, but got " + result.length, 1 == result.length);
+ for (Object o : result) {
+ if (o instanceof Map, ?>) {
+ Map, ?> row = (Map, ?>) o;
+ assertTrue("Domain name should be exampleupdate.de but is " + row.get("name"), "exampleupdate.de".equals(row.get("name")));
+ assertTrue("ValidSubdomainNames should be www2 but is " + row.get("validsubdomainnames"), "www2".equals(row.get("validsubdomainnames")));
+
+ assertTrue("PassengerPython should be " + newPassengerPython + " but is " + row.get("passengerpython"), newPassengerPython.equals(row.get("passengerpython")));
+ assertTrue("PassengerNodejs should be " + newPassengerNodejs + " but is " + row.get("passengernodejs"), newPassengerNodejs.equals(row.get("passengernodejs")));
+ assertTrue("PassengerRuby should be " + newPassengerRuby + " but is " + row.get("passengerruby"), newPassengerRuby.equals(row.get("passengerruby")));
+ assertTrue("FcgiPhpBin should be " + newFcgiPhpBin + " but is " + row.get("fcgiphpbin"), newFcgiPhpBin.equals(row.get("fcgiphpbin")));
+
+ String[] checkDomainOptions = Arrays.asList((Object[]) row.get("domainoptions")).toArray(new String[0]);
+ Arrays.sort(newDomainOptions);
+ Arrays.sort(checkDomainOptions);
+ assertTrue("Domainoptions should be " + Arrays.toString(newDomainOptions) + " but are " + Arrays.toString(checkDomainOptions),
+ Arrays.toString(newDomainOptions).equals(Arrays.toString(checkDomainOptions)));
+ }
+ else {
+ fail("Map, ?> expected");
+ }
+ }
+ }
+ else {
+ fail("Object[] expected");
+ }
+ } catch (XmlRpcException e) {
+ fail(e.getMessage());
+ }
+ }
+
+ private Boolean isNullOrEmpty(Object s) {
+ if (s == null) return true;
+ if (((String)s).equals("")) return true;
+ return false;
+ }
+
@Test
public void testCreateForeignSubdomain() throws UnknownHostException, IOException {
int count = getDomsCount();
@@ -107,8 +231,8 @@ public class DomainTest {
Map setParams = new HashMap();
setParams.put("name", "f6n.de");
setParams.put("user", "aaa00-admin");
- Object[] params = new Object[] { user,
- cas.getServiceTicket(grantingTicketURL, RemoteTestHelper.getBackendURL()),
+ Object[] params = new Object[] { user,
+ cas.getServiceTicket(grantingTicketURL, RemoteTestHelper.getBackendURL()),
setParams };
try {
Object execute = client.execute(MODULE + ".add", params);
@@ -123,8 +247,8 @@ public class DomainTest {
setParams = new HashMap();
setParams.put("name", "subdomain.f6n.de");
setParams.put("user", "aaa01");
- params = new Object[] { user,
- cas.getServiceTicket(grantingTicketURL, RemoteTestHelper.getBackendURL()),
+ params = new Object[] { user,
+ cas.getServiceTicket(grantingTicketURL, RemoteTestHelper.getBackendURL()),
setParams };
try {
Object execute = client.execute(MODULE + ".add", params);
@@ -140,8 +264,8 @@ public class DomainTest {
String user = "aaa00";
String grantingTicketURL = cas.getGrantingTicketURL(user);
Map whereParams = new HashMap();
- Object[] params = new Object[] { user,
- cas.getServiceTicket(grantingTicketURL, RemoteTestHelper.getBackendURL()),
+ Object[] params = new Object[] { user,
+ cas.getServiceTicket(grantingTicketURL, RemoteTestHelper.getBackendURL()),
whereParams };
try {
Object execute = client.execute(MODULE + ".search", params);
diff --git a/qserv/hsadmin.properties b/qserv/hsadmin.properties
new file mode 100644
index 0000000..abc80cf
--- /dev/null
+++ b/qserv/hsadmin.properties
@@ -0,0 +1,14 @@
+hsadmin.jms.url=ssl://hsh02.hostsharing.net:61617
+hsadmin.jms.username=user-h98
+hsadmin.jms.password=kein-echtes-ppasswort
+hsadmin.jms.system-queue=queue.hsadminSystem-h98
+hsadmin.jms.status-queue=queue.hsadminStatus
+accountprefix.customer=hsh00
+accountprefix.hostmaster=hsh01
+queues.dns=testdns
+queues.mail=testmail
+hsadmin.smtp.from=nobody@hostsharing.net
+hsadmin.smtp.cc=hostmaster@hostsharing.net
+loginURL=TestUmgebung
+backendURL=https://config.hostsharing.net:443/hsar/backend
+xmlrpcURL=http://localhost:8080/hsar/xmlrpc/hsadmin
diff --git a/qserv/pom.xml b/qserv/pom.xml
index d2694d6..828e017 100644
--- a/qserv/pom.xml
+++ b/qserv/pom.xml
@@ -7,7 +7,7 @@
4.0.15
UTF-8
- 11
+ 8
@@ -27,13 +27,13 @@
org.apache.velocity
- velocity-engine-core
- 2.3
+ velocity
+ 1.7
org.apache.openjpa
openjpa
- 3.2.2
+ 2.4.3
junit
@@ -44,7 +44,7 @@
org.apache.activemq
activemq-all
- 5.18.1
+ 5.5.0
provided
@@ -61,14 +61,14 @@
maven-compiler-plugin
3.11.0
-
- 11
+
+ 8
org.apache.openjpa
openjpa-maven-plugin
- 3.2.2
+ 2.4.3
**/QueueTask.class,**/Domain.class,**/DomainOption.class,**/EMailAddress.class,**/EMailAlias.class,**/Customer.class,**/Contact.class,**/UnixUser.class,**/Pac.class,**/BasePac.class,**/BaseComponent.class,**/PacComponent.class,**/Component.class,**/Hive.class,**/INetAddress.class,**/Database.class,**/DatabaseUser.class,**/PgSqlDatabase.class,**/MySqlDatabase.class,**/PgSqlUser.class,**/MySqlUser.class
@@ -89,5 +89,40 @@
+
+
+
+
+ org.eclipse.m2e
+ lifecycle-mapping
+ 1.0.0
+
+
+
+
+
+
+ org.apache.openjpa
+
+
+ openjpa-maven-plugin
+
+
+ [2.4.3,)
+
+
+ enhance
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/qserv/src/main/java/de/hsadmin/core/model/Transaction.java b/qserv/src/main/java/de/hsadmin/core/model/Transaction.java
index 4e7f890..13fd71a 100644
--- a/qserv/src/main/java/de/hsadmin/core/model/Transaction.java
+++ b/qserv/src/main/java/de/hsadmin/core/model/Transaction.java
@@ -15,7 +15,7 @@ import javax.persistence.EntityManager;
import javax.persistence.EntityTransaction;
import javax.persistence.Query;
-import org.apache.activemq.ActiveMQConnectionFactory;
+//import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.openjpa.persistence.OpenJPAEntityManager;
import de.hsadmin.core.qserv.QueueClient;
@@ -43,10 +43,10 @@ public class Transaction {
ctx = new InitialContext();
Context env = (Context) ctx.lookup("java:comp/env");
queueConnectionFactory = (QueueConnectionFactory) env.lookup("jms/QueueCF");
- if (queueConnectionFactory instanceof ActiveMQConnectionFactory) {
- ActiveMQConnectionFactory activeMQconnectionFatory = (ActiveMQConnectionFactory) queueConnectionFactory;
- activeMQconnectionFatory.setTrustAllPackages(true);
- }
+// if (queueConnectionFactory instanceof ActiveMQConnectionFactory) {
+// ActiveMQConnectionFactory activeMQconnectionFatory = (ActiveMQConnectionFactory) queueConnectionFactory;
+// activeMQconnectionFatory.setTrustAllPackages(true);
+// }
} catch (NamingException e) {
throw new TechnicalException("no jms queue: jms/QueueCF", e);
}
diff --git a/qserv/src/main/java/de/hsadmin/core/qserv/QueueServer.java b/qserv/src/main/java/de/hsadmin/core/qserv/QueueServer.java
index f997a7b..bf64403 100644
--- a/qserv/src/main/java/de/hsadmin/core/qserv/QueueServer.java
+++ b/qserv/src/main/java/de/hsadmin/core/qserv/QueueServer.java
@@ -7,6 +7,7 @@ import java.util.logging.Level;
import java.util.logging.Logger;
import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
import javax.jms.Destination;
import javax.jms.ExceptionListener;
import javax.jms.JMSException;
@@ -23,8 +24,6 @@ import javax.jms.Session;
import javax.naming.Context;
import javax.naming.InitialContext;
-import org.apache.activemq.ActiveMQConnectionFactory;
-
public class QueueServer extends QueueCommons implements MessageListener, ExceptionListener {
private static final String VERSION_NO = "4.0.11";
@@ -53,13 +52,7 @@ public class QueueServer extends QueueCommons implements MessageListener, Except
throw new Exception(userHelp(propFile));
}
}
- FileInputStream propStream = null;
- try {
- propStream = new FileInputStream(propFile);
- } catch (Exception e) {
- System.out.println("couldn't read config file " + propFile.getAbsolutePath());
- System.exit(1);
- }
+ FileInputStream propStream = new FileInputStream(propFile);
Properties props = new Properties(System.getProperties());
props.load(propStream);
propStream.close();
@@ -85,7 +78,7 @@ public class QueueServer extends QueueCommons implements MessageListener, Except
}
});
while (!qServ.connect()) {
- Thread.sleep(30000);
+ Thread.sleep(10000);
}
while (true) {
Thread.sleep(10000);
@@ -130,11 +123,8 @@ public class QueueServer extends QueueCommons implements MessageListener, Except
// create JMS connection and session
try {
Context ctx = new InitialContext();
- QueueConnectionFactory connectionFactory = (QueueConnectionFactory) ctx.lookup(jmsFactory);
- if (connectionFactory instanceof ActiveMQConnectionFactory) {
- ActiveMQConnectionFactory activeMQConnectionFactory = (ActiveMQConnectionFactory) connectionFactory;
- activeMQConnectionFactory.setTrustAllPackages(true);
- }
+ QueueConnectionFactory connectionFactory =
+ (QueueConnectionFactory) ctx.lookup(jmsFactory);
conn = connectionFactory.createQueueConnection(jmsUserName, jmsPassWord);
conn.setExceptionListener(this);
queueSession = conn.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
@@ -215,11 +205,7 @@ public class QueueServer extends QueueCommons implements MessageListener, Except
try {
logger.log(Level.INFO, "sendStatus(" + queueMessage + ")");
Context ctx = new InitialContext();
- QueueConnectionFactory connectionFactory = (QueueConnectionFactory) ctx.lookup(jmsFactory);
- if (connectionFactory instanceof ActiveMQConnectionFactory) {
- ActiveMQConnectionFactory activeMQConnectionFactory = (ActiveMQConnectionFactory) connectionFactory;
- activeMQConnectionFactory.setTrustAllPackages(true);
- }
+ ConnectionFactory connectionFactory = (ConnectionFactory) ctx.lookup(jmsFactory);
Destination queue = (Destination) ctx.lookup(jmsStatusQueue);
statusConnection = connectionFactory.createConnection(jmsUserName, jmsPassWord);
statusSession = statusConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
diff --git a/qserv/src/main/java/de/hsadmin/mods/dom/Domain.java b/qserv/src/main/java/de/hsadmin/mods/dom/Domain.java
index a6d0575..57e6455 100644
--- a/qserv/src/main/java/de/hsadmin/mods/dom/Domain.java
+++ b/qserv/src/main/java/de/hsadmin/mods/dom/Domain.java
@@ -55,6 +55,10 @@ public class Domain extends AbstractEntity {
@Column(name = "domain_dns_master", columnDefinition = "character varying(64)")
private String dnsMaster;
+ @AnnFieldIO(validation="([a-z0-9\\-]+\\,)*[a-z0-9\\-]+|\\*|", rw=ReadWriteAccess.READWRITE)
+ @Column(name = "valid_subdomain_names", columnDefinition = "character varying(512)")
+ private String validsubdomainnames;
+
@AnnFieldIO(validation="[a-zA-Z0-9\\-\\.]*", rw=ReadWriteAccess.READWRITE, referTo=DomainOption.class, selectableValues=DomainOptionValues.class)
@ManyToMany(fetch=FetchType.EAGER, cascade=CascadeType.PERSIST)
@JoinTable(name="domain__domain_option",
@@ -62,10 +66,22 @@ public class Domain extends AbstractEntity {
inverseJoinColumns={@JoinColumn(name="domain_option_id", referencedColumnName="domain_option_id")})
private Set domainoptions;
- @AnnFieldIO(validation="([a-z0-9\\-]+\\,)*[a-z0-9\\-]+|\\*|", rw=ReadWriteAccess.READWRITE)
- @Column(name = "valid_subdomain_names", columnDefinition = "character varying(512)")
- private String validsubdomainnames;
-
+ @AnnFieldIO(validation="[a-zA-Z0-9\\_\\-\\/\\.]*", rw=ReadWriteAccess.READWRITE)
+ @Column(name = "passenger_python", columnDefinition = "character varying(256)")
+ private String passengerpython;
+
+ @AnnFieldIO(validation="[a-zA-Z0-9\\_\\-\\/\\.]*", rw=ReadWriteAccess.READWRITE)
+ @Column(name = "passenger_nodejs", columnDefinition = "character varying(256)")
+ private String passengernodejs;
+
+ @AnnFieldIO(validation="[a-zA-Z0-9\\_\\-\\/\\.]*", rw=ReadWriteAccess.READWRITE)
+ @Column(name = "passenger_ruby", columnDefinition = "character varying(256)")
+ private String passengerruby;
+
+ @AnnFieldIO(validation="[a-zA-Z0-9\\_\\-\\/\\.]*", rw=ReadWriteAccess.READWRITE)
+ @Column(name = "fcgi_php_bin", columnDefinition = "character varying(256)")
+ private String fcgiphpbin;
+
public Domain() {
}
@@ -175,6 +191,14 @@ public class Domain extends AbstractEntity {
"obj.user=:loginUser";
}
+ public String getValidsubdomainnames() {
+ return validsubdomainnames;
+ }
+
+ public void setValidsubdomainnames(String validSubdomainNames) {
+ this.validsubdomainnames = validSubdomainNames;
+ }
+
public Set getDomainoptions() {
return domainoptions;
}
@@ -183,12 +207,48 @@ public class Domain extends AbstractEntity {
this.domainoptions = domainOptions;
}
- public String getValidsubdomainnames() {
- return validsubdomainnames;
+ public String getPassengerpython() {
+ if (passengerpython == null) {
+ return "/usr/bin/python3";
+ }
+ return passengerpython;
}
- public void setValidsubdomainnames(String validSubdomainNames) {
- this.validsubdomainnames = validSubdomainNames;
+ public void setPassengerpython(String value) {
+ this.passengerpython = value;
+ }
+
+ public String getPassengernodejs() {
+ if (passengernodejs == null) {
+ return "/usr/bin/node";
+ }
+ return passengernodejs;
+ }
+
+ public void setPassengernodejs(String value) {
+ this.passengernodejs = value;
+ }
+
+ public String getPassengerruby() {
+ if (passengerruby == null) {
+ return "/usr/bin/ruby";
+ }
+ return passengerruby;
+ }
+
+ public void setPassengerruby(String value) {
+ this.passengerruby = value;
+ }
+
+ public String getFcgiphpbin() {
+ if (fcgiphpbin == null) {
+ return "/usr/lib/cgi-bin/php";
+ }
+ return fcgiphpbin;
+ }
+
+ public void setFcgiphpbin(String value) {
+ this.fcgiphpbin = value;
}
public String getServeraliases() {
diff --git a/qserv/src/main/java/de/hsadmin/mods/dom/DomainModuleImpl.java b/qserv/src/main/java/de/hsadmin/mods/dom/DomainModuleImpl.java
index 3a8c8c4..cca5ab9 100644
--- a/qserv/src/main/java/de/hsadmin/mods/dom/DomainModuleImpl.java
+++ b/qserv/src/main/java/de/hsadmin/mods/dom/DomainModuleImpl.java
@@ -30,6 +30,10 @@ public class DomainModuleImpl extends AbstractModuleImpl {
public static final String DOMOPT_LETSENCRYPT = "letsencrypt";
public static final String DOMOPT_AUTOCONFIG = "autoconfig";
public static final String DOMOPT_DKIM = "dkim";
+ public static final String DOMOPT_PASSENGER = "passenger";
+ public static final String DOMOPT_PASSENGERFRIENDLYERRORPAGES = "passengerfriendlyerrorpages";
+ public static final String DOMOPT_CGI = "cgi";
+ public static final String DOMOPT_FASTCGI = "fastcgi";
public static final String[] ALL_DOMOPTS =
new String[] {
@@ -41,18 +45,21 @@ public class DomainModuleImpl extends AbstractModuleImpl {
DOMOPT_BACKUPFOREXTERNALMX,
DOMOPT_LETSENCRYPT,
DOMOPT_AUTOCONFIG,
- DOMOPT_DKIM
+ DOMOPT_DKIM,
+ DOMOPT_PASSENGER,
+ DOMOPT_PASSENGERFRIENDLYERRORPAGES,
+ DOMOPT_CGI,
+ DOMOPT_FASTCGI
};
public static final String[] DEFAULT_DOMOPTS =
new String[] {
DOMOPT_GREYLISTING,
- DOMOPT_MULTIVIEWS,
DOMOPT_INDEXES,
DOMOPT_HTDOCSFALLBACK,
- DOMOPT_INCLUDES,
DOMOPT_LETSENCRYPT,
DOMOPT_AUTOCONFIG,
- DOMOPT_DKIM
+ DOMOPT_DKIM,
+ DOMOPT_FASTCGI
};
@Override
diff --git a/qserv/src/main/java/de/hsadmin/mods/dom/DomainOptionValues.java b/qserv/src/main/java/de/hsadmin/mods/dom/DomainOptionValues.java
index e2ff9d4..b856892 100644
--- a/qserv/src/main/java/de/hsadmin/mods/dom/DomainOptionValues.java
+++ b/qserv/src/main/java/de/hsadmin/mods/dom/DomainOptionValues.java
@@ -27,6 +27,10 @@ public class DomainOptionValues extends DefaultSelectableValues {
list.add(new BooleanListValue("letsencrypt"));
list.add(new BooleanListValue("autoconfig"));
list.add(new BooleanListValue("dkim"));
+ list.add(new BooleanListValue("passenger"));
+ list.add(new BooleanListValue("passengerfriendlyerrorpages"));
+ list.add(new BooleanListValue("cgi"));
+ list.add(new BooleanListValue("fastcgi"));
return list;
}
diff --git a/qserv/src/main/java/de/hsadmin/mods/dom/DomainProcessorFactory.java b/qserv/src/main/java/de/hsadmin/mods/dom/DomainProcessorFactory.java
index f7b5993..dfe9b84 100644
--- a/qserv/src/main/java/de/hsadmin/mods/dom/DomainProcessorFactory.java
+++ b/qserv/src/main/java/de/hsadmin/mods/dom/DomainProcessorFactory.java
@@ -106,7 +106,7 @@ public class DomainProcessorFactory implements EntityProcessorFactory {
new VelocityProcessor("/de/hsadmin/mods/dom/named-hsh-conf.vm",
templateVars, "/etc/bind/named-hsh.conf.tmp", true),
new ShellProcessor(" ( diff -q /etc/bind/named-hsh.conf.tmp /etc/bind/named-hsh.conf && rm /etc/bind/named-hsh.conf.tmp ) " +
- "|| ( mv /etc/bind/named-hsh.conf.tmp /etc/bind/named-hsh.conf && invoke-rc.d bind9 reload )")
+ "|| ( mv /etc/bind/named-hsh.conf.tmp /etc/bind/named-hsh.conf && systemctl reload bind9.service )")
);
}
@@ -173,7 +173,7 @@ public class DomainProcessorFactory implements EntityProcessorFactory {
new VelocityProcessor("/de/hsadmin/mods/dom/postgrey-whitelist-recipients.vm",
templateVars, "/etc/postgrey/whitelist_recipients.tmp", true),
new ShellProcessor(" ( diff -q /etc/postgrey/whitelist_recipients.tmp /etc/postgrey/whitelist_recipients && rm /etc/postgrey/whitelist_recipients.tmp ) " +
- "|| ( mv /etc/postgrey/whitelist_recipients.tmp /etc/postgrey/whitelist_recipients && invoke-rc.d postgrey reload )")
+ "|| ( mv /etc/postgrey/whitelist_recipients.tmp /etc/postgrey/whitelist_recipients && systemctl restart postgrey.service )")
);
}
@@ -237,10 +237,14 @@ public class DomainProcessorFactory implements EntityProcessorFactory {
new CreateFileProcessor("/de/hsadmin/mods/dom/index.html.vm", templateVars, dom, domainDir + "/subs-ssl/www/index.html", userName, pacName, "644", false)
);
domDirsProcessor.appendProcessor(
- new CopyFileProcessor("/usr/local/src/phpstub/phpstub", domainDir + "/fastcgi/phpstub", userName, pacName, "755")
+ new CopyFileProcessor("/usr/local/src/phpstub/hs-phpstub", domainDir + "/fastcgi/hs-phpstub", userName, pacName, "755")
);
domDirsProcessor.appendProcessor(
- new CopyFileProcessor("/usr/local/src/phpstub/phpstub", domainDir + "/fastcgi-ssl/phpstub", userName, pacName, "755")
+ new CopyFileProcessor("/usr/local/src/phpstub/hs-phpstub", domainDir + "/fastcgi-ssl/hs-phpstub", userName, pacName, "755")
+ );
+ domDirsProcessor.appendProcessor(
+ new ShellProcessor("chattr +i " + domainDir + "/fastcgi/hs-phpstub && " +
+ "chattr +i " + domainDir + "/fastcgi-ssl/hs-phpstub")
);
domDirsProcessor.appendProcessor(
new ShellProcessor("ln -sf " + domainDir + " /home/doms/ && " +
@@ -263,6 +267,14 @@ public class DomainProcessorFactory implements EntityProcessorFactory {
ifOption(templateVars, query, "htdocsfallback", Boolean.TRUE, Boolean.FALSE);
ifOption(templateVars, query, "letsencrypt", Boolean.TRUE, Boolean.FALSE);
ifOption(templateVars, query, "autoconfig", Boolean.TRUE, Boolean.FALSE);
+ ifOption(templateVars, query, "passenger", Boolean.TRUE, Boolean.FALSE);
+ ifOption(templateVars, query, "passengerfriendlyerrorpages", Boolean.TRUE, Boolean.FALSE);
+ ifOption(templateVars, query, "cgi", Boolean.TRUE, Boolean.FALSE);
+ ifOption(templateVars, query, "fastcgi", Boolean.TRUE, Boolean.FALSE);
+ setPathInTemplate(templateVars, "passengerpython", "/usr/bin/python3", dom.getPassengerpython());
+ setPathInTemplate(templateVars, "passengernodejs", "/usr/bin/node", dom.getPassengernodejs());
+ setPathInTemplate(templateVars, "passengerruby", "/usr/bin/ruby", dom.getPassengerruby());
+ setPathInTemplate(templateVars, "fcgiphpbin", "/usr/lib/cgi-bin/php", dom.getFcgiphpbin());
final boolean isSetLetsencryptOption = templateVars.get("letsencrypt").equals(Boolean.TRUE);
final Processor domSetupProcessor = new CompoundProcessor(
isSetLetsencryptOption ? new NullProcessor() : new ShellProcessor("rm -f /etc/apache2/pems-generated/" + domName + ".crt"),
@@ -287,11 +299,19 @@ public class DomainProcessorFactory implements EntityProcessorFactory {
" || (mv /etc/apache2/sites-available/" + domName + ".tmp /etc/apache2/sites-available/" + domName +
" && rm -f /etc/apache2/sites-enabled/" + linkPrefix + "-" + domName +
" && ln -sf /etc/apache2/sites-available/" + domName + " /etc/apache2/sites-enabled/" + linkPrefix + "-" + domName +
- " && invoke-rc.d apache2 reload >/dev/null 2>&1)")
+ " && systemctl reload apache2.service >/dev/null 2>&1)")
);
return domSetupProcessor;
}
+ private void setPathInTemplate(final Map templateVars, final String templateVariable, final String defaultPath, final String actualPath) {
+ String pathVariable = actualPath;
+ if (pathVariable == null || pathVariable.isEmpty()) {
+ pathVariable = defaultPath;
+ }
+ templateVars.put(templateVariable, pathVariable);
+ }
+
private void ifOption(Map templateVars, Query query, String option, Object optIsTrue, Object optIsFalse) {
query.setParameter("option", option);
if (query.getResultList().isEmpty()) {
@@ -320,8 +340,7 @@ public class DomainProcessorFactory implements EntityProcessorFactory {
" && mkdir " + homedir + "/doms.bak" +
" && mv " + homedir + "/doms/" + domname + " " + homedir + "/doms.bak/" +
" && chown -R " + username + ":" + username + " " + homedir + "/doms.bak" +
- // " && salt-call state.sls pacs " +
- " && invoke-rc.d apache2 reload >/dev/null 2>&1");
+ " && systemctl reload apache2.service >/dev/null 2>&1");
}
return
new ShellProcessor("rm -f /home/doms/" + domname +
@@ -333,8 +352,10 @@ public class DomainProcessorFactory implements EntityProcessorFactory {
" && rm -f /etc/apache2/pems-generated/" + domname + ".crt" +
" && rm -f /etc/apache2/pems-generated/" + domname + ".key" +
" && rm -f /etc/apache2/pems-generated/" + domname + ".chain" +
+ " && chattr -i " + homedir + "/doms/" + domname + "/fastcgi/hs-phpstub" +
+ " && chattr -i " + homedir + "/doms/" + domname + "/fastcgi-ssl/hs-phpstub" +
" && rm -rf " + homedir + "/doms/" + domname +
- " && invoke-rc.d apache2 reload >/dev/null 2>&1");
+ " && systemctl reload apache2.service >/dev/null 2>&1");
}
private Processor createTriggerAcmebotProcessor(final EntityManager em, final Domain dom) {
diff --git a/qserv/src/main/java/de/hsadmin/mods/pac/PacProcessorFactory.java b/qserv/src/main/java/de/hsadmin/mods/pac/PacProcessorFactory.java
index 40c9900..6ade622 100644
--- a/qserv/src/main/java/de/hsadmin/mods/pac/PacProcessorFactory.java
+++ b/qserv/src/main/java/de/hsadmin/mods/pac/PacProcessorFactory.java
@@ -113,7 +113,7 @@ public class PacProcessorFactory implements EntityProcessorFactory {
return new ShellProcessor("grep -v '\"pri." + domName + "\"' /etc/bind/named.pri-zones > /etc/bind/named.pri-zones.tmp" +
" && mv /etc/bind/named.pri-zones.tmp /etc/bind/named.pri-zones" +
" && rm -f /etc/bind/pri." + domName +
- " && invoke-rc.d bind9 reload");
+ " && systemctl reload named.service");
}
private Processor createAccountingRulesProc() {
@@ -142,13 +142,13 @@ public class PacProcessorFactory implements EntityProcessorFactory {
private Processor createLinkSiteProc(final String pacDomain) {
return new ShellProcessor("ln -sf /etc/apache2/sites-available/" + pacDomain + " /etc/apache2/sites-enabled/97-" + pacDomain
- + " && invoke-rc.d apache2 reload >/dev/null 2>&1");
+ + " && systemctl reload apache2.service >/dev/null 2>&1");
}
private Processor createUnlinkSiteProc(final String pacDomain) {
return new ShellProcessor("rm -f /etc/apache2/sites-enabled/97-" + pacDomain
+ " && rm -f /etc/apache2/sites-available/" + pacDomain + ""
- + " && invoke-rc.d apache2 reload >/dev/null 2>&1");
+ + " && systemctl reload apache2.service >/dev/null 2>&1");
}
private Processor createZonefileProc(final EntityManager em, final Pac pac) {
@@ -281,7 +281,7 @@ public class PacProcessorFactory implements EntityProcessorFactory {
new VelocityProcessor("/de/hsadmin/mods/dom/named-hsh-conf.vm",
templateVars, "/etc/bind/named-hsh.conf.tmp", true),
new ShellProcessor(" ( diff -q /etc/bind/named-hsh.conf.tmp /etc/bind/named-hsh.conf && rm /etc/bind/named-hsh.conf.tmp ) " +
- "|| ( mv /etc/bind/named-hsh.conf.tmp /etc/bind/named-hsh.conf && invoke-rc.d bind9 reload )")
+ "|| ( mv /etc/bind/named-hsh.conf.tmp /etc/bind/named-hsh.conf && systemctl reload bind9.service )")
);
}
diff --git a/util/pom.xml b/util/pom.xml
index 9a3de76..5ed41c6 100644
--- a/util/pom.xml
+++ b/util/pom.xml
@@ -7,7 +7,7 @@
4.0.15
UTF-8
- 11
+ 8
@@ -24,8 +24,8 @@
maven-compiler-plugin
3.11.0
-
- 11
+
+ 8