
Here is my main.cf fileFeb 15 23:37:23 puppy postfix/smtp[12444]: connect to mx3.hotmail.com[65.54.253.99]: Connection timed out (port 25)
Feb 15 23:37:46 puppy postfix/smtp[12262]: connect to mx1.hotmail.com[65.54.166.99]: Connection timed out (port 25)
Feb 15 23:37:46 puppy postfix/smtp[12262]: 7728747168: to=<myname@hotmail.com>, relay=none, delay=1603, status=deferred (connect to mx1.hotmail.com[65.54.166.99]: Connection timed out)
Feb 15 23:37:53 puppy postfix/smtp[12444]: connect to mx2.hotmail.com[65.54.190.7]: Connection timed out (port 25)
Any idea where I went wrongroot@puppy anil # grep -v "^#" /etc/postfix/main.cf | sed '/./,/^$/!d'
queue_directory = /var/spool/postfix
command_directory = /usr/sbin
daemon_directory = /usr/lib/postfix
mail_owner = postfix
myorigin = $myhostname
mydestination = $myhostname, localhost.$mydomain $mydomain
unknown_local_recipient_reject_code = 450
mynetworks_style = subnet
mynetworks = 127.0.0.0/8 192.168.0.0/24
mailbox_command = /usr/bin/procmail
debug_peer_level = 2
debugger_command =
PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
xxgdb $daemon_directory/$process_name $process_id & sleep 5
sendmail_path = /usr/sbin/sendmail
newaliases_path = /usr/bin/newaliases
mailq_path = /usr/bin/mailq
setgid_group = postdrop
manpage_directory = /usr/share/man
sample_directory = /usr/share/doc/postfix-2.0.18/sample
readme_directory = /usr/share/doc/postfix-2.0.18/readme
default_destination_concurrency_limit = 2
alias_database = hash:/etc/mail/aliases
local_destination_concurrency_limit = 2
alias_maps = hash:/etc/mail/aliases
home_mailbox = .maildir/
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
smtpd_sasl_local_domain =
broken_sasl_auth_clients = yes
smtpd_client_restrictions = permit_sasl_authenticated, reject
smtpd_use_tls=yes
smtpd_tls_auth_only = yes
smtpd_tls_key_file = /etc/ssl/postfix/server.key
smtpd_tls_cert_file = /etc/ssl/postfix/server.crt
smtpd_tls_CAfile = /etc/ssl/postfix/server.pem
smtpd_tls_loglevel = 3
smtpd_tls_received_header = yes
smtpd_tls_session_cache_timeout = 3600s
tls_random_source = dev:/dev/urandom
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/saslpass
smtp_sasl_security_options = noanonymous
Code: Select all
inet_interfaces = all
mydestination = $myhostname, localhost.$mydomain $mydomain
unknown_local_recipient_reject_code = 550
mynetworks = 127.0.0.0/8 10.0.9.0/24
smtpd_sasl_auth_enable = yes
smtpd_sasl2_auth_enable = yes
smtpd_sasl_security_options = noanonymous
smtpd_sasl_local_domain =
broken_sasl_auth_clients = yes
smtpd_client_restrictions = permit_sasl_authenticated,reject
smtpd_use_tls=yes
smtpd_tls_auth_only = yes
smtpd_tls_key_file = /etc/ssl/postfix/server.key
smtpd_tls_cert_file = /etc/ssl/postfix/server.crt
smtpd_tls_CAfile = /etc/ssl/postfix/server.pem
smtpd_tls_loglevel = 3
smtpd_tls_received_header = yes
smtpd_tls_session_cache_timeout = 3600s
tls_random_source = dev:/dev/urandom
Code: Select all
relayhost = [smtp.of.isp]
That solved my problemsTo relay to an ISP, I just found out that you also need this line in /etc/postfix/main.cf:
Code: Select all
relayhost = [smtp.of.isp]
Code: Select all
relaydomain = smtp.of.isp
Can it be a list of upstream servers? Let's say, if one of them is down it could be good to have another one for backup in the list. Just like MX records serve downstream, but in the opposite direction. Is it possible?Woolong wrote:beowulf:
To relay to an ISP, I just found out that you also need this line in /etc/postfix/main.cf:note:You need to include [] to avoid mx look upCode: Select all
relayhost = [smtp.of.isp]
In my case, it's relayhost = [smtp.mail.yahoo.com]

Actually my question was about the host behind the firewall that cannot send directly, but only through one of gateway-smtp servers.Woolong wrote:axxackall:
I don't know if you can specify multiple hosts. I guess in that case, just comment out "relayhost" to send directly.
You might want to check out transport. Do a "man transport".
Code: Select all
# The fallback_relay parameter specifies zero or more hosts or domains
# to hand off mail to if a message destination is not found, or if a
# destination is unreachable.
fallback_relay = [smtp.of.isp]

Excelent! Thank you! The problem is solved.Woolong wrote:I just found this, dunno if it helps:Code: Select all
# The fallback_relay parameter specifies zero or more hosts or domains # to hand off mail to if a message destination is not found, or if a # destination is unreachable. fallback_relay = [smtp.of.isp]
Code: Select all
smtpd_client_restrictions = permit_sasl_authenticated,permit_mynetworks, reject_unauth_destination
smtpd_recipient_restrictions = permit_sasl_authenticated,permit_mynetworks, reject_unauth_destination
I think you actually have to be careful which of these lines you include ... in my setup, I want to be able to relay from external clients (not "untrusted", I don't think ... then you would be an open relay, right?) AND recieve mail directly to postfix (i.e. via an MX record). To get that combintation, I had to use:Woolong wrote:beowulf:
For postfix to relay mails from "untrusted" clients, meaning relaying mails from clients not on the local network.Code: Select all
smtpd_client_restrictions = permit_sasl_authenticated,permit_mynetworks, reject_unauth_destination smtpd_recipient_restrictions = permit_sasl_authenticated,permit_mynetworks, reject_unauth_destination
Code: Select all
#smtpd_client_restrictions = permit_sasl_authenticated,permit_mynetworks, reject_unauth_destination
smtpd_recipient_restrictions = permit_sasl_authenticated,permit_mynetworks, reject_unauth_destination
I was being too brief. I used "untrusted" because the client's IP is not in "mynetworks". I also assumed sasl authentication is used, so it's not an open relay. This is how you have an open relay:john5211 wrote: I think you actually have to be careful which of these lines you include ... in my setup, I want to be able to relay from external clients (not "untrusted", I don't think ... then you would be an open relay, right?)
Code: Select all
smtpd_client_restrictions = permit
smtpd_recipient_restrictions = permit
You are right, "smtpd_client_restrictions" states who postfix relays mail from, and your setup works too. However, it works because the default behavior is permit, not reject. Here is an experiment you can run:Leaving the client_restrictions in place actually restricts who is allowed to send mail *into* the network (at least as I understand it) ... so uncommenting that line effectively meant no one could send me mail at my domain unless they could authenticate against sasl (i.e. me).
Code: Select all
smtpd_client_restrictions = reject
Code: Select all
smtpd_recipient_restrictions = permit_sasl_authenticated,reject_unauth_destination
smtpd_client_restrictions = permit_sasl_authenticated,reject_unauth_destination
Code: Select all
smtpd_client_restrictions = permit_sasl_authenticated,permit_mynetworks, reject_unauth_destination
john5211:john5211 wrote: will prohibit any mail from a server who cannot authenticate against sasl from entering your network, so that if you are trying to recieve mail 'directly from the internet' (i.e. not from an account at your ISP) for delivery to a local account, it will be rejected. Of course, if that's not what you're trying to do then it doesn't matter whether or not you include it.
Code: Select all
smtpd_recipient_restrictions = permit_sasl_authenticated,reject_unauth_destination
smtpd_client_restrictions = permit_sasl_authenticated,reject_unauth_destination

Code: Select all
This report relates to your message:
Subject: test,
Message-ID: <200402182225.10563.dwer@erwer.cef>,
To: mdfg@sqs.dfgdfgs.org
of Wed, 18 Feb 2004 22:25:17 +0000
Your message was not delivered to:
mdfg@sqs.dfgdfgs.org
for the following reason:
Diagnostic was Unable to transfer, -1
Information MTA 'mdfg@sqs.dfgdfgs.org' gives error message <mdfg@sqs.dfgdfgs.org>: Relay access denied
The Original Message follows:
Received: from tt.audi (actually host 296.997.9.90.in-addr.arpa) by d2333 with SMTP (XT-PP) with ESMTP; Wed, 18 Feb 2004 22:25:11 +0000
From: Daniel Squires <dwer@erwer.cef>
Reply-To: ddwer@erwer.cef
Organization: werwerwer
To: mdfg@sqs.dfgdfgs.org
Subject: test
Date: Wed, 18 Feb 2004 22:25:10 +0000
User-Agent: KMail/1.5.4
MIME-Version: 1.0
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Message-Id: <200402182225.10563.dwer@erwer.cef>Code: Select all
Feb 18 22:25:17 [postfix/smtpd] starting TLS engine
Feb 18 22:25:17 [postfix/smtpd] connect from d2333.dfgdfgt.cfgm[193.134.789.99]
Feb 18 22:25:17 [postfix/smtpd] 8761511DA9F: client=d2333.dfgdfgt.cfgm[193.134.789.99]
Feb 18 22:25:17 [postfix/smtpd] 8761511DA9F: reject: RCPT from d2333.dfgdfgt.cfgm[193.134.789.99]: 554 <mdfg@sqs.dfgdfgs.org>: Relay access denied; from=<dwer@erwer.cef> to=<mdfg@sqs.dfgdfgs.org> proto=SMTP helo=<d2333.dfgdfgt.cfgm>
Feb 18 22:25:18 [postfix/smtpd] disconnect from d2333.dfgdfgt.cfgm[193.134.789.99]
Feb 18 22:30:00 [CRON] (root) CMD (test -x /usr/sbin/run-crons && /usr/sbin/run-crons )_
Code: Select all
grep -v '^#' /etc/postfix/main.cf

Code: Select all
mydestination = $myhostname, localhost.$mydomain $mydomain
smtpd_recipient_restrictions = permit_sasl_authenticated,reject_unauth_destination
smtpd_client_restrictions = permit_sasl_authenticated,reject_unauth_destination
Code: Select all
root@server # vi /etc/mail/aliases
# Well-known aliases -- these should be filled in
root: 2ls-beo Code: Select all
root@testserver2 tek# /usr/bin/newaliases
newaliases: fatal: gethostbyname: No such file or directory