mirror of
https://github.com/hackacad/bastille.git
synced 2025-12-25 05:53:21 +01:00
Merge branch 'master' of https://github.com/tschettervictor/bastille into doc-examples-and-updates
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
config
|
||||
======
|
||||
|
||||
Get or set properties for targeted jail(s).
|
||||
Get,set or remove properties from targeted jail(s).
|
||||
|
||||
Getting a property that *is* defined in jail.conf:
|
||||
|
||||
@@ -26,10 +26,19 @@ Setting a property:
|
||||
|
||||
The restart message will appear every time a property is set.
|
||||
|
||||
Removing a property:
|
||||
|
||||
.. code-block:: shell
|
||||
|
||||
ishmael ~ # bastille config azkaban remove allow.mlock
|
||||
A restart is required for the changes to be applied. See 'bastille restart azkaban'.
|
||||
|
||||
The restart message will appear every time a property is removed.
|
||||
|
||||
.. code-block:: shell
|
||||
|
||||
ishmael ~ # bastille config help
|
||||
Usage: bastille config TARGET [get|set] PROPERTY_NAME NEW_VALUE
|
||||
Usage: bastille config TARGET [get|set|remove] PROPERTY [VALUE]
|
||||
Options:
|
||||
|
||||
-x | --debug Enable debug mode.
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
|
||||
|
||||
usage() {
|
||||
error_notify "Usage: bastille config TARGET [get|set] PROPERTY_NAME NEW_VALUE"
|
||||
error_notify "Usage: bastille config TARGET [get|set|remove] PROPERTY [VALUE]"
|
||||
cat << EOF
|
||||
Options:
|
||||
|
||||
@@ -87,9 +87,9 @@ shift 2
|
||||
set_target "${TARGET}"
|
||||
|
||||
case "${ACTION}" in
|
||||
get)
|
||||
get|remove)
|
||||
if [ "$#" -ne 1 ]; then
|
||||
error_notify 'Too many parameters for a "get" operation.'
|
||||
error_notify 'Too many parameters for [get|remove] operation.'
|
||||
usage
|
||||
fi
|
||||
;;
|
||||
@@ -183,6 +183,12 @@ for _jail in ${JAILS}; do
|
||||
else
|
||||
echo "${_output}"
|
||||
fi
|
||||
elif [ "${ACTION}" = "remove" ]; then
|
||||
if [ "$(bastille config ${_jail} get ${PROPERTY})" != "not set" ]; then
|
||||
sed -i '' "/.*${PROPERTY}.*/d" "${FILE}"
|
||||
else
|
||||
error_exit "Value not present in jail.conf: ${PROPERTY}"
|
||||
fi
|
||||
else # Setting the value. -- cwells
|
||||
if [ -n "${VALUE}" ]; then
|
||||
VALUE=$(echo "${VALUE}" | sed 's/\//\\\//g')
|
||||
@@ -233,7 +239,7 @@ for _jail in ${JAILS}; do
|
||||
done
|
||||
|
||||
# Only display this message once at the end (not for every jail). -- cwells
|
||||
if [ "${ACTION}" = 'set' ] && [ -z "${BASTILLE_PROPERTY}" ]; then
|
||||
if { [ "${ACTION}" = "set" ] || [ "${ACTION}" = "remove" ]; } && [ -z "${BASTILLE_PROPERTY}" ]; then
|
||||
info "A restart is required for the changes to be applied. See 'bastille restart'."
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user