diff --git a/hsarback/src/de/hsadmin/mods/dom/DomainProcessorFactory.java b/hsarback/src/de/hsadmin/mods/dom/DomainProcessorFactory.java index b395cb1..2365d08 100644 --- a/hsarback/src/de/hsadmin/mods/dom/DomainProcessorFactory.java +++ b/hsarback/src/de/hsadmin/mods/dom/DomainProcessorFactory.java @@ -48,16 +48,8 @@ public class DomainProcessorFactory implements EntityProcessorFactory { 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 @@ public class DomainProcessorFactory implements EntityProcessorFactory { 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 @@ public class DomainProcessorFactory implements EntityProcessorFactory { 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 @@ public class DomainProcessorFactory implements EntityProcessorFactory { 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 @@ public class DomainProcessorFactory implements EntityProcessorFactory { " && 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; }