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 have almost default configuration of Postfix

How can I configure Postfix to ask for username/password before relaying mail from other than "mynetworks" IP's?

Thank You very much

share|improve this question

2 Answers 2

up vote 1 down vote accepted

So SASL on postfix is a pain to configure.

The magic lines are:

# main.cf
# In each of these:
smtpd_*_restrictions = permit_mynetworks, permit_sasl_authenticated, ...
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
smtpd_sasl_local_domain = $myhostname
smtpd_sasl_authenticated_header = yes
broken_sasl_auth_clients = yes

You need TLS to ensure data security, the files are a standard SSL key pair:

smtpd_tls_cert_file=PEM-FILE-NAME
smtpd_tls_key_file=KEY-FILE-NAME
smtpd_use_tls = yes

You'll also want to listen on the SMTP submission port, that needs something like:

submission inet n       -       -       -       -       smtpd
  -o smtpd_enforce_tls=yes
  -o smtpd_client_restrictions=permit_sasl_authenticated,reject

Actually configuring the SASL backend is highly dependent on what your authentication source is, so I'd need for info to suggest on that.

share|improve this answer
    
Thank You very much for your answer –  Daniil Harik Apr 10 '10 at 14:19

What you are looking for is Postfix with SASL Authentication. You will need the Cyrus SASL library to authenticate your users but it's also possible to use dovecot for that.

Dovecot is my favorite, most likely you need an POP3/IMAP (and LDA) service anyway. With dovecot it's very easy to authenticate your users against the same database as your POP3/IMAP users. Postfix.org has a guide on how to setup Postfix / SASL with Dovecot / Cyrus: http://www.postfix.org/SASL_README.html.

share|improve this answer

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.