Merge pull request #289 from chriswells0/limits-fixes
Update existing limit when a new value is provided.
This commit is contained in:
@@ -64,8 +64,12 @@ for _jail in ${JAILS}; do
|
|||||||
_rctl_rule="jail:${_jail}:${OPTION}:deny=${VALUE}/jail"
|
_rctl_rule="jail:${_jail}:${OPTION}:deny=${VALUE}/jail"
|
||||||
_rctl_rule_log="jail:${_jail}:${OPTION}:log=${VALUE}/jail"
|
_rctl_rule_log="jail:${_jail}:${OPTION}:log=${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"
|
||||||
echo "${_rctl_rule_log}" >> "${bastille_jailsdir}/${_jail}/rctl.conf"
|
echo "${_rctl_rule_log}" >> "${bastille_jailsdir}/${_jail}/rctl.conf"
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user