Solved Configure host to use mail server in jail (sendmail)

Hello,

I have set up a mail server jail using sendmail, now I would like to achieve the following:
  1. Disable sendmail's email handling on the host so that incoming emails are passed to the jail (there is a forwarding rule in PF)
  2. Have the sendmail on the host send system emails to a specific user in the jail
How can I go about achieving this?

Thank you!
 
1. For incoming mails to be sent to the [IP address of the] jail, update your MX records in DNS to point to the hostname/IP address of the jail.
2. To send emails from the host to the jail instance, send them to user@jail.domain.tld.
 
1. For incoming mails to be sent to the [IP address of the] jail, update your MX records in DNS to point to the hostname/IP address of the jail.
2. To send emails from the host to the jail instance, send them to user@jail.domain.tld.
Thanks for your help, I forgot to mention that the jail does not have a public IP so unfortunately these solutions wouldn't apply. Apart from the port 25 being forwarded by the host and SSH (key-based authentication only - to be used for IMAP tunneling), I do not want to expose the jail to the internet for security reasons.

Edit1: actually the second point would work, my mistake (many thanks). However your first suggestion cannot be used here I'm afraid. The second point will only work is the first point is addressed.

Edit2: Okay, actually the first point is as simple as setting the below in rc.conf:
Code:
sendmail_enable="NO"

Which apparently only disables inbound emails handling (which is exactly what I am after). I can then set:

Code:
sendmail_outbound_enable="YES"

To retain system emails, and I only need to configure an external alias for root as you suggested.

Problem solved!
 
Awesome! I didn't fully understand your questions, but now that you say the jail is using an IP address which is internal to the host, it makes more sense. Too bad my brief answers weren't quite correct but I'm glad you worked it out. Sweet! For some reason email is something that I keep getting confused about, with all the different protocols (SMTP, POP3, DNS...) and applications (MUA, MTA..) involved.
 
Have the sendmail on the host send system emails to a specific user in the jail
Configure sendmail on the host to use the mailserver jail as a so-called "smart-host". That will cause all mail (that's not local) to be forwarded to the "smart-host". You can then use aliases(5) to forward root's mail to myuser@example.com for example.
 
Back
Top