@@ -63,8 +63,12 @@ for _jail in ${JAILS}; do
|
|||||||
|
|
||||||
_rctl_rule="jail:${_jail}:${OPTION}:deny=${VALUE}/jail"
|
_rctl_rule="jail:${_jail}:${OPTION}:deny=${VALUE}/jail"
|
||||||
|
|
||||||
## if entry doesn't exist, add; else show existing entry
|
# Check whether the entry already exists and, if so, update it. -- cwells
|
||||||
if ! grep -qs "${_rctl_rule}" "${bastille_jailsdir}/${_jail}/rctl.conf"; then
|
if grep -qs "jail:${_jail}:${OPTION}:deny" "${bastille_jailsdir}/${_jail}/rctl.conf"; then
|
||||||
|
_escaped_option=$(echo "${OPTION}" | sed 's/\//\\\//g')
|
||||||
|
_escaped_rctl_rule=$(echo "${_rctl_rule}" | sed 's/\//\\\//g')
|
||||||
|
sed -i '' -E "s/jail:${_jail}:${_escaped_option}:deny.+/${_escaped_rctl_rule}/" "${bastille_jailsdir}/${_jail}/rctl.conf"
|
||||||
|
else # Just append the entry. -- cwells
|
||||||
echo "${_rctl_rule}" >> "${bastille_jailsdir}/${_jail}/rctl.conf"
|
echo "${_rctl_rule}" >> "${bastille_jailsdir}/${_jail}/rctl.conf"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user