• Our team is looking to connect with folks who use email services provided by Plesk, or a premium service. If you'd like to be part of the discovery process and share your experiences, we invite you to complete this short screening survey. If your responses match the persona we are looking for, you'll receive a link to schedule a call at your convenience. We look forward to hearing from you!
  • We are looking for U.S.-based freelancer or agency working with SEO or WordPress for a quick 30-min interviews to gather feedback on XOVI, a successful German SEO tool we’re looking to launch in the U.S.
    If you qualify and participate, you’ll receive a $30 Amazon gift card as a thank-you. Please apply here. Thanks for helping shape a better SEO product for agencies!
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

iptables rule to block all outgoing mail sent via perl (or other) scripts

StéphanS

Regular Pleskian
Mail should always be sent via qmail or Postfix.
In order to be able to track any spammers and to use Parallels Premium Outgoing Antispam.

I have created the following iptable rules to enforce this for Postfix:

iptables -A OUTPUT -d 127.0.0.1 -p tcp -m tcp --dport 25 -j ACCEPT
iptables -A OUTPUT -p tcp -m tcp --dport 25 -m owner --gid-owner postfix -j ACCEPT
iptables -A OUTPUT -p tcp -m tcp --dport 25 -m owner --gid-owner mailman -j ACCEPT
iptables -A OUTPUT -p tcp -m tcp --dport 25 -m owner --uid-owner root -j ACCEPT
iptables -A OUTPUT -p tcp -m tcp --dport 25 -j REJECT --reject-with icmp-port-unreachable


Would it be possible for the Plesk Firewall Module to have such a rule so we can better control the mailflow?


Thanks!
 
Mail should always be sent via qmail or Postfix.
In order to be able to track any spammers and to use Parallels Premium Outgoing Antispam.

I have created the following iptable rules to enforce this for Postfix:




Would it be possible for the Plesk Firewall Module to have such a rule so we can better control the mailflow?


Thanks!


Hello! My server was compromised with a ugly Perl script and spammed out tons of mails.
This IPTABLES rules come great for stopping them, have you tested them in qmail ?

Thanks for sharing.

Greetings!
 
Hello! My server was compromised with a ugly Perl script and spammed out tons of mails.
This IPTABLES rules come great for stopping them, have you tested them in qmail ?

Thanks for sharing.

Greetings!

For qmail it should be:

Code:
iptables -A OUTPUT -d 127.0.0.1 -p tcp -m tcp --dport 25 -j ACCEPT
iptables -A OUTPUT -p tcp -m tcp --dport 25 -m owner --gid-owner qmail -j ACCEPT
iptables -A OUTPUT -p tcp -m tcp --dport 25 -m owner --gid-owner mailman -j ACCEPT
iptables -A OUTPUT -p tcp -m tcp --dport 25 -m owner --uid-owner root -j ACCEPT
iptables -A OUTPUT -p tcp -m tcp --dport 25 -j REJECT --reject-with icmp-port-unreachable


I have not tested this though, so let me know if it worked for you!
 
Hi, a good idea
I've a question about these rules, could add a LOG, something like

-j LOG --log-prefix "Alert QMAIL-REJECTED"

in last rule for example?

Oh, and another question, does it work with qmail?

Thanks
 
Hi, a good idea
I've a question about these rules, could add a LOG, something like

-j LOG --log-prefix "Alert QMAIL-REJECTED"

in last rule for example?


If you have a LOG chain then this should work as intended.
Please refer to http://www.thegeekstuff.com/2012/08/iptables-log-packets/


Oh, and another question, does it work with qmail?


For qmail it should be:

Code:
iptables -A OUTPUT -d 127.0.0.1 -p tcp -m tcp --dport 25 -j ACCEPT
iptables -A OUTPUT -p tcp -m tcp --dport 25 -m owner --gid-owner qmail -j ACCEPT
iptables -A OUTPUT -p tcp -m tcp --dport 25 -m owner --gid-owner mailman -j ACCEPT
iptables -A OUTPUT -p tcp -m tcp --dport 25 -m owner --uid-owner root -j ACCEPT
iptables -A OUTPUT -p tcp -m tcp --dport 25 -j REJECT --reject-with icmp-port-unreachable


I have not tested this though, so let me know if it worked for you!
 
Last edited:
Thanks . I think these rules should enabled by default . I know here is linux thread but any equivalent rules for Windows ?
 
Back
Top