Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using Postfix (2.3.3) on CentOS (5.7). Right now, my server seems to be acting like an open relay. If I specify a login, it works fine, both unsecured and with TLS (however TLS nags me about the invalid certificate, but I guess I just have to get a certificate). That's what I want, if a client doesn't support TLS, then fallback to unsecured.

However, it seems that if I don't provide any login, it still sends email.

This is my configuration file:

command_directory = /usr/sbin
daemon_directory = /usr/libexec/postfix

myhostname =
mydomain =
myorigin = $mydomain
mydestination = $myhostname, $mydomain

unknown_local_recipient_reject_code = 550

mynetworks =

alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases

debug_peer_level = 2

debugger_command =
         xxgdb $daemon_directory/$process_name $process_id & sleep 5

sendmail_path = /usr/sbin/sendmail.postfix
newaliases_path = /usr/bin/newaliases.postfix
mailq_path = /usr/bin/mailq.postfix

setgid_group = postdrop
html_directory = no
manpage_directory = /usr/share/man
sample_directory = /usr/share/doc/postfix-2.3.3/samples
readme_directory = /usr/share/doc/postfix-2.3.3/README_FILES

virtual_alias_maps = hash:/etc/postfix/virtual
sender_bcc_maps = hash:/etc/postfix/bcc
mailbox_command = /usr/bin/procmail-wrapper -o -a $DOMAIN -d $LOGNAME
home_mailbox = Maildir/

smtpd_sasl_auth_enable = yes
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
broken_sasl_auth_clients = yes

smtpd_tls_key_file = /etc/pki/tls/private/
smtpd_tls_cert_file = /etc/pki/tls/certs/
smtpd_tls_loglevel = 1
smtpd_tls_session_cache_timeout = 3600s
smtpd_tls_session_cache_database = btree:/var/spool/postfix/smtpd_tls_cache
tls_random_source = dev:/dev/urandom
mailbox_size_limit = 0
notify_classes = bounce, delay, resource
smtpd_recipient_restrictions = reject_unauth_destination permit_sasl_authenticated permit_mynetworks check_relay_domains
smtpd_tls_security_level = may

Also, non-related to the first question, iPhone users get the following error (translated from French): "The recipient was rejected by the server because the relay is not allowed". I don't have an iPhone to test. Is it possible that the ISP blocks port 25 mail servers, as so many ISP do?

share|improve this question
Are you sending the "test" email from the same machine? Localhost = "mynetworks" which will eval to PERMIT – Tim Jan 18 '12 at 20:58
Clients (iPhone) should not be submitting e-mail to the server on port 25. Port 25 is for server to server communication only. Clients should submit on port 587 (the MSA port). – Chris S Jan 18 '12 at 21:11
@Tim I'm using a remote machine – jValdron Jan 19 '12 at 0:02
@ChrisS Should I not allow port 25 connections then? – jValdron Jan 19 '12 at 0:02
@jValdron If you're going to receive e-mail from other servers then you'll need 25 open. If you're only sending e-mail then yeah, you wouldn't need port 25. – Chris S Jan 19 '12 at 1:15
up vote 1 down vote accepted

Try changing the smtpd_recipient_restrictions line to this:

smtpd_recipient_restrictions = reject_unauth_destination, permit_sasl_authenticated, permit_mynetworks, check_relay_domains

I've tried to lookup the syntax but I always use , between values unless I place the values on separate lines (in which case the following parameters have to start with a whitespace) like:

smtpd_recipient_restrictions = reject_unauth_destination

Edit 1
A good tool to remotely test if a server is really an open relay is benefical to use, just to avoid mistakes or "false positives". This one tests a dozen or so various ways to relay, and will report to you if any of them works. Just type your IP adress in the box and click "Test":

share|improve this answer
Ummm, nope, still sends without authentication – jValdron Jan 19 '12 at 0:03
I see above that you try from a remote machine, but exactly how/what do you test to see that it still relays? And what is in your $relay_domains configuration (or in the /etc/postfix/relay_domains file if the variable points to that one)? – Mattias Ahnberg Jan 19 '12 at 0:15
I tried from a remote computer to and it does NOT relay for me. The only reason I can think it relays for you is if you test from an approved computer OR use the domain name the server is supposed to manage. – Mattias Ahnberg Jan 19 '12 at 0:16
Basically, I'm testing from home. The server is in co-location about 15 km from here. And the relay_domains file doesn't seem to exists. And the file variable is not set in my, odd. – jValdron Jan 19 '12 at 0:52
I should specify that my knowledge of mail servers is somewhat limited ;) – jValdron Jan 19 '12 at 0:53

For the 2nd question, you can verify if the port is open by using nmap to scan the host, or simply telnet hostname 25.

If the telnet responds with something to the tune of 220 mailserver_name ESMTP, then the port is open.

share|improve this answer
Yep, already tried telnet-ing, worked fine – jValdron Jan 19 '12 at 0:04

Your Answer


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.