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.
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.
Comments