LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   preventing postfix from listening on port 25 (https://www.linuxquestions.org/questions/linux-server-73/preventing-postfix-from-listening-on-port-25-a-611824/)

tklima 01-07-2008 02:47 PM

preventing postfix from listening on port 25
 
Hi,

how can I prevent postfix from listening on port 25? I want postfix to be used for sending mails from the local system only, not as a mail server.

I am running Debian (2.6.18-5)

Thanks for you help.

acid_kewpie 01-07-2008 02:54 PM

it will always need to listen on 25 locally, but you can stop it listening externally by using the inet_interfaces option, e.g. "inet_interfaces=localhost" in your main.cf

trickykid 01-07-2008 04:12 PM

Or just use iptables to block all incoming or outside port 25 requests outside of your local network. Allow outgoing though.

zoranp 01-07-2008 05:04 PM

Or just do not run postfix in daemon mode.

Eduardo Nunes 08-30-2010 11:55 AM

Quote:

Originally Posted by tklima (Post 3014735)
Hi,

how can I prevent postfix from listening on port 25? I want postfix to be used for sending mails from the local system only, not as a mail server.

I am running Debian (2.6.18-5)

Thanks for you help.

If you want to use the "sendmail" command to send emails, you may comment out the smtp inet n - n - 1000 smtpd line at master.cf

You can also block out the port 25 for incoming connections with iptables.

# iptables -I INPUT -p tcp --dport 25 -j DROP

Berhanie 08-30-2010 12:06 PM

You might consider putting this in main.cf:
Code:

inet_interfaces = loopback-only
This causes the postfix smtpd to listen only on the loopback interface, making connections from external hosts impossible. You should read the STANDARD_CONFIGURATION_README and its prerequisites.
[edit]i see acid_kewpie already gave the same advice. just add my vote to his reponse.[/edit]


All times are GMT -5. The time now is 10:07 AM.