From owner-freebsd-jail@FreeBSD.ORG Tue Mar 2 23:18:52 2010 Return-Path: Delivered-To: freebsd-jail@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2C1731065674 for ; Tue, 2 Mar 2010 23:18:52 +0000 (UTC) (envelope-from christias@gmail.com) Received: from mail-bw0-f216.google.com (mail-bw0-f216.google.com [209.85.218.216]) by mx1.freebsd.org (Postfix) with ESMTP id B4D388FC1B for ; Tue, 2 Mar 2010 23:18:51 +0000 (UTC) Received: by bwz8 with SMTP id 8so768189bwz.3 for ; Tue, 02 Mar 2010 15:18:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type; bh=90xn9pSxswy8tqnaHmT7ylvXcT7O05KzTOnIYmD1l74=; b=EUPuMPW1QoR0TcE9EPaeBo9nf0UB1AM5wRr0Kwh8A7DFgpBnYCrwl86rbLTKi5eXjF vrRAkgMo/MnAK19hHXIjyZcSw9XhK7Dju3bL6YylcWXAOEXXyV5fvT9IOjDeToBEuw/l xKGaBW+1/rm6wn9qU0bXjlrALOYwIbS7EEOFg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=ZmApBcopZoU8MaqGcROe+3UEUyL1Zhd33rcnJFuTBwoMcbqrvwcKShT9Omafawzi2W ToI3WwglCWhaKSQJ8mPHQ8hRDkO7xHWheCEpDGmX1BLoqd/C2afhYLGLBojxunanCgDz Lo1m2vcpamG2pyNMIzx4klAkm/DcOFTkU2ZOU= MIME-Version: 1.0 Received: by 10.204.38.77 with SMTP id a13mr5236373bke.26.1267571924299; Tue, 02 Mar 2010 15:18:44 -0800 (PST) In-Reply-To: <20100302135521.GF23214@hs-4.renatasystems.org> References: <20100302135521.GF23214@hs-4.renatasystems.org> Date: Wed, 3 Mar 2010 01:18:44 +0200 Message-ID: From: Panagiotis Christias To: freebsd-jail@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: How could a jail learn which is its parent host? X-BeenThere: freebsd-jail@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Discussion about FreeBSD jail\(8\)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Mar 2010 23:18:52 -0000 On Tue, Mar 2, 2010 at 3:55 PM, Alexey V. Degtyarev wrote: > > On 10:37 Tue 02 Mar, Panagiotis Christias wrote: > >> I am looking for a simple way so each jail could know at any time in >> which (physical) server is hosted. Any suggestions? > > You may push a kernel environment on physical server so it will be > available from within jail. To achieve it, on the mainhost (physical > server) add to /boot/loader.conf: > > x.mainhost="physical.example.com" > > after reboot the mainhost server, you can use x.mainhost env from within > jail (and mainhost as well): > > [root@jail1 ~]# kenv x.mainhost > physical.example.com > > Check kenv(1) and loader.conf(5) for details. Thanks all for your suggestions. Kenv looks like the clearest way to go, although jail_exec_prestart and jail_exec_afterstart can be really useful too. Regards, Panagiotis