I'm trying to limit my server's open ports in CSF. The IPv4 port settings include:
# Allow incoming TCP ports
TCP_IN = "22,25,53,80,110,143,443,587,3654,53343”
# Allow outgoing TCP ports
TCP_OUT = "22,53,80,113,443,465,995,3654"
# Allow incoming UDP ports
UDP_IN = "53"
# Allow outgoing UDP ports
# To allow outgoing traceroute add 33434:33523 to this list
UDP_OUT = "53,113,123"
As you see, I have port 25 open in TCP_IN but have removed it from TCP_OUT. The reason is I wanted to have my mails transmitted over smtps, so I have port 465 opened instead in TCP_OUT. Since I am using Rouncube in Directpanel, I have also set the following in Rouncube's config.inc.php:
$config['default_host'] = 'ssl://mail.mydomain.com';
$config['smtp_server'] = 'ssl://mail.mydomain.com';
$config['smtp_port'] = 465;
However, when I remove port 25 from TCP_OUT, I no longer can send mails, say, to gmail, though I can send mails to own. But I can receive all mails.
Please let me know if I need to make any further changes. Do I need to disable port 25 at all, to have my mails sent via ssl.
Thanks