LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 06-01-2009, 12:39 PM   #1
r0bb3d
LQ Newbie
 
Registered: Jun 2009
Posts: 2

Rep: Reputation: 0
Postfix not listening to smtp_bind_address directive


Hi,

I have a problem which is driving me crazy, been battling with this one all day.

I installed openvpn on my (up to date) Debian amd64 box yesterday and this seems to have changed the behaviour of postfix and which IP it binds to for connections to Amavis. Probably something to do with openvpn adding the tun0 interface.

This server is only used for incoming mail. Postfix accepts mail, runs it through amavis and delivers it to maildir. Postfix used to pass mails to amavis using source IP 127.0.0.1 (and destination 127.0.0.1). Now all of a sudden postfix uses my external IP configured on eth0 for this.

First i had trouble with virtual mailbox lookups in mysql, because connections to mysql suddenly came from 82.x.x.47 instead of 127.0.0.1. This is fixed.

Next problem is that amavis only accepts connections from localhost, and now gives the error:
" amavis[14313]: (!)DENIED ACCESS from IP 82.x.x.47, policy bank '' ".

Ofc I tried adding the @inet_acl directive to /etc/amavis/conf.d/20-debian_defaults to allow connections from this IP, which works, but gives me a whole new set of errors, which go something like this:

"
Jun 1 16:50:39 skynet postfix/pickup[12127]: 7BC674BBA0F4: uid=0 from=<root>
Jun 1 16:50:39 skynet postfix/cleanup[12133]: 7BC674BBA0F4: message-id=<20090601145039.7BC674BBA0F4@skynet.x.com>
Jun 1 16:50:39 skynet postfix/qmgr[12128]: 7BC674BBA0F4: from=<root@skynet.x.com>, size=329, nrcpt=1 (queue active)
Jun 1 16:50:44 skynet postfix/smtpd[12138]: connect from skynet.x.com[82.x.x.47]
Jun 1 16:50:44 skynet postfix/smtpd[12138]: NOQUEUE: reject: RCPT from skynet.x.com[82.x.x.47]: 554 5.7.1 <r0bb3d@maildomain.com>: Recipient address rejected: Access denied; from=<root@skynet.x.com> to=<r0bb3d@maildomain.com> proto=ESMTP helo=<localhost>
Jun 1 16:50:44 skynet amavis[10881]: (10881-06) Negative SMTP resp. to DATA: 554 5.5.1 Error: no valid recipients
Jun 1 16:50:44 skynet postfix/smtpd[12138]: disconnect from skynet.x.com[82.x.x.47]
Jun 1 16:50:44 skynet amavis[10881]: (10881-06) (!)FWD via SMTP: <root@skynet.x.com> -> <r0bb3d@maildomain.com>,BODY=7BIT 554 5.7.1 Failed, id=10881-06, from MTA([127.0.0.1]:10025): 554 5.7.1 <r0bb3d@maildomain.com>: Recipient address rejected: Access denied
Jun 1 16:50:44 skynet postfix/smtpd[12138]: connect from skynet.x.com[82.x.x.47]
Jun 1 16:50:44 skynet postfix/smtpd[12138]: NOQUEUE: reject: RCPT from skynet.x.com[82.x.x.47]: 554 5.7.1 <root@skynet.x.com>: Recipient address rejected: Access denied; from=<> to=<root@skynet.x.com> proto=ESMTP helo=<localhost>
Jun 1 16:50:44 skynet amavis[10881]: (10881-06) Negative SMTP resp. to DATA: 554 5.5.1 Error: no valid recipients
Jun 1 16:50:44 skynet amavis[10881]: (10881-06) (!)SEND via SMTP: <> -> <root@skynet.x.com>,ENVID=AM..20090601T145044Z@localhost 554 5.7.1 Failed, id=10881-06, from MTA([127.0.0.1]:10025): 554 5.7.1 <root@skynet.x.com>: Recipient address rejected: Access denied
Jun 1 16:50:44 skynet amavis[10881]: (10881-06) (!)NOTICE: UNABLE TO SEND DSN to <root@skynet.x.com>: 554 5.7.1 Failed, id=10881-06, from MTA([127.0.0.1]:10025): 554 5.7.1 <root@skynet.x.com>: Recipient address rejected: Access denied
Jun 1 16:50:44 skynet amavis[10881]: (10881-06) Blocked MTA-BLOCKED, <root@skynet.x.com> -> <r0bb3d@maildomain.com>, Message-ID: <20090601145039.7BC674BBA0F4@skynet.x.com>, mail_id: Sv5F02dwkXuA, Hits: -1.423, size: 329, 5227 ms
Jun 1 16:50:44 skynet postfix/lmtp[12135]: 7BC674BBA0F4: to=<r0bb3d@maildomain.com>, relay=127.0.0.1[127.0.0.1]:10024, delay=5.3, delays=0.05/0/0/5.2, dsn=2.5.0, status=sent (250 2.5.0 Ok <r0bb3d@maildomain.com>, DSN suppressed_2 (554 5.7.1 Failed, id=10881-06, from MTA([127.0.0.1]:10025): 554 5.7.1 <r0bb3d@maildomain.com>: Recipient address rejected: Access denied))
Jun 1 16:50:44 skynet postfix/qmgr[12128]: 7BC674BBA0F4: removed
Jun 1 16:50:44 skynet postfix/smtpd[12138]: disconnect from skynet.x.com[82.x.x.47]
"

After some time I gave up on trying to fix this problem, and instead focussed on making 127.0.0.1 the source IP again for outgoing connections from postfix. Supposedly you can make this happen by specifying the directive "smtp_bind_address" or "lmtp_bind_address" in main.cf, but postfix doesn't respond at all to this and keeps using 82.x.x.47 it seems.

This is my main.cf:

Code:
# See /usr/share/postfix/main.cf.dist for a commented, more complete version


# Debian specific:  Specifying a file name will cause the first
# line of that file to be used as the name.  The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname

smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
biff = no

# appending .domain is the MUA's job.
append_dot_mydomain = no

# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h

myhostname = skynet.x.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = skynet.x.com, localhost
relayhost =
mynetworks = 127.0.0.0/8
mailbox_command = procmail -a "$EXTENSION"
mailbox_size_limit = 0
message_size_limit = 60000000
recipient_delimiter = +
inet_interfaces = all


## SPAM / VIRUS
content_filter = lmtp-amavis:[127.0.0.1]:10024
receive_override_options = no_address_mappings
## /


virtual_alias_domains =
virtual_alias_maps = mysql:/etc/postfix/mysql-virtual_forwardings.cf mysql:/etc/postfix/mysql-virtual_email2email.cf
virtual_mailbox_domains = mysql:/etc/postfix/mysql-virtual_domains.cf
virtual_mailbox_maps = mysql:/etc/postfix/mysql-virtual_mailboxes.cf
virtual_mailbox_base = /home/vmail
virtual_uid_maps = static:5000
virtual_gid_maps = static:5000
virtual_mailbox_limit = 0

# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.

smtpd_sasl_auth_enable = no
broken_sasl_auth_clients = yes
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
smtpd_use_tls = no
smtpd_tls_cert_file = /etc/postfix/smtpd.cert
smtpd_tls_key_file = /etc/postfix/smtpd.key
smtpd_tls_session_cache_database = btree:${queue_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${queue_directory}/smtp_scache
readme_directory = /usr/share/doc/postfix
html_directory = /usr/share/doc/postfix/html
The master.cf:

Code:
#
# Postfix master process configuration file.  For details on the format
# of the file, see the master(5) manual page (command: "man 5 master").
#
# ==========================================================================
# service type  private unpriv  chroot  wakeup  maxproc command + args
#               (yes)   (yes)   (yes)   (never) (100)
# ==========================================================================
smtp      inet  n       -       -       -       -       smtpd
#submission inet n       -       -       -       -       smtpd
#  -o smtpd_enforce_tls=yes
#  -o smtpd_sasl_auth_enable=yes
#  -o smtpd_client_restrictions=permit_sasl_authenticated,reject
#smtps     inet  n       -       -       -       -       smtpd
#  -o smtpd_tls_wrappermode=yes
#  -o smtpd_sasl_auth_enable=yes
#  -o smtpd_client_restrictions=permit_sasl_authenticated,reject
#628      inet  n       -       -       -       -       qmqpd
pickup    fifo  n       -       -       60      1       pickup
cleanup   unix  n       -       -       -       0       cleanup
qmgr      fifo  n       -       n       300     1       qmgr
#qmgr     fifo  n       -       -       300     1       oqmgr
tlsmgr    unix  -       -       -       1000?   1       tlsmgr
rewrite   unix  -       -       -       -       -       trivial-rewrite
bounce    unix  -       -       -       -       0       bounce
defer     unix  -       -       -       -       0       bounce
trace     unix  -       -       -       -       0       bounce
verify    unix  -       -       -       -       1       verify
flush     unix  n       -       -       1000?   0       flush
proxymap  unix  -       -       n       -       -       proxymap
smtp      unix  -       -       -       -       -       smtp
# When relaying mail as backup MX, disable fallback_relay to avoid MX loops
relay     unix  -       -       -       -       -       smtp
        -o fallback_relay=
#       -o smtp_helo_timeout=5 -o smtp_connect_timeout=5
showq     unix  n       -       -       -       -       showq
error     unix  -       -       -       -       -       error
discard   unix  -       -       -       -       -       discard
local     unix  -       n       n       -       -       local
virtual   unix  -       n       n       -       -       virtual
lmtp      unix  -       -       -       -       -       lmtp
anvil     unix  -       -       -       -       1       anvil
scache    unix  -       -       -       -       1       scache
#
# ====================================================================
# Interfaces to non-Postfix software. Be sure to examine the manual
# pages of the non-Postfix software to find out what options it wants.
#
# Many of the following services use the Postfix pipe(8) delivery
# agent.  See the pipe(8) man page for information about ${recipient}
# and other message envelope options.
# ====================================================================
#
# maildrop. See the Postfix MAILDROP_README file for details.
# Also specify in main.cf: maildrop_destination_recipient_limit=1
#
maildrop  unix  -       n       n       -       -       pipe
  flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient}
#
# See the Postfix UUCP_README file for configuration details.
#
uucp      unix  -       n       n       -       -       pipe
  flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient)
#
# Other external delivery methods.
#
ifmail    unix  -       n       n       -       -       pipe
  flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient)
bsmtp     unix  -       n       n       -       -       pipe
  flags=Fq. user=bsmtp argv=/usr/lib/bsmtp/bsmtp -t$nexthop -f$sender $recipient
scalemail-backend unix  -       n       n       -       2       pipe
  flags=R user=scalemail argv=/usr/lib/scalemail/bin/scalemail-store ${nexthop} ${user} ${extension}
mailman   unix  -       n       n       -       -       pipe
  flags=FR user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py
  ${nexthop} ${user}


## SPAM / VIRUS
lmtp-amavis unix - - n - 10 lmtp
   -o lmtp_data_done_timeout=1200
   -o lmtp_send_xforward_command=yes
127.0.0.1:10025 inet n - - - - smtpd
   -o content_filter=
   -o local_recipient_maps=
   -o relay_recipient_maps=
   -o smtpd_restriction_classes=
   -o smtpd_client_restrictions=
   -o smtpd_helo_restrictions=
   -o smtpd_sender_restrictions=
   -o smtpd_recipient_restrictions=permit_mynetworks,reject
   -o mynetworks=127.0.0.0/8
   -o strict_rfc821_envelopes=yes
   -o receive_override_options=no_unknown_recipient_checks,no_header_body_checks
## /
Also, I should add that as soon as I disable content_filter in main.cf and cut out amavis, all mail is delivered as normal.

Any help is much appreciated. I've googled my ass off trying to find infos on this, but can't find anything that relates to this specific situation.

Greetz,
R0bb
 
Old 06-01-2009, 04:03 PM   #2
r0bb3d
LQ Newbie
 
Registered: Jun 2009
Posts: 2

Original Poster
Rep: Reputation: 0
Ok problem solved.

In master.cf I had to add the public IP to:

" -o mynetworks=127.0.0.0/8"

So simple, yet so easily missed if you don't fully understand postfix + the error msgs give no hints whatsoever ....

Anyway, moving on
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
preventing postfix from listening on port 25 tklima Linux - Server 5 08-30-2010 12:06 PM
%config directive sandricky Linux - Software 0 01-30-2009 07:57 PM
postfix listening port wardjame Linux - Software 4 08-02-2006 11:08 AM
Postfix running but not listening on 25 pnh73 Linux - Networking 1 05-27-2004 12:07 AM
Apache Directive sopiaz57 Linux - Security 2 12-09-2003 01:32 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:22 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration