HSAdmin Backend Domains, E-Mail, Datenbanken
Peter Hormanns
2011-05-19 7bf30a906f5216982b7a5f5fbe33a770df07e45f
aktuelle Version fuer mailin-Konfiguration uebernommen
1 files modified
30 ■■■■ changed files
hsarback/src/de/hsadmin/mods/dom/DomainProcessorFactory.java 30 ●●●● patch | view | raw | blame | history
hsarback/src/de/hsadmin/mods/dom/DomainProcessorFactory.java
@@ -48,16 +48,8 @@
            new ShellProcessor("echo 'zone \"" + domName + "\" { type master; file \"pri." + domName + "\"; };' >>/etc/bind/named.pri-zones" +
                " && sort /etc/bind/named.pri-zones | uniq >/etc/bind/named.pri-zones.tmp" +
                " && mv /etc/bind/named.pri-zones.tmp /etc/bind/named.pri-zones");
        // zone "zweisprech.de" { type slave; file "sec.zweisprech.de"; masters { 83.223.95.31; }; };
        String hiveInetAddr = pac.getHive().getInetAddr().getInetAddr();
        Processor smtpTransportsProcessor =
            new ShellProcessor("echo " + domName + " >> /etc/postfix/relaydomains" +
                    " && invoke-rc.d postfix reload");
        Processor dnsReloadProcessor =
            new ShellProcessor("invoke-rc.d bind9 reload");
        Processor dnsReloadProcessor = new ShellProcessor("invoke-rc.d bind9 reload");
        EMailAddressProcessorFactory eMailAddressProcessorFactory = new EMailAddressProcessorFactory();
        Processor dnsSetupProcessor = 
            new CompoundProcessor(zonefileTemplateProcessor, zonefileACLProcessor, prizonesFileProcessor, dnsReloadProcessor);
@@ -71,7 +63,6 @@
            emailAdrProcessor.appendProcessor(eMailAddressProcessorFactory.createCreateProcessor(em, eMailAddress));
        }
        mainProcessor.appendProcessor(hiveName, emailAdrProcessor, "Setup EMail");
        Processor seczonesFileProcessor = null; 
        String[] dnsServerQueues = { "dns1", "dns2", "dns3" };
        for (String queueName : dnsServerQueues) {
@@ -86,11 +77,16 @@
        Processor relayDomainsProcessor = null;
        String[] mailServerQueues = { "mail1", "mail2", "mail3" };
        for (String queueName : mailServerQueues) {
            relayDomainsProcessor = new ShellProcessor("postmap -r -i /etc/postfix/relaydomains", domName + " anything");
            relayDomainsProcessor = new ShellProcessor("postmap -r -i /etc/postfix-mailin/relaydomains", domName + " anything" + "\n." + domName + " anything");
            mainProcessor.appendProcessor(queueName, relayDomainsProcessor, queueName + ".hostsharing.net");
            relayDomainsProcessor = new ShellProcessor("postmap -r -i /etc/postfix-mailin/transport", domName + " smtp:[" + pac.getName() + ".hostsharing.net]\n." + domName + " smtp:[" + pac.getName() + ".hostsharing.net]\n.");
            mainProcessor.appendProcessor(queueName, relayDomainsProcessor, queueName + ".hostsharing.net");
        }
        
        mainProcessor.appendProcessor("backupmx", smtpTransportsProcessor, "backupmx.hostsharing.net");
        Processor backupMXSMTPTransportsProcessor =
            new ShellProcessor("echo " + domName + " >> /etc/postfix/relaydomains" +
                    " && invoke-rc.d postfix reload");
        mainProcessor.appendProcessor("backupmx", backupMXSMTPTransportsProcessor, "backupmx.hostsharing.net");
        String domsDir = domUser.getHomedir() + "/doms";
        String domainDir = domsDir + "/" + dom.getName();
        String[] subDirs = new String[] { "htdocs", "htdocs-ssl", "subs", "subs/www", "subs-ssl", "subs-ssl/www", "cgi", "fastcgi", "cgi-ssl", "fastcgi-ssl", "etc", "var" };
@@ -187,7 +183,10 @@
        Processor mailQueueProcessor = null; 
        String[] mailServerQueues = { "mail1", "mail2", "mail3" };
        for (String queueName : mailServerQueues) {
            mailQueueProcessor = new ShellProcessor("postmap -d '" + domName + "' /etc/postfix/relaydomains");
            mailQueueProcessor = new ShellProcessor("postmap -d '" + domName + "' /etc/postfix-mailin/relaydomains && " +
                    "postmap -d '" + domName + "' /etc/postfix-mailin/transport && " +
                    "postmap -d '." + domName + "' /etc/postfix-mailin/relaydomains && " +
                    "postmap -d '." + domName + "' /etc/postfix-mailin/transport");
            mainProcessor.appendProcessor(queueName, mailQueueProcessor, queueName + ".hostsharing.net");
        }
        
@@ -198,11 +197,12 @@
                " && rm /etc/apache2/sites-*/`ls -1 /etc/apache2/sites-enabled/ | egrep \"^[01]+-" + domName + "$\"`" +
                " && invoke-rc.d apache2 reload >/dev/null 2>&1");
        mainProcessor.appendProcessor(dom.getHiveName(), vhostDelProcessor, "remove apache vhost");
        Processor smtpRelayDelProcessor =
        Processor backupMXSMTPRelayDelProcessor =
            new ShellProcessor("grep -v " + domName + " /etc/postfix/relaydomains > /etc/postfix/relaydomains.tmp" +
                " && mv /etc/postfix/relaydomains.tmp /etc/postfix/relaydomains" +
                " && invoke-rc.d postfix reload");
        mainProcessor.appendProcessor("backupmx", smtpRelayDelProcessor, "backupmx.hostsharing.net");
        mainProcessor.appendProcessor("backupmx", backupMXSMTPRelayDelProcessor, "backupmx.hostsharing.net");
        return mainProcessor;
    }