implement greylisting domain option
This commit is contained in:
parent
3da879a57d
commit
a1d97ed10f
@ -155,6 +155,6 @@ INSERT INTO unixuser (name, comment, shell, homedir, locked, packet_id, userid)
|
|||||||
-- table: domain_option
|
-- table: domain_option
|
||||||
--
|
--
|
||||||
INSERT INTO domain_option (domain_option_name)
|
INSERT INTO domain_option (domain_option_name)
|
||||||
VALUES ('greylisting');
|
VALUES ('nogreylisting');
|
||||||
INSERT INTO domain_option (domain_option_name)
|
INSERT INTO domain_option (domain_option_name)
|
||||||
VALUES ('htdocsfallback');
|
VALUES ('nohtdocsfallback');
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package de.hsadmin.mods.dom;
|
package de.hsadmin.mods.dom;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -53,7 +54,7 @@ public class DomainProcessorFactory implements EntityProcessorFactory {
|
|||||||
mainProcessor.appendProcessor(queueName, createDNSServerSetupProcessor(domName, hiveInetAddr), queueName + ".hostsharing.net");
|
mainProcessor.appendProcessor(queueName, createDNSServerSetupProcessor(domName, hiveInetAddr), queueName + ".hostsharing.net");
|
||||||
}
|
}
|
||||||
for (String queueName : config.getProperty("queues.mail").split(",")) {
|
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 = new HashMap<String, String>();
|
||||||
templateVars.put("PAC", pacName);
|
templateVars.put("PAC", pacName);
|
||||||
@ -162,8 +163,19 @@ public class DomainProcessorFactory implements EntityProcessorFactory {
|
|||||||
" && invoke-rc.d bind9 reload");
|
" && 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(
|
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",
|
new ShellProcessor("postmap -r -i /etc/postfix-mailin/relaydomains",
|
||||||
domName + " anything\n" +
|
domName + " anything\n" +
|
||||||
"." + domName + " anything\n"),
|
"." + domName + " anything\n"),
|
||||||
|
@ -0,0 +1,11 @@
|
|||||||
|
<!-- BEGIN: main -->### Do not edit this file manually
|
||||||
|
### Generated by HSAdmin Queue Server
|
||||||
|
|
||||||
|
abuse@
|
||||||
|
postmaster@
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
|
||||||
|
<!-- BEGIN: iterate -->{DOM}
|
||||||
|
<!-- END: iterate -->
|
||||||
|
<!-- END: main -->
|
Loading…
Reference in New Issue
Block a user