is there an iptables rule to allow only email on port 25?

user3094719

Is there a way to block port 25 for everything but mail communication? Had no luck finding an answer to this yet. Maybe it's possible to block every application but those related to above usage?

I am using qmail, if that is important.

MariusMatutiae

I think you may be mixing different issues. If you have qmail running in standard configuration, it will be listening on port 25. You can check that with the command:

   sudo ss -lntp | grep 25 

This command will show you the process (the -p option) listening on port 25.

Now let us imagine that a different application from anther pc sends packets to your port 25: what is going to happen? Nothing, unless that application is asking exactly for qmail. So there is no need (and no possibility either) to bar applications on any given port. If some pc sends packet destined for an application X to a port where Y is listening, nothing will happen. So there is no need (and no possibility) to use iptables to bar applications.

If you do not believe me, just try to load a Web page from port 25, or to establish an ssh connection to it, and see what happens.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Open port 443 by adding a rule in iptables (Ubuntu)

Firebase database rule to only allow one record

Only allow ASCII characters in Email Validation with YUP

Set up firwall with iptables to only allow VPN

Ubuntu IPTables allow only allow 1 country

iptables rule to snat port and ip on AWS instance

IPTables rule to allow incoming SSH connections

How to configure iptables file to allow only specific ipaddress on all port and deny all other ipaddress?

How to allow only ssh and internet access with iptables?

Will an inbound iptables rule in ddwrt on port 443 break https?

How to allow only subnet for port with iptables

iptables rule doesn't work for port 80

how to remove iptables port mirroring rule

openvpn configure iptables to allow only port 80/443 and throttle all other

IPTables - Allow Docker port forwarding only for specific IP address

Port forward- Why is iptables with POSTROUTING rule required?

Allow only a specific ip address to an open port

iptables is blocking only some connections to port 80

Linux - iptables allow only 3 IPs

Iptables rule to allow only one port and block others

iptables rule to allow access to internet

iptables/pf rule to only allow XY application/user?

IPTABLES: Blocking port to external users only

iptables rule for incoming from certain ip and port

Port 25 not open, how send email?

Blocking port 25 with iptables (outbound only)

How do I allow only internal network to access a particular UDP Port using iptables

how to allow traffic on specific IPs for a port in iptables

AWS Allow only health checks on port 80