From owner-freebsd-jail@freebsd.org Fri Feb 5 23:01:12 2016 Return-Path: Delivered-To: freebsd-jail@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 C8804A77339 for ; Fri, 5 Feb 2016 23:01:12 +0000 (UTC) (envelope-from markham@ssimicro.com) Received: from mail.ssimicro.com (mail.ssimicro.com [64.247.129.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "*.ssimicro.com", Issuer "RapidSSL SHA256 CA - G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9482CCED for ; Fri, 5 Feb 2016 23:01:11 +0000 (UTC) (envelope-from markham@ssimicro.com) Received: from markham.ssimicro.com (markham.ssimicro.com [64.247.130.99]) (authenticated bits=0) by mail.ssimicro.com (8.14.7/8.14.7) with ESMTP id u15MvaHD051135 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT) for ; Fri, 5 Feb 2016 15:57:37 -0700 (MST) From: markham breitbach Subject: exec_poststart To: freebsd-jail@freebsd.org X-Enigmail-Draft-Status: N1110 Message-ID: <56B529AF.90901@ssimicro.com> Date: Fri, 5 Feb 2016 16:01:03 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.20 X-BeenThere: freebsd-jail@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "Discussion about FreeBSD jail\(8\)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Feb 2016 23:01:13 -0000 I am trying to figure out how to get a script to figure out the hostname of the jail that is starting without having to manual set that as a command line parameter (as illustrated). It seems that the script is getting executed in a clean environment, regardless of the exec.clean setting. Is this a bug? The man pages aren't particularly clear on the expected behaviour of this. I am running FreeBSD 10.2. I would like to be able to set exec.poststart as a global default so it doesn't need to be defined per jail. Thanks, -Markham ####################JAIL.CONF######################### exec.clean =3D 0 ; # HOW TO PASS THE JAILNAME TO THIS SCRIPT? exec.poststart +=3D "/path/to/script.sh"; # My test jail testjail_example_com { # THIS WORKS exec.poststart +=3D "/path/to/script.sh testjail.example.com"; exec.clean =3D 0 ; host.hostname =3D "testjail.example.com"; path =3D "/usr/jails/testjail.example.com"; ip4.addr +=3D "net0|192.0.2.1/24"; exec.system_user =3D "root"; exec.jail_user =3D "root"; exec.start +=3D "/bin/sh /etc/rc"; exec.stop =3D ""; exec.consolelog =3D "/var/log/jail_testjail_example_com_console.log";= mount.fstab =3D "/etc/testjail_example_com"; mount.devfs; devfs_ruleset =3D "5"; mount.fdescfs; mount.procfs; allow.mount; allow.set_hostname =3D 0; allow.sysvipc =3D 0; allow.raw_sockets=3D1; }