Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 12 Jul 2013 19:14:37 GMT
From:      Frank Leonhardt <freebsd-doc@fjl.co.uk>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   misc/180521: Configuring jail in rc.conf fails to set the jail name correctly
Message-ID:  <201307121914.r6CJEbj5093731@oldred.freebsd.org>
Resent-Message-ID: <201307121920.r6CJK2md078544@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         180521
>Category:       misc
>Synopsis:       Configuring jail in rc.conf fails to set the jail name correctly
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Jul 12 19:20:01 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator:     Frank Leonhardt
>Release:        9.0 (and others)
>Organization:
>Environment:
n/a
>Description:
When you configure a jail in rc.conf you give the jail a name and refer to this when using the "service" command to turn it on and off subsequently. However, the jail name is not set as far as the jail system is concerned - if you use jls -v, for example, it will be seen that the name is the same as the jail-ID. This is the default for the "jail" command when no name is specified, but it's not helpful when you've named a jail and might reasonably want to go on referring to it by that name.

>How-To-Repeat:
Create a jailed environments in /usr/jail1, jail2, jail3 &c

Add the following to rc.conf:

jail_enable="YES" 
jail_list="jail1 jail2 jail3"

jail_jail1_rootdir="/usr/jail1"
jail_jail1_hostname="jail1.yourdomain"
jail_jail1_ip="192.168.1.211"

And so on...

Boot the machine or start a jail with:

service jail start jail1
or
/etc/rc.d/jail start jail1

Check to see if it's actually called jail1:

jls -v

Output will be:

bsd9-1# jls -v
   JID  Hostname                      Path
        Name                          State
        CPUSetID
        IP Address(es)
     5  jail1.yourdomain              /usr/jail1
        4                             ACTIVE
        5
        192.168.1.215

It should say "jail1" in the position where it says "4" This fails every time!
>Fix:
Easy...

On line 647 of /etc/rc.d/jail add the -n option.

Current:

       eval ${_setfib} jail ${_flags} -i ${_rootdir} ${_hostname} \
              \"${_addrl}\" ${_exec_start} > ${_tmp_jail} 2>&1 \
              </dev/null

Fixed:

       eval ${_setfib} jail ${_flags} -n ${_jail} -i ${_rootdir} ${_hostname} \
              \"${_addrl}\" ${_exec_start} > ${_tmp_jail} 2>&1 \
              </dev/null



>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201307121914.r6CJEbj5093731>