diff --git a/hsarback/database/data.sql b/hsarback/database/data.sql index 9372b06..dd710b6 100644 --- a/hsarback/database/data.sql +++ b/hsarback/database/data.sql @@ -155,6 +155,6 @@ INSERT INTO unixuser (name, comment, shell, homedir, locked, packet_id, userid) -- table: domain_option -- INSERT INTO domain_option (domain_option_name) - VALUES ('greylisting'); + VALUES ('nogreylisting'); INSERT INTO domain_option (domain_option_name) - VALUES ('htdocsfallback'); + VALUES ('nohtdocsfallback'); diff --git a/hsarback/src/de/hsadmin/mods/dom/DomainProcessorFactory.java b/hsarback/src/de/hsadmin/mods/dom/DomainProcessorFactory.java index cdc4598..79eac77 100644 --- a/hsarback/src/de/hsadmin/mods/dom/DomainProcessorFactory.java +++ b/hsarback/src/de/hsadmin/mods/dom/DomainProcessorFactory.java @@ -1,5 +1,6 @@ package de.hsadmin.mods.dom; +import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -53,7 +54,7 @@ public class DomainProcessorFactory implements EntityProcessorFactory { mainProcessor.appendProcessor(queueName, createDNSServerSetupProcessor(domName, hiveInetAddr), queueName + ".hostsharing.net"); } for (String queueName : config.getProperty("queues.mail").split(",")) { - mainProcessor.appendProcessor(queueName, createMailinSetupProcessor(domName, pac), queueName + ".hostsharing.net"); + mainProcessor.appendProcessor(queueName, createMailinSetupProcessor(em, domName, pac), queueName + ".hostsharing.net"); } templateVars = new HashMap(); templateVars.put("PAC", pacName); @@ -162,8 +163,19 @@ public class DomainProcessorFactory implements EntityProcessorFactory { " && invoke-rc.d bind9 reload"); } - private Processor createMailinSetupProcessor(String domName, Pac pac) { + private Processor createMailinSetupProcessor(EntityManager em, String domName, Pac pac) throws ProcessorException { + ArrayList> domsMaps = new ArrayList>(); + Query query = em.createQuery("SELECT d FROM Domains d WHERE d.domainoptions.name = :option"); + query.setParameter("option", "nogreylisting"); + List result = query.getResultList(); + for (Domain dom : result) { + HashMap hashMap = new HashMap(); + domsMaps.add(hashMap); + } return new CompoundProcessor( + new TemplateProcessor("/de/hdsadmin/mods/dom/postgrey-whitelist-recipients.jtpl", + hashMap, domsMaps.iterator(), "/etc/postgeay/whitelist_recipients", true), + new ShellProcessor("invoke-rc.d postgrey reload"), new ShellProcessor("postmap -r -i /etc/postfix-mailin/relaydomains", domName + " anything\n" + "." + domName + " anything\n"), diff --git a/hsarback/src/de/hsadmin/mods/dom/postgrey-whitelist-recipients.jtpl b/hsarback/src/de/hsadmin/mods/dom/postgrey-whitelist-recipients.jtpl new file mode 100644 index 0000000..e787e1c --- /dev/null +++ b/hsarback/src/de/hsadmin/mods/dom/postgrey-whitelist-recipients.jtpl @@ -0,0 +1,11 @@ +### Do not edit this file manually +### Generated by HSAdmin Queue Server + +abuse@ +postmaster@ + +################################################################################ + +{DOM} + +