| | |
| | | package de.hsadmin.mods.dom; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | 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<String, String>(); |
| | | templateVars.put("PAC", pacName); |
| | |
| | | " && invoke-rc.d bind9 reload"); |
| | | } |
| | | |
| | | private Processor createMailinSetupProcessor(String domName, Pac pac) { |
| | | private Processor createMailinSetupProcessor(EntityManager em, String domName, Pac pac) throws ProcessorException { |
| | | ArrayList<Map<String, String>> domsMaps = new ArrayList<Map<String, String>>(); |
| | | Query query = em.createQuery("SELECT d FROM Domains d WHERE d.domainoptions.name = :option"); |
| | | query.setParameter("option", "nogreylisting"); |
| | | List<Domain> result = query.getResultList(); |
| | | for (Domain dom : result) { |
| | | HashMap<String, String> hashMap = new HashMap<String, String>(); |
| | | 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"), |