V8.00.000.2025.06.17
Signed-off-by: Marc S. Weidner <msw@coresecret.dev>
This commit is contained in:
@@ -48,7 +48,7 @@ f2bchk(){
|
||||
--log=*) log="${arg#--log=}";;
|
||||
--output=*) output="${arg#--output=}";;
|
||||
*)
|
||||
printf "%s[ERROR]%s Unknown argument: '%s' %s" "${CRED}" "${CRES}" "${arg}" "${CRED}"
|
||||
printf "%b[ERROR]%b Unknown argument: '%s' %b" "${CRED}" "${CRES}" "${arg}" "${CRED}"
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
@@ -60,7 +60,7 @@ f2bchk(){
|
||||
matched) flag="--print-all-matched"; suffix="all.matched";;
|
||||
missed) flag="--print-all-missed"; suffix="all.missed";;
|
||||
*)
|
||||
printf "%s[ERROR]%s Invalid mode: '%s' %s" "${CRED}" "${CRES}" "${mode}" "${NL}"
|
||||
printf "%b[ERROR]%b Invalid mode: '%s' %b" "${CRED}" "${CRES}" "${mode}" "${NL}"
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
@@ -72,24 +72,24 @@ f2bchk(){
|
||||
fi
|
||||
|
||||
if [[ ! -r "${log}" ]]; then
|
||||
printf "%s[ERROR]%s Log file '%s' not found or not readable. %s" "${CRED}" "${CRES}" "${log}" "${NL}"
|
||||
printf "%b[ERROR]%b Log file '%s' not found or not readable. %b" "${CRED}" "${CRES}" "${log}" "${NL}"
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [[ ! -r "${filter}" ]]; then
|
||||
printf "%s[ERROR]%s Filter file '%s' not found or not readable. %s" "${CRED}" "${CRES}" "${filter}" "${NL}"
|
||||
printf "%b[ERROR]%b Filter file '%s' not found or not readable. %b" "${CRED}" "${CRES}" "${filter}" "${NL}"
|
||||
return 1
|
||||
fi
|
||||
|
||||
printf "%s[INFO]%s Running: fail2ban-regex '%s %s %s' %s" "${CGRE}" "${CRES}" "${log}" "${filter}" "${flag}" "${NL}"
|
||||
printf "%b[INFO]%b Running: fail2ban-regex '%s %s %s' %b" "${CGRE}" "${CRES}" "${log}" "${filter}" "${flag}" "${NL}"
|
||||
|
||||
if fail2ban-regex "${log}" "${filter}" "${flag}" >| "${output}"; then
|
||||
|
||||
printf "%s[SUCCESS]%s Saved log to: '%s' %s" "${CGRE}" "${CRES}" "${output}" "${NL}"
|
||||
printf "You can view it with: cat %s%s" "${output}" "${NL}"
|
||||
printf "%b[SUCCESS]%b Saved log to: '%s' %b" "${CGRE}" "${CRES}" "${output}" "${NL}"
|
||||
printf "You can view it with: cat %s%b" "${output}" "${NL}"
|
||||
else
|
||||
|
||||
printf "%s[ERROR]%s fail2ban-regex execution failed. %s" "${CRED}" "${CRES}" "${NL}"
|
||||
printf "%b[ERROR]%b fail2ban-regex execution failed. %b" "${CRED}" "${CRES}" "${NL}"
|
||||
return 1
|
||||
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user