Sendmail in a jail

Matthew Seaman m.seaman at infracaninophile.co.uk
Sun Dec 21 03:49:06 PST 2003


On Sun, Dec 21, 2003 at 01:26:27PM +0200, Ian Barnes wrote:

> nope, it doesnt. Anyway that i could debug it ? If i parse the variables
> through to the screen they are fine, if i run it on another server not in a
> jail it works, so my code i fine, now it just doesnt want to send. Any ideas
> as to what i could do?

You need to run a sendmail MSP process in the jail, and modify the
configuration so that it submits the message to your main server
(presumably in your host environment, although it could live in
another jail) via it's external IP address.

Try this, in the jail:

    # cd /etc/mail
    # cp freebsd.submit.mc submit.mc
    # vi submit.mc

here, change the last line from

    FEATURE(`msp', `[127.0.0.1]')dnl

to

    FEATURE(`msp', `[smtp.example.com]', `MSA')dnl

Obviously, you want to replace 'smtp.example.com' with the hostname of
your mailserver -- or it's IP address.  You need the [square brackets]
as they stop sendmail trying to look up MXes in the DNS and instead
deliver straight to the named machine.  Now rebuild the .cf and
install it:

    # make
    # make install

In /etc/rc.conf in the jail set the following so that only the
sendmail MSP process gets started:

    sendmail_enable="NO"
    sendmail_msp_queue_enable="YES"
    sendmail_outbound_enable="NO"
    sendmail_submit_enable="NO"

and you can start sendmail up from within /etc/mail by:

    # make restart

Oh, and make sure port 587 on the mail server isn't firewalled off
from the jail environment...

The problem is that the loopback interface isn't really shared between
jail and host environment -- a daemon listening on 127.0.0.1 in the
host won't pick up connections to 127.0.0.1 in the jail, which is
exactly how the MSP tries to communicate with the MTA process.

	Cheers,

	Matthew

-- 
Dr Matthew J Seaman MA, D.Phil.                       26 The Paddocks
                                                      Savill Way
PGP: http://www.infracaninophile.co.uk/pgpkey         Marlow
Tel: +44 1628 476614                                  Bucks., SL7 1TH UK
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20031221/c681e4b2/attachment.bin


More information about the freebsd-questions mailing list