From owner-freebsd-hackers@freebsd.org Mon Nov 16 22:12:58 2015 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A0500A3194A for ; Mon, 16 Nov 2015 22:12:58 +0000 (UTC) (envelope-from phk@phk.freebsd.dk) Received: from mailman.ysv.freebsd.org (mailman.ysv.freebsd.org [IPv6:2001:1900:2254:206a::50:5]) by mx1.freebsd.org (Postfix) with ESMTP id 8C98C1B23 for ; Mon, 16 Nov 2015 22:12:58 +0000 (UTC) (envelope-from phk@phk.freebsd.dk) Received: by mailman.ysv.freebsd.org (Postfix) id 8BB84A31949; Mon, 16 Nov 2015 22:12:58 +0000 (UTC) Delivered-To: hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8B4F0A31948 for ; Mon, 16 Nov 2015 22:12:58 +0000 (UTC) (envelope-from phk@phk.freebsd.dk) Received: from phk.freebsd.dk (phk.freebsd.dk [130.225.244.222]) by mx1.freebsd.org (Postfix) with ESMTP id 55A211B22 for ; Mon, 16 Nov 2015 22:12:58 +0000 (UTC) (envelope-from phk@phk.freebsd.dk) Received: from critter.freebsd.dk (unknown [192.168.55.3]) by phk.freebsd.dk (Postfix) with ESMTP id AA07F4F418 for ; Mon, 16 Nov 2015 22:12:50 +0000 (UTC) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.15.2/8.15.2) with ESMTP id tAGMCoex049035 for ; Mon, 16 Nov 2015 22:12:50 GMT (envelope-from phk@phk.freebsd.dk) To: hackers@freebsd.org Subject: Getting rid of 2*Njail sendmail processes From: Poul-Henning Kamp MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <49025.1447711969.1@critter.freebsd.dk> Date: Mon, 16 Nov 2015 22:12:50 +0000 Message-ID: <49034.1447711970@critter.freebsd.dk> X-Mailman-Approved-At: Mon, 16 Nov 2015 23:12:51 +0000 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Nov 2015 22:12:58 -0000 It has always bothered me to no end, to have to run two sendmail processes in jails, just to be able to get the cron emails. Tonight I figured out how to avoid that: In the hosts rc.conf: sendmail_enable=YES That makes sendmail listen to *:25 In the jails rc.conf: sendmail_enable=NONE Add the magic sauce: Put all jail hostnames into the hosts /etc/mail/local-host-names The quick way: jls | awk '{print $3}' > /etc/mail/local-host-names That makes the hosts sendmail treat all the jails as itself. Clean up, from the host: killall sendmail sh /etc/rc.d/sendmail start Congratulations: You just got rid of 2*Njail sendmail processes. Obviously this doesn't allow you to receive email in the jails, so it is not a general solution for all jails, but only for the very common case where the only email activity is out of the jails. Poul-Henning PS: Somebody please stick this in the relevant handbooks/docs... -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence.