LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   SOLVED postfix error Relay access denied. trying to setup virtual domains (https://www.linuxquestions.org/questions/linux-networking-3/solved-postfix-error-relay-access-denied-trying-to-setup-virtual-domains-762225/)

periferral 10-15-2009 05:37 PM

SOLVED postfix error Relay access denied. trying to setup virtual domains
 
Hello all
I am trying to get postfix working as a part of my email server. I am running this on debian and using LDAP. Here is the output of my configuration

dns:/etc/postfix# postconf -n
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
biff = no
config_directory = /etc/postfix
content_filter = smtp-amavis:[127.0.0.1]:10024
inet_interfaces = all
mailbox_size_limit = 0
mydestination = dns.example.com, localhost.example.com, , localhost
myhostname = dns.example.com
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
myorigin = /etc/mailname
readme_directory = no
recipient_delimiter = +
relayhost =
smtp_sasl_auth_enable = no
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
smtpd_sasl_auth_enable = yes
smtpd_tls_auth_only = yes
smtpd_tls_cert_file = /etc/ssl/CA/keys/example.crt
smtpd_tls_key_file = /etc/ssl/CA/keys/example.key
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_use_tls = yes
virtual_alias_maps = ldap:ldapalias
virtual_gid_maps = static:999
virtual_mailbox_base = /home/vmail
virtual_mailbox_domains = ldap:domains
virtual_mailbox_maps = ldap:accounts
virtual_minimum_uid = 999
virtual_transport = dovecot
virtual_uid_maps = static:999

The LDAP stuff seems to be working fine.
dns:/etc/postfix# postmap -q example@example.com ldap:accounts
example/,postmaster/
dns:/etc/postfix# postmap -q example@example.com ldap:ldapalias
example@example.com,postmaster@example.com
dns:/etc/postfix# postmap -q example@example.com ldap:domains
example.com,example.com
dns:/etc/postfix#

However, when I send an email from an external address to postfix, I see this in my error logs

Oct 15 15:34:38 dns postfix/smtpd[8639]: connect from smtp1.company.com[190.70.196.45]
Oct 15 15:34:38 dns postfix/smtpd[8639]: NOQUEUE: reject: RCPT from smtp1.company.com[190.70.196.45]: 554 5.7.1 <example@example.com>: Relay access denied; from=<user@company.com> to=<example@example.com> proto=ESMTP helo=<smtp1.company.com>
Oct 15 15:34:43 dns postfix/smtpd[8639]: disconnect from smtp1.company.com[190.70.196.45]


If I add mydomain to mydestination, the local transport takes over and it seems to work. However I want to user virtual transport and I'm having no luck with it.

Any help is appreciated.
thanks

Berhanie 10-16-2009 11:36 AM

Quick answer: something might be wrong with your ldap:domains table.

In case you haven't done so you should read the LIST MEMBERSHIP section here. The lookup behavior we're aiming for is something this:
Code:

# something is returned for one of our domains
#
$ postmap -q periferral.com ldap:domains
periferral.com

# nothing is returned otherwise
#
$ postmap -q another_domain.com ldap:domains
$

# same thing (this is not a domain)
$ postmap -q periferral@periferral.com ldap:domains
$

You might also want to follow the advice given here:
Quote:

You can save yourself a lot of time by implementing Postfix first with local files such as Berkeley DB. Local files have few surprises, and are easy to debug with the postmap(1) command...
Once you have local files working properly you can follow the instructions in ldap_table(5), mysql_table(5) or pgsql_table(5) and replace local file lookups with LDAP or SQL lookups.

periferral 10-19-2009 12:18 PM

hi Berhanie
thanks, that was indeed the problem. I fixed the domains ldap setting to match domains rather than email addresses and it fixed my problem. I clearly misread what domain should be using as a search reference.

the domain lookup works just fine now and I dont see any relay issues. Moving on. Hopefully this solves others issues as well

Berhanie 10-19-2009 12:34 PM

You're welcome, periferral. Good work.

periferral 10-20-2009 03:51 PM

I'm closing this thread but I have another question. It is posted here. If you have any insight, I'd really appreciate you help.

http://www.linuxquestions.org/questi...-login-763238/


All times are GMT -5. The time now is 04:28 PM.