mirror of
https://github.com/hackacad/bastille.git
synced 2025-12-21 17:52:01 +01:00
Check if IP address is in use.
This commit is contained in:
@@ -58,7 +58,10 @@ validate_ip() {
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
echo -e "${COLOR_GREEN}Valid: ($ip).${COLOR_RESET}"
|
if ifconfig | grep -w "$ip" >/dev/null; then
|
||||||
|
echo -e "${COLOR_YELLOW}Warning: ip address already in use ($ip).${COLOR_RESET}"
|
||||||
|
else
|
||||||
|
echo -e "${COLOR_GREEN}Valid: ($ip).${COLOR_RESET}"
|
||||||
else
|
else
|
||||||
echo -e "${COLOR_RED}Invalid: ($ip).${COLOR_RESET}"
|
echo -e "${COLOR_RED}Invalid: ($ip).${COLOR_RESET}"
|
||||||
exit 1
|
exit 1
|
||||||
|
|||||||
@@ -66,7 +66,11 @@ for _jail in ${JAILS}; do
|
|||||||
elif [ ! "$(jls name | awk "/^${_jail}$/")" ]; then
|
elif [ ! "$(jls name | awk "/^${_jail}$/")" ]; then
|
||||||
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}
|
||||||
|
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}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
## add rctl limits
|
## add rctl limits
|
||||||
if [ -s "${bastille_jailsdir}/${_jail}/rctl.conf" ]; then
|
if [ -s "${bastille_jailsdir}/${_jail}/rctl.conf" ]; then
|
||||||
while read _limits; do
|
while read _limits; do
|
||||||
|
|||||||
Reference in New Issue
Block a user