Forums

alahwany
alahwany
Offline
Resolved
0 votes
Hello,

i need to know how to test my rule for IPTABLE before adding it on custom firewall app ?

is there any way to put my rules in safe side and restart firewall service if it wrong i will delete it without any problem ?

thanks
Sunday, January 08 2017, 11:15 PM
Share this post:

Accepted Answer

Tuesday, January 10 2017, 09:44 PM - #Permalink
Resolved
1 votes
So, if you've changed your default rule to drop all, then all you need is allow rule(s):
iptables -I FORWARD -p tcp -m multiport --dports 25,110 -d your_permitted_ip -j ACCEPT
To test it, copy and paste it into your command line. If you get no errors they the syntax is OK. If it does what you want then the rule is probably OK. If you are happy with it, paste it into the custom firewall module.

BTW, if people are using Gmail/Hotmail are they doing it via the browser or a mail app? If it is by the browser (i.e webmail), you have a completely different issue for which you'll need something like the content filter or DNS poisoning.
The reply is currently minimized Show
Responses (6)
  • Accepted Answer

    Wednesday, January 11 2017, 12:29 PM - #Permalink
    Resolved
    1 votes
    Depending on your set up, you may also want to consider the following ports:

    995 POP3S
    143 IMAP
    993 IMAPS
    465 SMTPS
    587 STARTTLS
    Like
    1
    The reply is currently minimized Show
  • Accepted Answer

    alahwany
    alahwany
    Offline
    Wednesday, January 11 2017, 06:13 AM - #Permalink
    Resolved
    0 votes
    thank you very much.

    LAN users using mail app via smtp and pop3 not via browser.

    i will try your code and i think the rule will work fine.

    thank you very much.
    The reply is currently minimized Show
  • Accepted Answer

    alahwany
    alahwany
    Offline
    Tuesday, January 10 2017, 09:25 PM - #Permalink
    Resolved
    0 votes
    My Friend Nick;

    thanks for your help share info.

    my Egress firewall block all and i opened the smtp and pop only to make my users in lan network using mail service.

    but i need to make my user using smtp and pop3 for the company domain only because i found many users using gmail and hotmail and others
    so i need to make control and block all that by make the smtp and pop3 for just my company domain.

    so can you tell me what is the rule make smtp and pop3 for only my domain ?
    reminder my Egress firewall block all and i have opened the smtp and pop3 so i need from custom firewall to add rule to make the smtp and pop3 for specific domain.

    also i need to know how to test the rule via command before added it in custom rule.

    thank you very much
    The reply is currently minimized Show
  • Accepted Answer

    Tuesday, January 10 2017, 01:31 PM - #Permalink
    Resolved
    1 votes
    By default the Egress firewall is open. Have you changed the default operation?

    If you use an external provider for your smtp and pop and you want to block access to anywhere else you can probably do it with a single complex rule for anyone on your LAN:
    iptables -I FORWARD -p tcp -m multiport --dports 25,110 ! -d your_permitted_ip -j DROP
    but test it first. It might be ambitious doing it in a single rule. It won't work with multiple IP's. If you have multiple IP's you'll need a general block rule followed by specific allow rules.

    Iptables by domain are a bad idea if the domain resolves to more than one IP address and name resolution only happens when the firewall is loaded and never again. If the name resolves to a different IP when the user comes to access the domain, the firewall will not see the rule.
    The reply is currently minimized Show
  • Accepted Answer

    alahwany
    alahwany
    Offline
    Monday, January 09 2017, 10:12 PM - #Permalink
    Resolved
    0 votes
    thank you eng. Nick for reply.

    can you tell me how to test it via command ?

    because i need to make allow for pop3 & smtp for specific domain and the Egress Firewall allow outgoing for all domains.

    so can you help me for that ?
    The reply is currently minimized Show
  • Accepted Answer

    Monday, January 09 2017, 12:29 PM - #Permalink
    Resolved
    1 votes
    The best place to try any rules out is at the command line. Any rules added there automatically get wiped if the firewall is restarted. You will also be able to see if there are any error messages.
    The reply is currently minimized Show
Your Reply