Basil Hendroff
Wizard
- Joined
- Jan 4, 2014
- Messages
- 1,644
Has anyone got outbound mail from a jail working successfully? I've been struggling with this for the last three evenings, but all my attempts so far have been unfruitful. This has been my journey so far...
I started by searching the forum for keywords
Anyway, further searching brought me to the FreeBSD document Setting Up to Send Only, which seemed to suggest that sendmail was overkill for my needs. My thinking after this suggestion was to narrow my search to ssmtp and getting that working in a jail. I had no success using that document, so cast the net wider and got to this 2016 blog FreeBSD: Send mails over an external SMTP server. Again, no success, but noting, based on the blog date, that this blog would probably have referred to warden jails.
I ended up at this FreeBSD Wiki entry SecureSSMTP. Again, it's a bit dated as it refers to FreeBSD 6.2, but in all the searches, it was the most comprehensively documented. I adapted it as best I could and have had the most success so far with this wiki guide, though, I'm still unsuccessful sending outbound mail from a jail. This is what I see in
This doesn't mean a lot to me so I'm hoping for some guidance from the community to get either ssmtp or sendmail configured to send mail from within an iocage jail through an external mail relay that requires authentication.
Here's a password redacted version of ssmtp.conf if that's going to be helpful.
I started by searching the forum for keywords
sendmail jail
and that threw up a lot of stuff, mostly unhelpful. I then narrowed the search down to threads from this year. This brought me to the resource [HOW TO] Install ClamAV on FreeNAS v11 specifically page 2 in the discussion area. Looking through the posts, there's some discussion around sendmail and ssmtp. However, either the posts are too cryptic or I'm just too dumb to understand them, but I ended up leaving this thread in despair and went looking elsewhere for more information on sendmail and ssmtp. I did also spot this sendmail thread sendmail config for jails , but again, it was a bit too cryptic for me to understand.Anyway, further searching brought me to the FreeBSD document Setting Up to Send Only, which seemed to suggest that sendmail was overkill for my needs. My thinking after this suggestion was to narrow my search to ssmtp and getting that working in a jail. I had no success using that document, so cast the net wider and got to this 2016 blog FreeBSD: Send mails over an external SMTP server. Again, no success, but noting, based on the blog date, that this blog would probably have referred to warden jails.
I ended up at this FreeBSD Wiki entry SecureSSMTP. Again, it's a bit dated as it refers to FreeBSD 6.2, but in all the searches, it was the most comprehensively documented. I adapted it as best I could and have had the most success so far with this wiki guide, though, I'm still unsuccessful sending outbound mail from a jail. This is what I see in
/var/log/maillog
when I execute sendmail basil.hendroff@gmail.com < /etc/rc.conf
from within the jail. Note the bit about a 'Connection refused' in the second line.Code:
Sep 9 01:33:49 test sendmail[89013]: 088HXnCs089013: from=root, size=310, class=0, nrcpts=1, msgid=<202009081733.088HXnCs089013@localhost.my.domain>, relay=root@localhost Sep 9 01:33:49 test sendmail[89013]: 088HXnCs089013: to=basil.hendroff@gmail.com, ctladdr=root (0/0), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30310, relay=[127.0.0.1] [127.0.0.1], dsn=4.0.0, stat=Deferred: Connection refused by [127.0.0.1]
This doesn't mean a lot to me so I'm hoping for some guidance from the community to get either ssmtp or sendmail configured to send mail from within an iocage jail through an external mail relay that requires authentication.
Here's a password redacted version of ssmtp.conf if that's going to be helpful.
Code:
Debug=YES # # /etc/ssmtp.conf -- a config file for sSMTP sendmail. # # The person who gets all mail for userids < 1000 # Make this empty to disable rewriting. root=postmaster # The place where the mail goes. The actual machine name is required # no MX records are consulted. Commonly mailhosts are named mail.domain.com # The example will fit if you are in domain.com and your mailhub is so named. #mailhub=mail # Example for SMTP port number 2525 # mailhub=mail.your.domain:2525 # Example for SMTP port number 25 (Standard/RFC) # mailhub=mail.your.domain # Example for SSL encrypted connection mailhub=mail.internode.on.net:465 # Where will the mail seem to come from? rewriteDomain=udance.com.au # The full hostname hostname=udance.com.au # Set this to never rewrite the "From:" line (unless not given) and to # use that address in the "from line" of the envelope. FromLineOverride=YES # Use SSL/TLS to send secure messages to server. UseTLS=YES # Use SSL/TLS certificate to authenticate against smtp host. #UseTLSCert=YES # Use this RSA certificate. #TLSCert=/usr/local/etc/ssmtp/ssmtp.pem # Get enhanced (*really* enhanced) debugging information in the logs # If you want to have debugging of the config file parsing, move this option # to the top of the config file and uncomment #Debug=YES # Use these parameters for securely authenticating against your # mailhub; check ssmtp.conf(5) for further details. UseSTARTTLS=YES AuthUser=basil.hendroff AuthPass=xxxxxxxx
Last edited: