Merge pull request #151 from JRGTH/master

Return proper warning messages, code cleanup
This commit is contained in:
Christer Edwards
2020-02-14 08:46:18 -07:00
committed by GitHub
4 changed files with 13 additions and 10 deletions

View File

@@ -69,6 +69,6 @@ fi
for _jail in ${JAILS}; do
echo -e "${COLOR_GREEN}[${_jail}]:${COLOR_RESET}"
echo -e "${TYPE} ${VALUE}"
rctl -a jail:${_jail}:${OPTION}:deny=${VALUE}/jail
rctl -a jail:"${_jail}":"${OPTION}":deny="${VALUE}/jail"
echo -e "${COLOR_RESET}"
done

View File

@@ -113,6 +113,3 @@ while [ $# -gt 0 ]; do
;;
esac
done

View File

@@ -55,6 +55,10 @@ if [ "${TARGET}" = 'ALL' ]; then
fi
if [ "${TARGET}" != 'ALL' ]; then
JAILS=$(bastille list jails | awk "/^${TARGET}$/")
## check if exist
if [ ! -d "${bastille_jailsdir}/${TARGET}" ]; then
echo -e "${COLOR_RED}[${TARGET}]: Not found.${COLOR_RESET}"
fi
fi
for _jail in ${JAILS}; do
@@ -64,14 +68,14 @@ for _jail in ${JAILS}; do
## test if not running
elif [ ! "$(jls name | awk "/^${_jail}$/")" ]; then
## warn if matching configured (but not online) ip4.addr
## warn if matching configured (but not online) ip4.addr
ip=$(grep 'ip4.addr' "${bastille_jailsdir}/${_jail}/jail.conf" | awk '{print $3}' | sed 's/\;//g')
if ifconfig | grep -w "$ip" >/dev/null; then
echo -e "${COLOR_RED}Error: IP address ($ip) already in use.${COLOR_RESET}"
if ifconfig | grep -w "${ip}" >/dev/null; then
echo -e "${COLOR_RED}Error: IP address (${ip}) already in use.${COLOR_RESET}"
exit 1
fi
## start the container
## start the container
echo -e "${COLOR_GREEN}[${_jail}]:${COLOR_RESET}"
jail -f "${bastille_jailsdir}/${_jail}/jail.conf" -c ${_jail}

View File

@@ -55,8 +55,10 @@ if [ "${TARGET}" = 'ALL' ]; then
fi
if [ "${TARGET}" != 'ALL' ]; then
JAILS=$(jls name | awk "/^${TARGET}$/")
## test if not running
if [ ! "$(jls name | awk "/^${TARGET}$/")" ]; then
## check if exist or not running
if [ ! -d "${bastille_jailsdir}/${TARGET}" ]; then
echo -e "${COLOR_RED}[${TARGET}]: Not found.${COLOR_RESET}"
elif [ ! "$(jls name | awk "/^${TARGET}$/")" ]; then
echo -e "${COLOR_RED}[${TARGET}]: Not started.${COLOR_RESET}"
fi
fi