Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I want to setup an outgoing only SMTP server on Debian, so my Web-applications will be able to send e-mails via it. I don't want to use another hosts because of security and customizability of my own setup.

I wish to install Postfix and configure it only in the outgoing mode (I don't want it to be a relay). So I want to ask an advice how to do it in the best way. There's no need in users, virtual users, endpoints and other options Postfix provides. I suppose I should only attach Postfix to some hostname, so my IP address can resolve to it.

I also think Postfix can be a bit complicated solution for this task. If you know much simpler tool for it, let me know.

share|improve this question
add comment

5 Answers

up vote 7 down vote accepted

To setup Postfix on Debian for outgoing mail only:

  • dpkg-reconfigure postfix (Select internet mail when prompted)
  • postconf -e 'inet_interfaces = 127.0.0.1'
  • /etc/init.d/postfix restart

inet_interfaces = 127.0.0.1 in /etc/postfix/main.cf will bind Postfix to localhost only, so your machine won't accept incoming email.

share|improve this answer
    
Thanks. Next time I'll read manuals accurately. –  Daniel Mar 16 '10 at 6:24
    
Did you mean, Internet Site? There's no Internet mail option in the config. Or has it changed since? –  its_me Feb 10 '13 at 15:31
add comment

Personally I prefer Exim, though Postfix should work.

I can give you a quick set of instructions about how to setup Exim for Outgoing only.

  • Make sure the hostname is setup correctly
  • Install apt-get install exim4 exim4-daemon-light
  • At the configuration step answer the questions this way
    • Type of mail configuration: Internet site
    • System name: the fqdn for your server
    • IP-Address to listen on: 127.0.0.1 (with this address incoming mail is not possible)
    • Other destinations which is accepted: empty
    • Domains to relay for: empty
    • machines to relay for: empty
    • Keep DNS minimal: yes
    • Delivery method for local mail: Maildir
    • Yes Split configs

Once exim is already configured you can run though this setup again by using the command dpkg-reconfigure exim4-config

If you are really paranoid you can also setup a quick iptables firewall on your mail server and simply not allow incoming connections to port 25.

share|improve this answer
add comment

Regardless of which mail server you choose, if you block incoming connections to ports 25 and 587, outside users will not be able to relay through it.

The SMTP server needs to make outbound connections to port 25 but does not need to accept inbound connections from other hosts.

You may want to accept port 25 connections from localhost, which is convenient for any web apps running locally; and, as an additional security measure ensure that the server is bound only to the lo1 or localhost interface (see James's answer).

share|improve this answer
add comment

two words: apt-get install ssmtp

(hum... was that three words?)

share|improve this answer
    
maybe even four... –  Jon Rhoades Mar 16 '10 at 5:22
add comment

I'm not sure I understand what it is you're looking for, but by default, Postini does everything you want.

Just make sure there's no SMTP restrictions on your Internet connection and that your DNS is working properly.

share|improve this answer
1  
Maybe my question was too bad to understand. I'll try again: I need some SMTP server software (or Postfix configuration advices) for Debian that will only be able to send mail from local applications. It's not supposed that it'll be used to receive any mail. Only outgoing work and only for localhost. –  Daniel Mar 15 '10 at 21:20
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.