| Summary: | Configuring jail in rc.conf fails to set the jail name correctly | ||
|---|---|---|---|
| Product: | Base System | Reporter: | Frank Leonhardt <freebsd-doc> |
| Component: | misc | Assignee: | freebsd-bugs (Nobody) <bugs> |
| Status: | Closed FIXED | ||
| Severity: | Affects Only Me | ||
| Priority: | Normal | ||
| Version: | Unspecified | ||
| Hardware: | Any | ||
| OS: | Any | ||
I see this has now been fixed in 9.1 and have tracked the change to revision 238102 - the wording meant I didn't find it when I searched earlier. Please ignore! State Changed From-To: open->closed Closed at submitter's request. |
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. 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 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!