diff --git a/cdist/conf/type/__fail2ban/gencode-remote b/cdist/conf/type/__fail2ban/gencode-remote index a3f6933c..8c1ee1b7 100644 --- a/cdist/conf/type/__fail2ban/gencode-remote +++ b/cdist/conf/type/__fail2ban/gencode-remote @@ -20,17 +20,17 @@ config_file="/etc/fail2ban/jail.conf" -if [ -f "$__object/parameter/enable-services" ]; then - enable_services="$(cat "$__object/parameter/enable-services")" +if [ -f "$__object/parameter/enable-jails" ]; then + enable_jails="$(cat "$__object/parameter/enable-jails")" else - enable_services="$__object_id" + enable_jails="$__object_id" fi -services="$(echo $enable_services | sed -e 's/,/ /g')" -for service in $services +jails="$(echo $enable_jails | sed -e 's/,/ /g')" +for jail in $jails do - echo "[$(tput setaf 6)info$(tput sgr 0)] Enabling fail2ban for $service..." >&2 + echo "Enabling fail2ban for $jail..." >&2 cat << EOF -perl -i -pe 'BEGIN{undef $/;} s/\[$service\].*[\n]*enabled.*=.*\n/\[$service\]\n\nenabled = true\n/g' $config_file +perl -i -pe 'BEGIN{undef $/;} s/\[$jail\].*[\n]*enabled.*=.*\n/\[$jail\]\n\nenabled = true\n/g' $config_file EOF done echo "service fail2ban restart" diff --git a/cdist/conf/type/__fail2ban/manifest b/cdist/conf/type/__fail2ban/manifest index 92e98021..8b368bac 100644 --- a/cdist/conf/type/__fail2ban/manifest +++ b/cdist/conf/type/__fail2ban/manifest @@ -31,9 +31,9 @@ case "$os" in require=__package/epel-release __package fail2ban --state present ;; *) - echo "Your operating system ($os) is currently untested for ${__type##*/}." >&2 - echo "If it works, please add it." >&2 - __package fail2ban --state present + echo "Your operating system ($os) is currently not supported by this type (${__type##*/})." >&2 + echo "Please contribute an implementation for it if you can." >&2 + exit 1 ;; esac diff --git a/cdist/conf/type/__fail2ban/parameter/optional b/cdist/conf/type/__fail2ban/parameter/optional index e43ccb4b..25d1f2cf 100644 --- a/cdist/conf/type/__fail2ban/parameter/optional +++ b/cdist/conf/type/__fail2ban/parameter/optional @@ -1 +1 @@ -enable-services \ No newline at end of file +enable-jails