Postfix Connection issues

Hello,

I tried following http://library.linode.com/email/postfix … 0.04-lucid">http://library.linode.com/email/postfix/dovecot-mysql-ubuntu-10.04-lucid to get you started by the recommendation of @derfy.

The problem as I see it now is that I am unable to connect to Postfix. It seems as there is a setting missing to allow connections via the public IP Address.

Possibly someone can help me understand the problem at this point? I am not sure where/what I should be looking for.

The goal of this configuration is to allow mail to be 'relayed' via one specific account. Anything and EVERYTHING else should be ignored.

Thank you for your thoughts.

Example: Telnet to 127.0.0.1 25 works, but is slow to initially answer. and Telnet localhost 25 works nice and fast. Both send the email immediately. However Telnet 96.126.120.146 results in "Connection closed by foreign host."

root@li369-146:~# telnet 96.126.120.146 25

Trying 96.126.120.146…

Connected to 96.126.120.146.

Escape character is '^]'.

Connection closed by foreign host.

root@li369-146:~# telnet 96.126.120.146 25
Trying 96.126.120.146...
Connected to 96.126.120.146.
Escape character is '^]'.
Connection closed by foreign host.
root@li369-146:~# telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.localdomain.
Escape character is '^]'.
mail from:noreply@csr-az.com
rcpt to:k7faq.az@gmail.com
data
test

.
quit
220 fms.csr-az.com ESMTP Postfix (Debian/GNU)
250 2.1.0 Ok
250 2.1.5 Ok
354 End data with <cr><lf>. <cr><lf>250 2.0.0 Ok: queued as 50F341CD1D
221 2.0.0 Bye
Connection closed by foreign host.</lf></cr></lf></cr> 
netstat -tap

returns

root@li369-146:~# netstat -tap
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 *:imaps                 *:*                     LISTEN      8574/dovecot
tcp        0      0 *:pop3s                 *:*                     LISTEN      8574/dovecot
tcp        0      0 localhost.localdo:mysql *:*                     LISTEN      7226/mysqld
tcp        0      0 *:pop3                  *:*                     LISTEN      8574/dovecot
tcp        0      0 *:imap2                 *:*                     LISTEN      8574/dovecot
tcp        0      0 *:ssh                   *:*                     LISTEN      1588/sshd
tcp        0      0 *:smtp                  *:*                     LISTEN      9961/master
tcp        0      0 fms.csr-az.com:smtp     207.225.166.109:4129    TIME_WAIT   -
tcp        0    248 fms.csr-az.com:ssh      207.225.166.109:4131    ESTABLISHED 10163/0
tcp6       0      0 [::]:ssh                [::]:*                  LISTEN      1588/sshd

main.cf

root@li369-146:~# cat /etc/postfix/main.cf
# 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

readme_directory = /usr/share/doc/postfix

# TLS parameters
smtpd_tls_cert_file = /etc/postfix/smtpd.cert
smtpd_tls_key_file = /etc/postfix/smtpd.key
smtpd_use_tls = yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

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

myhostname = fms.csr-az.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = localhost, localhost.localdomain
relayhost =
mynetworks = 127.0.0.0/8, 96.126.120.146/8
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
html_directory = /usr/share/doc/postfix/html
message_size_limit = 30720000
virtual_alias_domains =
virtual_alias_maps = proxy:mysql:/etc/postfix/mysql-virtual_forwardings.cf, mysql:/etc/postfix/mysql-virtual_email2email.cf
virtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql-virtual_domains.cf
virtual_mailbox_maps = proxy:mysql:/etc/postfix/mysql-virtual_mailboxes.cf
virtual_mailbox_base = /home/vmail
virtual_uid_maps = static:5000
virtual_gid_maps = static:5000
smtpd_sasl_auth_enable = yes
broken_sasl_auth_clients = yes
smtpd_sasl_authenticated_header = yes
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
virtual_create_maildirsize = yes
virtual_maildir_extended = yes
proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks $virtual_mailbox_limit_maps
virtual_transport = dovecot
dovecot_destination_recipient_limit = 1

2 Replies

I get the same behavior here, too.

Try adding a '-v' to your 'smtp' setting in /etc/postfix/master.cf, like this: http://derfy.net/images/linode02.png Then restart postfix and try to send mail again. The log (/var/log/mail.log) should have some useful information about why it is dropping people.

Edit: after testing, you'll want to remove 96.126.120.146/8 from this line: > mynetworks = 127.0.0.0/8, 96.126.120.146/8

By putting that there, you allow 96.0.0.0/8 to relay through your server.

No, change your mynetworks value NOW – that is what is causing the issue.

96.126.120.146/8 is totally invalid ( 96.126.120.146/8 != 96.0.0.0/8 ), and as a result Postfix is refusing the connections entirely as it has no clue what you really meant. Change it to a /32 and restart Postfix.

I suspect your issue will immediately be resolved.

mynetworks = 127.0.0.0/8, 96.126.120.146/32

or even:

mynetworks = 127.0.0.1/32, 96.126.120.146/32

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct