New domain options and properties for Debian Bookworm #1

Closed
hsh-timotheuspokorra wants to merge 41 commits from TP-202311-vhost-bookworm into rel_4.0
20 changed files with 521 additions and 219 deletions

40
Makefile Normal file
View File

@ -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//\-/_}

View File

@ -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

View File

@ -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';
UPDATE packet SET packet_name='vm10' || substr(packet_name,4,2) WHERE packet_name LIKE 'srv%';
INSERT INTO domain_option (domain_option_name) VALUES
('passenger'),
('passengerfriendlyerrorpages'),
('cgi'),
('fastcgi');
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;

View File

@ -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
);

View File

@ -11,8 +11,8 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>
<profiles>
<profile>
@ -70,13 +70,13 @@
</dependency>
<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity-engine-core</artifactId>
<version>2.3</version>
<artifactId>velocity</artifactId>
<version>1.7</version>
</dependency>
<dependency>
<groupId>org.apache.openjpa</groupId>
<artifactId>openjpa</artifactId>
<version>3.2.2</version>
<version>2.4.3</version>
</dependency>
<dependency>
<groupId>junit</groupId>
@ -93,7 +93,7 @@
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-all</artifactId>
<version>5.18.1</version>
<version>5.5.0</version>
<scope>provided</scope>
</dependency>
<dependency>
@ -116,8 +116,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
<configuration>
<source>11</source>
<target>11</target>
<source>8</source>
<target>8</target>
</configuration>
</plugin>
</plugins>

View File

@ -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

View File

@ -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(" ]");

View File

@ -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<NameClassPair> 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 {

View File

@ -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
<Directory />
PassengerEnabled Off
@ -26,21 +30,42 @@
</Directory>
<Directory /home/doms/${dom.name}/>
#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
</Directory>
#if( ${cgi} )
<Location /cgi-bin/>
PassengerEnabled Off
SetHandler cgi-script
Options +ExecCGI +IncludesNoExec -Indexes -MultiViews +SymLinksIfOwnerMatch
Options +ExecCGI +Includes -Indexes -MultiViews +SymLinksIfOwnerMatch
</Location>
#end
#if( ${fastcgi} )
<Location /fastcgi-bin/>
PassengerEnabled Off
SetHandler fcgid-script
Options +ExecCGI +IncludesNoExec -Indexes -MultiViews +SymLinksIfOwnerMatch
Options +ExecCGI +Includes -Indexes -MultiViews +SymLinksIfOwnerMatch
</Location>
#end
#if( ${autoconfig} )
<Location /autodiscover/autodiscover.xml>
@ -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
</VirtualHost>
<VirtualHost ${pac.curINetAddr.inet4Addr}:443 ${pac.oldINetAddr.inet4Addr}:443 [${pac.curINetAddr.inet6Addr}]:443 [${pac.oldINetAddr.inet6Addr}]:443>
@ -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
<Directory />
SSLRequireSSL On
@ -104,21 +142,42 @@
</Directory>
<Directory /home/doms/${dom.name}/>
#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
</Directory>
#if( ${cgi} )
<Location /cgi-bin/>
PassengerEnabled Off
SetHandler cgi-script
Options +ExecCGI +IncludesNoExec -Indexes -MultiViews +SymLinksIfOwnerMatch
Options +ExecCGI +Includes -Indexes -MultiViews +SymLinksIfOwnerMatch
</Location>
#end
#if( ${fastcgi} )
<Location /fastcgi-bin/>
PassengerEnabled Off
SetHandler fcgid-script
Options +ExecCGI +IncludesNoExec -Indexes -MultiViews +SymLinksIfOwnerMatch
Options +ExecCGI +Includes -Indexes -MultiViews +SymLinksIfOwnerMatch
</Location>
#end
#if( ${autoconfig} )
<Location /autodiscover/autodiscover.xml>
@ -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
</VirtualHost>

View File

@ -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;
@ -61,7 +62,7 @@ public class DomainTest {
}
@Test
public void testUpdate() {
public void testUpdateWithoutPermissionFail() {
String user = "aaa00";
String grantingTicketURL = cas.getGrantingTicketURL(user);
Map<String, String> setParams = new HashMap<String, String>();
@ -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<String, Object> setParams = new HashMap<String, Object>();
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<String, String> whereParams = new HashMap<String, String>();
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<String, Object>();
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<String, String>();
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();

14
qserv/hsadmin.properties Normal file
View File

@ -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

View File

@ -7,7 +7,7 @@
<version>4.0.15</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>11</java.version>
<java.version>8</java.version>
</properties>
<dependencies>
<dependency>
@ -27,13 +27,13 @@
</dependency>
<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity-engine-core</artifactId>
<version>2.3</version>
<artifactId>velocity</artifactId>
<version>1.7</version>
</dependency>
<dependency>
<groupId>org.apache.openjpa</groupId>
<artifactId>openjpa</artifactId>
<version>3.2.2</version>
<version>2.4.3</version>
</dependency>
<dependency>
<groupId>junit</groupId>
@ -44,7 +44,7 @@
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-all</artifactId>
<version>5.18.1</version>
<version>5.5.0</version>
<scope>provided</scope>
</dependency>
<dependency>
@ -61,14 +61,14 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
<configuration>
<source>11</source>
<target>11</target>
<source>8</source>
<target>8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.openjpa</groupId>
<artifactId>openjpa-maven-plugin</artifactId>
<version>3.2.2</version>
<version>2.4.3</version>
<configuration>
<includes>
**/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 @@
</executions>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>
org.apache.openjpa
</groupId>
<artifactId>
openjpa-maven-plugin
</artifactId>
<versionRange>
[2.4.3,)
</versionRange>
<goals>
<goal>enhance</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>

View File

@ -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);
}

View File

@ -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);

View File

@ -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,9 +66,21 @@ public class Domain extends AbstractEntity {
inverseJoinColumns={@JoinColumn(name="domain_option_id", referencedColumnName="domain_option_id")})
private Set<DomainOption> 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<DomainOption> 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() {

View File

@ -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

View File

@ -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;
}

View File

@ -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<String, Object> 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<String, Object> 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) {

View File

@ -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 )")
);
}

View File

@ -7,7 +7,7 @@
<version>4.0.15</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>11</java.version>
<java.version>8</java.version>
</properties>
<dependencies>
<dependency>
@ -24,8 +24,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
<configuration>
<source>11</source>
<target>11</target>
<source>8</source>
<target>8</target>
</configuration>
</plugin>
</plugins>