Postfix issue with relay access denied – I HAVE READ ALL similar cases and tried almost everything

centos6dovecotpostfix

this is first time I set up a server from scratch and I consider myself a fast and good learner for new stuff, so I did my best to setup postfix with dovecot in CENTOS 6, so I'm getting relay access denied on my maillog:

warning: 187.167.4.199: hostname 187-167-4-199.static.axtel.net verification failed: Name or service not known
Jan 20 23:21:35 blkarl1 postfix/smtpd[18634]: connect from unknown[187.167.4.199]
Jan 20 23:22:04 blkarl1 postfix/smtpd[18634]: NOQUEUE: reject: RCPT from unknown[187.167.4.199]: 554 5.7.1 : Relay access denied; from= to= proto=SMTP
Jan 20 23:22:08 blkarl1 postfix/smtpd[18634]: disconnect from unknown[187.167.4.199]

postconf -n

alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
debug_peer_level = 2
home_mailbox = Maildir/
html_directory = no
inet_interfaces = all
inet_protocols = all
mail_owner = postfix
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
mydomain = domain.com
myhostname = mail.domain.com
mynetworks = 10.178.0.0/19, 127.0.0.0/8 # I HAVE NO IDEA ABOUT THIS
myorigin = $mydomain
newaliases_path = /usr/bin/newaliases.postfix
queue_directory = /var/spool/postfix
readme_directory = /usr/share/doc/postfix-2.6.6/README_FILES
relay_domains = 
sample_directory = /usr/share/doc/postfix-2.6.6/samples
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
unknown_local_recipient_reject_code = 550

dovecot -n

# 2.0.9: /etc/dovecot/dovecot.conf
disable_plaintext_auth = no
mail_location = maildir:~/Maildir
mbox_write_locks = fcntl
passdb {
  driver = pam
}
protocols = imap pop3
ssl = no
ssl_cert = </etc/pki/dovecot/certs/dovecot.pem
ssl_key = </etc/pki/dovecot/private/dovecot.pem
userdb {
  driver = passwd
}

I'm able to read my emails but I can't send email to anyone outside, can anyone take a quick look?

Best Answer

The default value not altered.
smtpd_recipient_restrictions = permit_mynetworks, reject_unauth_destination

You are not sending from $mynetworks.
You are not sending to mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain.

Perhaps you want:

smtpd_recipient_restrictions = permit_mynetworks permit_sasl_authenticated reject_unauth_destination
smtpd_tls_cert_file = /etc/ssl/postfix/cert.crt
smtpd_tls_key_file = /etc/ssl/postfix/key.key
smtpd_tls_CAfile = /etc/ssl/postfix/chain.crt
smtpd_tls_loglevel = 1
smtpd_tls_security_level = may
smtpd_tls_auth_only = yes

Modify cert values to be appropriate.

Setting up sasl is too variable to describe here, but http://www.postfix.org/SASL_README.html#server_dovecot should be a good start.

Related Topic