Loop problem in sending mail to root

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Loop problem in sending mail to root

Chris Bennett-4
I cannot get mail to reach root from /etc/daily for example.
Not sure what I have setup wrong.
also both femail-chroot and sendmail-mini-chroot fail
femail: socket: Connection refused
/var/www/bin/sendmail_mini: connect: Connection refused
Any help appreciated.
I also get the from as <[hidden email]> instead of <> too.
Same problem trying to send mail from a local user to another.

bennettconstruction.us is /etc/myname

running 6.2 -stable using openup on i386
was trying to set up with vmail earlier, still using mbox and mutt.
Let me know what else is needed for help.
Also, I would like a clear explanation of what is happening.
Could only find info about looping between different machines, not on
same machine. I'd like to understand this problem.

Thanks,
Chris Bennett


maillog:


Feb 25 11:17:20 bennettconstruction smtpd[87019]: d6185c5660de72c5 smtp event=message address=104.217.196.250 host=bennettconstruction.us msgid=b0728562 from=<> to=<[hidden email]> size=54221 ndest=1 proto=ESMTP
Feb 25 11:17:20 bennettconstruction smtpd[87019]: d6185c55538136f0 mta event=delivery evpid=561745fbfe51ba45 from=<> to=<[hidden email]> rcpt=<-> source="104.217.196.250" relay="104.217.196.250 (bennettconstruction.us)" delay=1s result="Ok" stat="250 2.0.0: b0728562 Message accepted for delivery"
Feb 25 11:17:21 bennettconstruction smtpd[87019]: warn: loop detected
Feb 25 11:17:21 bennettconstruction smtpd[87019]: d6185c5660de72c5 smtp event=failed-command address=104.217.196.250 host=bennettconstruction.us command="DATA" result="500 5.4.6 Routing loop detected: Loop detected"
Feb 25 11:17:21 bennettconstruction smtpd[87019]: d6185c55538136f0 mta event=delivery evpid=b07285629425f9ef from=<> to=<[hidden email]> rcpt=<-> source="104.217.196.250" relay="104.217.196.250 (bennettconstruction.us)" delay=1s result="PermFail" stat="500 5.4.6 Routing loop detected: Loop detected"
Feb 25 11:17:21 bennettconstruction smtpd[19843]: warn: queue: no return path!
Feb 25 11:17:31 bennettconstruction smtpd[87019]: d6185c5660de72c5 smtp event=closed address=104.217.196.250 host=bennettconstruction.us reason=quit
Feb 25 11:17:31 bennettconstruction smtpd[87019]: d6185c55538136f0 mta event=closed reason=quit messages=96

smtpd.conf:


# $OpenBSD: smtpd.conf,v 1.9 2016/05/03 18:43:45 jung Exp $

# This is the smtpd server system-wide configuration file.
# See smtpd.conf(5) for more information.

# tables section
table aliases file:/etc/mail/aliases
table domains file:/etc/mail/domains
table passwd file:/etc/mail/passwd
table virtuals file:/etc/mail/virtuals

# To accept external mail, replace with: listen on all
#
#listen on all

#
mx1 = "104.217.196.250"
mx2 = "104.217.196.251"
mx3 = "104.217.196.252"
mx4 = "104.217.196.253"
mx5 = "104.217.196.254"
#all_mx = "{" $mx1 $mx2 "}"
# $mx3 $mx4 $mx5 "}"

pki mail.capuchado.com certificate "/etc/ssl/mail.capuchado.com.crt"
pki mail.capuchado.com key "/etc/ssl/private/mail.capuchado.com.key"
pki mail.bennettconstruction.us certificate "/etc/ssl/mail.bennettconstruction.us.crt"
pki mail.bennettconstruction.us key "/etc/ssl/private/mail.bennettconstruction.us.key"

listen on $mx2 port 25 tls pki mail.capuchado.com
listen on $mx1 port 25 tls pki mail.bennettconstruction.us

# special case for gmail to avoid ipv6 here
limit mta for domain gmail.com inet4

# allow local messages
##accept from local for local alias <aliases> deliver to lmtp "/var/dovecot/lmtp" rcpt-to
# allow virtual domains
##accept from any for domain <domains> virtual <virtuals> deliver to lmtp "/var/dovecot/lmtp" rcpt-to

#pki mail.example.com certificate "/etc/ssl/mail.example.com.crt"
#pki mail.example.com key "/etc/ssl/private/mail.example.com.key"
# $OpenBSD: smtpd.conf,v 1.8 2015/12/21 16:25:44 sunil Exp $

# Uncomment the following to accept external mail for domain "example.org"
#
# accept from any for domain "example.org" alias <aliases> deliver to mbox
##accept for local alias <aliases> deliver to mbox
accept from local for any relay
accept from any for domain "bennettconstruction.us" alias <aliases> deliver to mbox
accept from any for domain "ed-bennett.com" alias <aliases> deliver to mbox
accept from any for domain "capuchado.com" alias <aliases> deliver to mbox

Reply | Threaded
Open this post in threaded view
|

Re: Loop problem in sending mail to root

Todd C. Miller-2
The answer is probably in your /etc/mail/aliases file.  Do you have
an entry for root in there?  If so, it needs to point to a different
user.  An entry like the following would cause the error:

root: root

For sendmail, an entry like this would cause the mail to be delivered
locally for the user.  With smtpd it results in a mail loop.

 - todd

Reply | Threaded
Open this post in threaded view
|

Re: Loop problem in sending mail to root

Chris Bennett-4
On Mon, Mar 05, 2018 at 06:12:39PM +0000, Todd C. Miller wrote:

> The answer is probably in your /etc/mail/aliases file.  Do you have
> an entry for root in there?  If so, it needs to point to a different
> user.  An entry like the following would cause the error:
>
> root: root
>
> For sendmail, an entry like this would cause the mail to be delivered
> locally for the user.  With smtpd it results in a mail loop.
>
>  - todd

No, that didn't help. Still get femail problem and referring an alias
root: chris002 also didn't help.
I did find a vmail alias,which I commented out.
newaliases rcctl stop smtpd rcctl start smtpd also to be sure.

I am not running spamd yet, so no error there.

I'm going to run dovecot, but I need to figure this problem out first.

Chris Bennett


Reply | Threaded
Open this post in threaded view
|

Re: Loop problem in sending mail to root

trondd-2
In reply to this post by Chris Bennett-4
On Mon, March 5, 2018 1:05 pm, Chris Bennett wrote:

> I cannot get mail to reach root from /etc/daily for example.
> Not sure what I have setup wrong.
> also both femail-chroot and sendmail-mini-chroot fail
> femail: socket: Connection refused
> /var/www/bin/sendmail_mini: connect: Connection refused
> Any help appreciated.
> I also get the from as <[hidden email]> instead of <> too.
> Same problem trying to send mail from a local user to another.
>
> bennettconstruction.us is /etc/myname
>
> running 6.2 -stable using openup on i386
> was trying to set up with vmail earlier, still using mbox and mutt.
> Let me know what else is needed for help.
> Also, I would like a clear explanation of what is happening.
> Could only find info about looping between different machines, not on
> same machine. I'd like to understand this problem.
>
> Thanks,
> Chris Bennett
>
>
> maillog:
>
>
> Feb 25 11:17:20 bennettconstruction smtpd[87019]: d6185c5660de72c5 smtp
> event=message address=104.217.196.250 host=bennettconstruction.us
> msgid=b0728562 from=<> to=<[hidden email]> size=54221 ndest=1
> proto=ESMTP
> Feb 25 11:17:20 bennettconstruction smtpd[87019]: d6185c55538136f0 mta
> event=delivery evpid=561745fbfe51ba45 from=<>
> to=<[hidden email]> rcpt=<-> source="104.217.196.250"
> relay="104.217.196.250 (bennettconstruction.us)" delay=1s result="Ok"
> stat="250 2.0.0: b0728562 Message accepted for delivery"
> Feb 25 11:17:21 bennettconstruction smtpd[87019]: warn: loop detected
> Feb 25 11:17:21 bennettconstruction smtpd[87019]: d6185c5660de72c5 smtp
> event=failed-command address=104.217.196.250 host=bennettconstruction.us
> command="DATA" result="500 5.4.6 Routing loop detected: Loop detected"
> Feb 25 11:17:21 bennettconstruction smtpd[87019]: d6185c55538136f0 mta
> event=delivery evpid=b07285629425f9ef from=<>
> to=<[hidden email]> rcpt=<-> source="104.217.196.250"
> relay="104.217.196.250 (bennettconstruction.us)" delay=1s
> result="PermFail" stat="500 5.4.6 Routing loop detected: Loop detected"
> Feb 25 11:17:21 bennettconstruction smtpd[19843]: warn: queue: no return
> path!
> Feb 25 11:17:31 bennettconstruction smtpd[87019]: d6185c5660de72c5 smtp
> event=closed address=104.217.196.250 host=bennettconstruction.us
> reason=quit
> Feb 25 11:17:31 bennettconstruction smtpd[87019]: d6185c55538136f0 mta
> event=closed reason=quit messages=96
>
> smtpd.conf:
>
>
> # $OpenBSD: smtpd.conf,v 1.9 2016/05/03 18:43:45 jung Exp $
>
> # This is the smtpd server system-wide configuration file.
> # See smtpd.conf(5) for more information.
>
> # tables section
> table aliases file:/etc/mail/aliases
> table domains file:/etc/mail/domains
> table passwd file:/etc/mail/passwd
> table virtuals file:/etc/mail/virtuals
>
> # To accept external mail, replace with: listen on all
> #
> #listen on all
>
> #
> mx1 = "104.217.196.250"
> mx2 = "104.217.196.251"
> mx3 = "104.217.196.252"
> mx4 = "104.217.196.253"
> mx5 = "104.217.196.254"
> #all_mx = "{" $mx1 $mx2 "}"
> # $mx3 $mx4 $mx5 "}"
>
> pki mail.capuchado.com certificate "/etc/ssl/mail.capuchado.com.crt"
> pki mail.capuchado.com key "/etc/ssl/private/mail.capuchado.com.key"
> pki mail.bennettconstruction.us certificate
> "/etc/ssl/mail.bennettconstruction.us.crt"
> pki mail.bennettconstruction.us key
> "/etc/ssl/private/mail.bennettconstruction.us.key"
>
> listen on $mx2 port 25 tls pki mail.capuchado.com
> listen on $mx1 port 25 tls pki mail.bennettconstruction.us
>
> # special case for gmail to avoid ipv6 here
> limit mta for domain gmail.com inet4
>
> # allow local messages
> ##accept from local for local alias <aliases> deliver to lmtp
> "/var/dovecot/lmtp" rcpt-to
> # allow virtual domains
> ##accept from any for domain <domains> virtual <virtuals> deliver to lmtp
> "/var/dovecot/lmtp" rcpt-to
>
> #pki mail.example.com certificate "/etc/ssl/mail.example.com.crt"
> #pki mail.example.com key "/etc/ssl/private/mail.example.com.key"
> # $OpenBSD: smtpd.conf,v 1.8 2015/12/21 16:25:44 sunil Exp $
>
> # Uncomment the following to accept external mail for domain "example.org"
> #
> # accept from any for domain "example.org" alias <aliases> deliver to mbox
> ##accept for local alias <aliases> deliver to mbox
> accept from local for any relay
> accept from any for domain "bennettconstruction.us" alias <aliases>
> deliver to mbox
> accept from any for domain "ed-bennett.com" alias <aliases> deliver to
> mbox
> accept from any for domain "capuchado.com" alias <aliases> deliver to mbox
>

First matching rule wins, are you relaying to yourself?  Try moving that
to the bottom.

Reply | Threaded
Open this post in threaded view
|

Re: Loop problem in sending mail to root

Chris Bennett-4
That did the trick.

Femail is still failing, though.
I will look into that, I was fiddling quite a bit and I may need to put
things back to the way they were.
I'll bring that back up later if it still fails.

I like smtpd a lot! Sendmail was a nightmare to set up!

Thanks,
Chris Bennett


Reply | Threaded
Open this post in threaded view
|

Re: Loop problem in sending mail to root

trondd-2
On Mon, March 5, 2018 2:45 pm, Chris Bennett wrote:
> That did the trick.
>

For the future, page 2 'Trace subsystem':

https://www.bsdcan.org/2016/schedule/attachments/378_smtpd_cheatsheet.pdf

You can see which rule gets matched.