Compare commits

..

61 Commits

Author SHA1 Message Date
Peter Hormanns
ec484b222b calc ram option value from daemon option 2024-10-21 15:44:39 +02:00
Peter Hormanns
42dec2b87d calc ram option value from daemon option 2024-10-21 15:34:34 +02:00
Peter Hormanns
ca9215d5a1 sequence problem when creating domains fixed 2024-07-29 14:41:13 +02:00
Peter Hormanns
e8c256da9c Merge branch 'master' into TP-202311-vhost-bookworm 2024-04-17 16:38:41 +02:00
Timotheus Pokorra
79c653e910 Paths for Passenger Python, Ruby, Node and PHP should also support underscore characters 2024-04-16 22:13:57 +02:00
Peter Hormanns
69d9d87c9b available only on bookworm 2024-04-06 14:43:42 +02:00
Peter Hormanns
96c3396934 add Option PassengerPreloadBundler to apache vhosts 2024-03-25 18:52:56 +01:00
Peter Hormanns
e1db7a784f use systemctl instead of invoke-rc.d 2024-03-25 13:54:44 +01:00
Peter Hormanns
7a16ff9165 Option Includes replaces IncludesNoExec 2024-03-13 11:04:52 +01:00
Peter Hormanns
694b13bb55 avoid nullpointer in pillarservlet 2024-01-25 19:39:35 +01:00
Peter Hormanns
22a99e98a3 use hs-phpstub as phpstub 2024-01-25 18:01:43 +01:00
Peter Hormanns
b16ba63833 remove all cgi btw. fastcgi dependencies 2024-01-22 19:03:14 +01:00
Peter Hormanns
d95ebd4957 db migration: define useful default settings 2024-01-22 13:36:06 +01:00
Peter Hormanns
85271e0776 fix path to phpstub 2024-01-19 12:02:16 +01:00
Timotheus Pokorra
15ca8d9dd4 protect phpstub with chattr +i and drop chattr -i for deleting domain 2024-01-17 19:59:42 +01:00
Timotheus Pokorra
6e2db93a0f apache vhost: PHP: use FcgidInitialEnv and cgi-bin 2024-01-17 19:49:34 +01:00
Peter Hormanns
bf2a2a885e provide path variables to vhost template 2024-01-17 12:11:24 +01:00
Peter Hormanns
92be4acd7f Merge branch 'TP-202311-vhost-bookworm' of hsh04-dev@dev.hostsharing.net:hostsharing/hs.hsadmin.git into TP-202311-vhost-bookworm 2024-01-17 11:48:36 +01:00
Peter Hormanns
767f47fe7f apache-vhost review 2024-01-17 11:48:05 +01:00
73f47dfb47 Makefile: tomcat7 statt tomcatmq 2024-01-17 11:34:44 +01:00
Peter Hormanns
898aa24be6 Merge branch 'TP-202311-vhost-bookworm' of dev.hostsharing.net:hostsharing/hs.hsadmin into TP-202311-vhost-bookworm 2024-01-17 11:27:45 +01:00
Peter Hormanns
c87ef04330 new domainoption defaults 2024-01-17 11:26:11 +01:00
2268dcc595 Merge branch 'TP-202311-vhost-bookworm' of dev.hostsharing.net:hostsharing/hs.hsadmin into TP-202311-vhost-bookworm 2024-01-12 19:26:26 +01:00
Peter Hormanns
023509d2dd compile in java-8-compatibility mode 2024-01-12 19:16:26 +01:00
39789415a9 Merge branch 'TP-202311-vhost-bookworm' of dev.hostsharing.net:hostsharing/hs.hsadmin into TP-202311-vhost-bookworm 2024-01-12 18:35:32 +01:00
Peter Hormanns
83b7eba59e rollback activemq and openjpa updates 2024-01-12 18:34:35 +01:00
591abcc0fa Merge branch 'TP-202311-vhost-bookworm' of dev.hostsharing.net:hostsharing/hs.hsadmin into TP-202311-vhost-bookworm 2024-01-11 13:19:28 +01:00
Peter Hormanns
471e666215 Merge branch 'TP-202311-vhost-bookworm' of dev.hostsharing.net:hostsharing/hs.hsadmin into TP-202311-vhost-bookworm 2023-12-20 09:21:38 +01:00
Peter Hormanns
caffaaa2a4 Merge branch 'TP-202311-vhost-bookworm' of dev.hostsharing.net:hostsharing/hs.hsadmin into TP-202311-vhost-bookworm 2023-12-19 20:20:22 +01:00
Peter Hormanns
006eef9ab5 domain properties order 2023-12-19 20:20:16 +01:00
Timotheus Pokorra
0ca3cac465 copy hsar.war to tomcatmq after mvn package 2023-12-12 17:54:42 +01:00
Timotheus Pokorra
e2d6e75375 fix passengerfcgiphpbin to fcgiphpbin 2023-12-12 15:12:01 +01:00
Timotheus Pokorra
02e55ee7a3 small fix for default domain options 2023-12-12 14:56:32 +01:00
Peter Hormanns
c4bbde5984 rename setter and getter 2023-12-12 14:38:59 +01:00
Timotheus Pokorra
13316d265e use this 2023-12-12 11:53:25 +01:00
Timotheus Pokorra
9a6a6d094a Erweiterung der Tests um das Ändern von den neuen Domain Eigenschaften, z.B. PassengerPython 2023-12-12 11:52:39 +01:00
Timotheus Pokorra
643b23ad34 Vereinheitlichung der Tests von DomainOptionen 2023-12-12 11:01:19 +01:00
Timotheus Pokorra
fea2612a48 Teste die neuen Domain Optionen 2023-12-12 10:55:37 +01:00
Timotheus Pokorra
0941515461 Add Test for Updating Domain Properties and Domain Options 2023-12-12 00:32:36 +01:00
Timotheus Pokorra
9032f0d81c Makefile hinzufügen für oft auszuführende Operationen 2023-12-11 23:52:26 +01:00
Timotheus Pokorra
e57a3d7c84 fix typos 2023-12-11 17:28:22 +01:00
Timotheus Pokorra
864c21be13 proxy_http_port und proxy_websocket_port zurückgebaut 2023-12-11 17:21:10 +01:00
Timotheus Pokorra
237c6d49fb Undo Änderungen an hsarweb da es nicht mehr im Einsatz ist 2023-12-11 17:14:27 +01:00
Timotheus Pokorra
513431584e Add new domain properties PassengerPython, PassengerNodejs, PassengerRuby, FcgiPhpBin, ProxyHttpPort, ProxyWebsocketPort 2023-11-28 12:48:21 +01:00
Timotheus Pokorra
2c4af11660 Add new domain options passenger, passengerfriendlyerrorpages, cgi and fastcgi 2023-11-28 11:58:51 +01:00
Peter Hormanns
5004cab814 commit changes 2023-11-27 13:40:39 +01:00
Peter Hormanns
9661178687 auto_ack 2023-09-13 20:42:36 +02:00
Peter Hormanns
a8857091f9 auto_ack 2023-09-13 20:15:04 +02:00
Peter Hormanns
99f33b5b4b client_ack 2023-09-13 19:54:05 +02:00
Peter Hormanns
c530a65461 client_ack 2023-09-13 19:43:17 +02:00
Peter Hormanns
ad42d23545 fix nullpointer, initialize logger 2023-09-13 18:58:51 +02:00
Peter Hormanns
3733c49165 release v4.0.18 2023-09-07 13:13:15 +02:00
Peter Hormanns
f4457d5159 refactoring qserv config 2023-09-05 17:42:53 +02:00
Peter Hormanns
221aea2520 release 4.0.16 2023-09-05 12:17:38 +02:00
Peter Hormanns
4791781eeb null handling 2023-09-05 12:14:22 +02:00
Peter Hormanns
0b3385a3e0 null handling 2023-09-05 12:12:57 +02:00
Peter Hormanns
35862c1c06 null handling 2023-09-05 12:12:13 +02:00
Peter Hormanns
6e39b2e883 refactoring logging, config, error handling 2023-08-15 20:09:02 +02:00
Peter Hormanns
87efe77c78 revert activemq to v5.17.x 2023-08-14 20:41:24 +02:00
Peter Hormanns
9d09d43f3d some cleaning 2023-08-14 20:25:36 +02:00
Peter Hormanns
a85f0d1bec remove jndi config, new ValueObject TaskTransfer, v4.0.16 2023-08-14 20:16:47 +02:00
21 changed files with 551 additions and 236 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,2 @@
DROP VIEW ipconfig;
ALTER TABLE packet
ALTER COLUMN packet_name TYPE VARCHAR(6);
ALTER TABLE packet
ALTER COLUMN hive_id DROP NOT NULL;
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 component ( basepacket_id, basecomponent_id, admin_only, article_number, min_quantity, max_quantity, default_quantity, increment_quantity, include_quantity )
SELECT basepacket_id, basecomponent_id, false, 1023, 128, 10240, 128, 64, 0 from basepacket, basecomponent where basepacket_code='PAC/WEB' and basecomponent_code='RAM';

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

@ -5,14 +5,14 @@
<groupId>de.hsadmin</groupId>
<artifactId>hsar</artifactId>
<packaging>war</packaging>
<version>4.0.15</version>
<version>4.0.16</version>
<name>HSAdmin Stable Backend Webapp</name>
<url>http://maven.apache.org</url>
<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>
@ -36,12 +36,12 @@
<dependency>
<groupId>de.hsadmin.core</groupId>
<artifactId>hsadmin-util</artifactId>
<version>4.0.15</version>
<version>4.0.16</version>
</dependency>
<dependency>
<groupId>de.hsadmin.core</groupId>
<artifactId>hsadmin-qserv</artifactId>
<version>4.0.15</version>
<version>4.0.16</version>
</dependency>
<dependency>
<groupId>commons-httpclient</groupId>
@ -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(" ]");
@ -184,6 +200,19 @@ public class JsonPillarServlet extends HttpServlet {
int storage = pacStorage.getQuantity();
writer.println(" , \"storage\": " + storage);
}
final PacComponent pacDaemons = pac.getPacComponent("DAEMON");
int daemon = 0;
int ram = 16;
if (pacDaemons != null && pacDaemons.getQuantity() > 0) {
daemon = pacDaemons.getQuantity();
ram = daemon * 640;
}
writer.println(" , \"daemon\": " + daemon);
final PacComponent pacRAM = pac.getPacComponent("RAM");
if (pacRAM != null) {
ram = pacRAM.getQuantity();
}
writer.println(" , \"ram\": " + ram);
final PacComponent pacOffice = pac.getPacComponent("OFFICE");
if (pacOffice != null) {
int office = pacOffice.getQuantity();

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

@ -1,5 +1,9 @@
<Context path="/hsar" reloadable="true" crossContext="true">
<Valve className="org.apache.catalina.valves.ErrorReportValve"
showReport="false"
showServerInfo="false" />
<ResourceLink
name="jdbc/HSAdminDB"
global="jdbc/HSAdminDB"
@ -11,8 +15,18 @@
type="javax.jms.QueueConnectionFactory"/>
<ResourceLink
name="jms/hsadminSystem-h99"
global="jms/hsadminSystem-h99"
name="jms/hsadminSystem-h96"
global="jms/hsadminSystem-h96"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h97"
global="jms/hsadminSystem-h97"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h98"
global="jms/hsadminSystem-h98"
type="javax.jms.Queue"/>
<ResourceLink

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;
@ -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<String, String> whereParams = new HashMap<String, String>();
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<String, String> setParams = new HashMap<String, String>();
Map<String, String> whereParams = new HashMap<String, String>();
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<String, String> setParams = new HashMap<String, String>();
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<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();
@ -107,8 +231,8 @@ public class DomainTest {
Map<String, String> setParams = new HashMap<String, String>();
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<String, String>();
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<String, String> whereParams = new HashMap<String, String>();
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);

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

@ -4,16 +4,16 @@
<modelVersion>4.0.0</modelVersion>
<groupId>de.hsadmin.core</groupId>
<artifactId>hsadmin-qserv</artifactId>
<version>4.0.15</version>
<version>4.0.16</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>11</java.version>
<java.version>8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>de.hsadmin.core</groupId>
<artifactId>hsadmin-util</artifactId>
<version>4.0.15</version>
<version>4.0.16</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
@ -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>
@ -59,16 +59,16 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
<version>3.13.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,10 +66,22 @@ 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

@ -35,7 +35,11 @@ public class DomainProcessorFactory implements EntityProcessorFactory {
UnixUser domUser = dom.getUser();
Pac pac = domUser.getPac();
WaitingTasksProcessor mainProcessor = new WaitingTasksProcessor(
new CompoundProcessor(new ShellProcessor("salt-call state.sls pacs"))
new CompoundProcessor(
new ShellProcessor("salt-call state.sls pacs"),
createDomainDirectoriesProcessor(dom),
createApacheVHostSetupProcessor(em, dom)
)
);
Config config = Config.getInstance();
for (String queueName : config.getProperty("queues.dns").split(",")) {
@ -44,24 +48,23 @@ public class DomainProcessorFactory implements EntityProcessorFactory {
for (String queueName : config.getProperty("queues.mail").split(",")) {
mainProcessor.appendProcessor(queueName, createMailinSetupProcessor(em, dom, pac), queueName + ".hostsharing.net");
}
mainProcessor.appendProcessor(hiveName, createDomainDirectoriesProcessor(dom), "Setup Domain Directories");
mainProcessor.appendProcessor(hiveName, createApacheVHostSetupProcessor(em, dom), "Setup Apache VHost");
mainProcessor.appendProcessor(hiveName, createTriggerAcmebotProcessor(em, dom), "Trigger ACMEBot");
return mainProcessor;
}
public <T extends AbstractEntity> Processor createUpdateProcessor(final EntityManager em, final T entity) throws ProcessorException {
String hiveName = entity.getHiveName();
final Domain dom = (Domain) entity;
final UnixUser domUser = dom.getUser();
final Pac pac = domUser.getPac();
final Processor apacheVHostSetupProcessor = createApacheVHostSetupProcessor(em, dom);
final Processor triggerAcmebotProcessor = createTriggerAcmebotProcessor(em, dom);
final WaitingTasksProcessor processor = new WaitingTasksProcessor(
new CompoundProcessor(new ShellProcessor("salt-call state.sls pacs"), apacheVHostSetupProcessor, triggerAcmebotProcessor));
new CompoundProcessor(new ShellProcessor("salt-call state.sls pacs"), apacheVHostSetupProcessor));
final Config config = Config.getInstance();
for (String queueName : config.getProperty("queues.mail").split(",")) {
processor.appendProcessor(queueName, createMailinSetupProcessor(em, dom, pac), queueName + ".hostsharing.net");
}
processor.appendProcessor(hiveName, createTriggerAcmebotProcessor(em, dom), "Trigger ACMEBot");
return processor;
}
@ -106,7 +109,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 +176,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 +240,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 +270,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 +302,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 +343,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 +355,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

@ -4,10 +4,10 @@
<modelVersion>4.0.0</modelVersion>
<groupId>de.hsadmin.core</groupId>
<artifactId>hsadmin-util</artifactId>
<version>4.0.15</version>
<version>4.0.16</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>11</java.version>
<java.version>8</java.version>
</properties>
<dependencies>
<dependency>
@ -22,10 +22,10 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
<version>3.13.0</version>
<configuration>
<source>11</source>
<target>11</target>
<source>8</source>
<target>8</target>
</configuration>
</plugin>
</plugins>