mirror of
https://github.com/hackacad/bastille.git
synced 2026-01-03 19:23:42 +01:00
Merge pull request #151 from JRGTH/master
Return proper warning messages, code cleanup
This commit is contained in:
@@ -69,6 +69,6 @@ fi
|
|||||||
for _jail in ${JAILS}; do
|
for _jail in ${JAILS}; do
|
||||||
echo -e "${COLOR_GREEN}[${_jail}]:${COLOR_RESET}"
|
echo -e "${COLOR_GREEN}[${_jail}]:${COLOR_RESET}"
|
||||||
echo -e "${TYPE} ${VALUE}"
|
echo -e "${TYPE} ${VALUE}"
|
||||||
rctl -a jail:${_jail}:${OPTION}:deny=${VALUE}/jail
|
rctl -a jail:"${_jail}":"${OPTION}":deny="${VALUE}/jail"
|
||||||
echo -e "${COLOR_RESET}"
|
echo -e "${COLOR_RESET}"
|
||||||
done
|
done
|
||||||
|
|||||||
@@ -113,6 +113,3 @@ while [ $# -gt 0 ]; do
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -55,6 +55,10 @@ if [ "${TARGET}" = 'ALL' ]; then
|
|||||||
fi
|
fi
|
||||||
if [ "${TARGET}" != 'ALL' ]; then
|
if [ "${TARGET}" != 'ALL' ]; then
|
||||||
JAILS=$(bastille list jails | awk "/^${TARGET}$/")
|
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
|
fi
|
||||||
|
|
||||||
for _jail in ${JAILS}; do
|
for _jail in ${JAILS}; do
|
||||||
@@ -64,14 +68,14 @@ 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
|
||||||
## 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')
|
ip=$(grep 'ip4.addr' "${bastille_jailsdir}/${_jail}/jail.conf" | awk '{print $3}' | sed 's/\;//g')
|
||||||
if ifconfig | grep -w "$ip" >/dev/null; then
|
if ifconfig | grep -w "${ip}" >/dev/null; then
|
||||||
echo -e "${COLOR_RED}Error: IP address ($ip) already in use.${COLOR_RESET}"
|
echo -e "${COLOR_RED}Error: IP address (${ip}) already in use.${COLOR_RESET}"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
## start the container
|
## start the container
|
||||||
echo -e "${COLOR_GREEN}[${_jail}]:${COLOR_RESET}"
|
echo -e "${COLOR_GREEN}[${_jail}]:${COLOR_RESET}"
|
||||||
jail -f "${bastille_jailsdir}/${_jail}/jail.conf" -c ${_jail}
|
jail -f "${bastille_jailsdir}/${_jail}/jail.conf" -c ${_jail}
|
||||||
|
|
||||||
|
|||||||
@@ -55,8 +55,10 @@ if [ "${TARGET}" = 'ALL' ]; then
|
|||||||
fi
|
fi
|
||||||
if [ "${TARGET}" != 'ALL' ]; then
|
if [ "${TARGET}" != 'ALL' ]; then
|
||||||
JAILS=$(jls name | awk "/^${TARGET}$/")
|
JAILS=$(jls name | awk "/^${TARGET}$/")
|
||||||
## test if not running
|
## check if exist or not running
|
||||||
if [ ! "$(jls name | awk "/^${TARGET}$/")" ]; then
|
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}"
|
echo -e "${COLOR_RED}[${TARGET}]: Not started.${COLOR_RESET}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user