HSAdmin Backend Domains, E-Mail, Datenbanken
Peter Hormanns
2019-10-23 85ea7c6544da3aa8c733bbee1ade52edb8cb052f
do not remove pacdomain
1 files modified
29 ■■■■ changed files
hsarback/src/de/hsadmin/mods/dom/DomainProcessorFactory.java 29 ●●●● patch | view | raw | blame | history
hsarback/src/de/hsadmin/mods/dom/DomainProcessorFactory.java
@@ -73,17 +73,19 @@
        final Domain dom = (Domain) entity;
        final String domName = dom.getName();
        final WaitingTasksProcessor mainProcessor = new WaitingTasksProcessor(                         
                createHiveDNSRemoveProcessor(domName)
                createACMEBotProcessor(em, dom)
            );
        final Config config = Config.getInstance();
        for (String queueName : config.getProperty("queues.dns").split(",")) {
            mainProcessor.appendProcessor(queueName, createDNSServerConfigProcessor(em), queueName + ".hostsharing.net");
        }
        for (String queueName : config.getProperty("queues.mail").split(",")) {
            mainProcessor.appendProcessor(queueName, createMailinUnsetupProcessor(em, dom), queueName + ".hostsharing.net");
        }
        mainProcessor.appendProcessor(dom.getHiveName(), createApacheVHostDeleteProcessor(dom), "remove apache vhost");
        mainProcessor.appendProcessor(dom.getHiveName(), createACMEBotProcessor(em, dom), "remove letsencrypt config");
        if (!dom.isPacDomain()) {
            for (String queueName : config.getProperty("queues.dns").split(",")) {
                mainProcessor.appendProcessor(queueName, createDNSServerConfigProcessor(em), queueName + ".hostsharing.net");
            }
            mainProcessor.appendProcessor(dom.getHiveName(), createHiveDNSRemoveProcessor(domName), "remove from hive dns");
        }
        return mainProcessor;
    }
@@ -351,7 +353,21 @@
        final String domName = dom.getName();
        final int level = domName.split("\\.").length;
        final String linkPrefix = Integer.toString(100 - level);
        final Processor vhostDelProcessor =
        if (dom.isPacDomain()) {
            return
                new ShellProcessor("rm -f /home/doms/" + domName +
                        " && rm -f /etc/apache2/sites-enabled/" + linkPrefix + "-" + domName +
                        " && rm -f /etc/apache2/sites-available/" + domName +
                        " && rm -f /etc/apache2/pems-enabled/" + domName + ".crt" +
                        " && rm -f /etc/apache2/pems-enabled/" + domName + ".key" +
                        " && rm -f /etc/apache2/pems-enabled/" + domName + ".chain" +
                        " && rm -f /etc/apache2/pems-generated/" + domName + ".crt" +
                        " && rm -f /etc/apache2/pems-generated/" + domName + ".key" +
                        " && rm -f /etc/apache2/pems-generated/" + domName + ".chain" +
                        " && chown -R " + dom.getUser() + ":" + dom.getUser() + " " + dom.getUser().getHomedir() + "/doms/" + domName +
                        " && invoke-rc.d apache2 reload >/dev/null 2>&1");
        }
        return
            new ShellProcessor("rm -f /home/doms/" + domName +
                " && rm -f /etc/apache2/sites-enabled/" + linkPrefix + "-" + domName +
                " && rm -f /etc/apache2/sites-available/" + domName +
@@ -363,7 +379,6 @@
                " && rm -f /etc/apache2/pems-generated/" + domName + ".chain" +
                " && rm -rf " + dom.getUser().getHomedir() + "/doms/" + domName +
                " && invoke-rc.d apache2 reload >/dev/null 2>&1");
        return vhostDelProcessor;
    }
    private Processor createTriggerAcmebotProcessor(final EntityManager em, final Domain dom) {