mirror of
https://github.com/hackacad/bastille.git
synced 2026-01-01 18:30:26 +01:00
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
|
||||
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
|
||||
ip=$(grep 'ip4.addr' "${bastille_jailsdir}/${_jail}/jail.conf" | awk '{print $3}' | sed 's/\;//g')
|
||||
if [ -n "${ip}" ]; 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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user