Skip to content
Snippets Groups Projects
Commit 26b3685f authored by Elian Loraux's avatar Elian Loraux
Browse files

add fail2ban action

parent 99a395b6
No related branches found
No related tags found
1 merge request!3Fail2ban
...@@ -161,6 +161,23 @@ case $action in ...@@ -161,6 +161,23 @@ case $action in
cd $DIR/dolibarr_src cd $DIR/dolibarr_src
ctags -R --fields=+aimlS --languages=php ctags -R --fields=+aimlS --languages=php
;; ;;
"fail2ban")
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit
fi
workdir=$PWD
echo $workdir
read -p "Give name of instance: " name
echo $name
if [ -f "/etc/fail2ban/jail.d/dolibarr_${name}.conf" ]; then
echo "The jail 'etc/fail2ban/jail.d/dolibarr_${name}.conf' alredy exist."
exit
fi
cp $workdir/fail2ban/dolibarr_filter.conf /etc/fail2ban/filter.d/dolibarr.conf
cp $workdir/fail2ban/dolibarr_jail.conf /etc/fail2ban/jail.d/dolibarr_${name}.conf
sed -i "s|LOG_PATH|$workdir/dolibarr_src/documents/dolibarr.log|g" /etc/fail2ban/jail.d/dolibarr_${name}.conf
;;
*) *)
echo "ERROR: No command given" echo "ERROR: No command given"
usage usage
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment