change email configuration
This commit is contained in:
parent
63a31ab23d
commit
71af063354
@ -48,10 +48,10 @@ public class DomainProcessorFactory implements EntityProcessorFactory {
|
||||
templateVars.put("DOM_IPNUMBEREX", getOldIPAddress(pac));
|
||||
WaitingTasksProcessor mainProcessor = new WaitingTasksProcessor(createHiveDNSSetupProcessor(domName, templateVars));
|
||||
mainProcessor.appendProcessor(hiveName, createHiveEMailSetupProcessor(em, domName), "Setup EMail");
|
||||
String hiveInetAddr = pac.getHive().getInetAddr().getInetAddr();
|
||||
String pacInetAddr = pac.getCurINetAddr().getInetAddr();
|
||||
Config config = Config.getInstance();
|
||||
for (String queueName : config.getProperty("queues.dns").split(",")) {
|
||||
mainProcessor.appendProcessor(queueName, createDNSServerSetupProcessor(domName, hiveInetAddr), queueName + ".hostsharing.net");
|
||||
mainProcessor.appendProcessor(queueName, createDNSServerSetupProcessor(domName, pacInetAddr), queueName + ".hostsharing.net");
|
||||
}
|
||||
for (String queueName : config.getProperty("queues.mail").split(",")) {
|
||||
mainProcessor.appendProcessor(queueName, createMailinSetupProcessor(em, domName, pac), queueName + ".hostsharing.net");
|
||||
@ -165,11 +165,10 @@ public class DomainProcessorFactory implements EntityProcessorFactory {
|
||||
);
|
||||
}
|
||||
|
||||
private Processor createDNSServerSetupProcessor(String domName,
|
||||
String hiveInetAddr) {
|
||||
private Processor createDNSServerSetupProcessor(String domName, String pacInetAddr) {
|
||||
Processor seczonesFileProcessor;
|
||||
seczonesFileProcessor =
|
||||
new ShellProcessor("echo 'zone \"" + domName + "\" { type slave; file \"sec." + domName + "\"; masters { " + hiveInetAddr + "; }; };' >>/etc/bind/named-hsh.conf" +
|
||||
new ShellProcessor("echo 'zone \"" + domName + "\" { type slave; file \"sec." + domName + "\"; masters { " + pacInetAddr + "; }; };' >>/etc/bind/named-hsh.conf" +
|
||||
" && sort /etc/bind/named-hsh.conf | uniq >/etc/bind/named-hsh.conf.tmp" +
|
||||
" && mv /etc/bind/named-hsh.conf.tmp /etc/bind/named-hsh.conf" +
|
||||
" && invoke-rc.d bind9 reload");
|
||||
@ -185,14 +184,15 @@ public class DomainProcessorFactory implements EntityProcessorFactory {
|
||||
}
|
||||
|
||||
private Processor createMailinSetupProcessor(EntityManager em, String domName, Pac pac) throws ProcessorException {
|
||||
String inetAddr = pac.getCurINetAddr().getInetAddr();
|
||||
return new CompoundProcessor(
|
||||
createPostgreyConfiguration(em),
|
||||
new ShellProcessor("postmap -r -i /etc/postfix-mailin/relaydomains",
|
||||
domName + " anything\n" +
|
||||
"." + domName + " anything\n"),
|
||||
new ShellProcessor("postmap -r -i /etc/postfix-mailin/transport",
|
||||
domName + " smtp:[" + pac.getName() + ".hostsharing.net]\n" +
|
||||
"." + domName + " smtp:[" + pac.getName() + ".hostsharing.net]\n")
|
||||
domName + " smtp:" + inetAddr + ":225\n" +
|
||||
"." + domName + " smtp:" + inetAddr + ":225\n")
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -12,24 +12,25 @@ import de.hsadmin.core.qserv.Processor;
|
||||
import de.hsadmin.core.qserv.ShellProcessor;
|
||||
import de.hsadmin.core.qserv.WaitingTasksProcessor;
|
||||
import de.hsadmin.core.util.Config;
|
||||
import de.hsadmin.mods.pac.Pac;
|
||||
|
||||
public class EMailAddressProcessorFactory implements EntityProcessorFactory {
|
||||
|
||||
public <T extends AbstractEntity> Processor createCreateProcessor(EntityManager em, T entity) {
|
||||
// TODO: combine both keys in a single call (optimization)
|
||||
EMailAddress email = (EMailAddress) entity;
|
||||
Pac pac = email.getDomain().getUser().getPac();
|
||||
CompoundProcessor cp = new CompoundProcessor();
|
||||
cp.appendProcessor(new ShellProcessor( "postmap -r -i /etc/postfix/virtual",
|
||||
cp.appendProcessor(new ShellProcessor( "postmap -r -i /etc/postfix-mailin/virtual",
|
||||
email.getFullDomain() + " -" ) );
|
||||
cp.appendProcessor(new ShellProcessor( "postmap -r -i /etc/postfix/virtual",
|
||||
cp.appendProcessor(new ShellProcessor( "postmap -r -i /etc/postfix-mailin/virtual",
|
||||
email.getEMailAddress() + " " + email.getTarget() ) );
|
||||
if (emailAddressCount(em, email) < 2) {
|
||||
WaitingTasksProcessor waitingTasksProcessor = new WaitingTasksProcessor(cp);
|
||||
String pacName = email.getDomain().getUser().getPac().getName();
|
||||
String domName = email.getDomain().getName();
|
||||
Config config = Config.getInstance();
|
||||
for (String queueName : config.getProperty("queues.mail").split(",")) {
|
||||
waitingTasksProcessor.appendProcessor(queueName, createMailinSetupProcessor(domName, pacName), queueName + ".hostsharing.net");
|
||||
waitingTasksProcessor.appendProcessor(queueName, createMailinSetupProcessor(domName, pac), queueName + ".hostsharing.net");
|
||||
}
|
||||
return waitingTasksProcessor;
|
||||
} else {
|
||||
@ -47,13 +48,13 @@ public class EMailAddressProcessorFactory implements EntityProcessorFactory {
|
||||
CompoundProcessor cp = new CompoundProcessor();
|
||||
EMailAddress email = (EMailAddress) entity;
|
||||
cp.appendProcessor(
|
||||
new ShellProcessor( "postmap -d '" + email.getEMailAddress() + "' /etc/postfix/virtual" ) );
|
||||
new ShellProcessor( "postmap -d '" + email.getEMailAddress() + "' /etc/postfix-mailin/virtual" ) );
|
||||
int emailAddressCount = emailAddressCount(em, email);
|
||||
if (emailAddressCount == 0) {
|
||||
// remove the domain from virtual.db
|
||||
String fullDomain = email.getFullDomain();
|
||||
cp.appendProcessor(
|
||||
new ShellProcessor( "postmap -d '" + fullDomain + "' /etc/postfix/virtual" ) );
|
||||
new ShellProcessor( "postmap -d '" + fullDomain + "' /etc/postfix-mailin/virtual" ) );
|
||||
WaitingTasksProcessor waitingTasksProcessor = new WaitingTasksProcessor(cp);
|
||||
Config config = Config.getInstance();
|
||||
for (String queueName : config.getProperty("queues.mail").split(",")) {
|
||||
@ -82,11 +83,12 @@ public class EMailAddressProcessorFactory implements EntityProcessorFactory {
|
||||
return result.size();
|
||||
}
|
||||
|
||||
private Processor createMailinSetupProcessor(String domName, String pacName) {
|
||||
private Processor createMailinSetupProcessor(String domName, Pac pac) {
|
||||
String inetAddr = pac.getCurINetAddr().getInetAddr();
|
||||
return
|
||||
new ShellProcessor("postmap -r -i /etc/postfix-mailin/transport",
|
||||
domName + " smtp:[" + pacName + ".hostsharing.net]\n" +
|
||||
"." + domName + " smtp:[" + pacName + ".hostsharing.net]\n");
|
||||
domName + " smtp:" + inetAddr + ":225\n" +
|
||||
"." + domName + " smtp:" + inetAddr + ":225\n");
|
||||
}
|
||||
|
||||
private Processor createMailinDeleteProcessor(String domName) {
|
||||
|
Loading…
Reference in New Issue
Block a user