Merge pull request #296 from chriswells0/require-interface
Verify interface exists when starting jail.
This commit is contained in:
@@ -67,11 +67,21 @@ for _jail in ${JAILS}; do
|
|||||||
|
|
||||||
## test if not running
|
## test if not running
|
||||||
elif [ ! "$(jls name | awk "/^${_jail}$/")" ]; then
|
elif [ ! "$(jls name | awk "/^${_jail}$/")" ]; then
|
||||||
|
# Verify that the configured interface exists. -- cwells
|
||||||
|
if [ "$(bastille config $_jail get vnet)" != 'enabled' ]; then
|
||||||
|
_interface=$(bastille config $_jail get interface)
|
||||||
|
if ! ifconfig | grep "^${_interface}:" >/dev/null; then
|
||||||
|
error_notify "Error: ${_interface} interface does not exist."
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
## warn if matching configured (but not online) ip4.addr, ignore if there's no ip4.addr entry
|
## warn if matching configured (but not online) ip4.addr, ignore if there's no ip4.addr entry
|
||||||
ip=$(grep 'ip4.addr' "${bastille_jailsdir}/${_jail}/jail.conf" | awk '{print $3}' | sed 's/\;//g')
|
ip=$(grep 'ip4.addr' "${bastille_jailsdir}/${_jail}/jail.conf" | awk '{print $3}' | sed 's/\;//g')
|
||||||
if [ -n "${ip}" ]; then
|
if [ -n "${ip}" ]; then
|
||||||
if ifconfig | grep -w "${ip}" >/dev/null; then
|
if ifconfig | grep -w "${ip}" >/dev/null; then
|
||||||
error_exit "Error: IP address (${ip}) already in use."
|
error_notify "Error: IP address (${ip}) already in use."
|
||||||
|
continue
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user