LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 01-12-2021, 06:02 AM   #1
n00b_noob
Member
 
Registered: Sep 2020
Posts: 436

Rep: Reputation: Disabled
Post How to configure Fail2Ban?


Hello,
I found a tutorial to protect some services with Fail2Ban:
Quote:
# nano /etc/fail2ban/jail.local
Add the following lines at the end of the file:
Code:
[apache-auth]
enabled = true
port    = http,https
logpath = %(apache_error_log)s

[apache-badbots]
enabled = true
port    = http,https
logpath = %(apache_access_log)s
bantime = 48h
maxretry = 1

[apache-noscript]
enabled = true
port    = http,https
logpath = %(apache_error_log)s
What is "[apache-auth]"? Is it a predefined rule for Fail2Ban and is under the "filter.d" directory? I mean is that "[apache-auth]" refer to the "apache-auth.conf" file:
Code:
# ls filter.d/
3proxy.conf                exim-spam.conf             proftpd.conf
apache-auth.conf           freeswitch.conf            pure-ftpd.conf
apache-badbots.conf        froxlor-auth.conf          qmail.conf
apache-botsearch.conf      groupoffice.conf           recidive.conf
apache-common.conf         gssftpd.conf               roundcube-auth.conf
apache-fakegooglebot.conf  guacamole.conf             screensharingd.conf
apache-modsecurity.conf    haproxy-http-auth.conf     selinux-common.conf
apache-nohome.conf         horde.conf                 selinux-ssh.conf
apache-noscript.conf       ignorecommands/            sendmail-auth.conf
apache-overflows.conf      kerio.conf                 sendmail-reject.conf
apache-pass.conf           lighttpd-auth.conf         sieve.conf
apache-shellshock.conf     mongodb-auth.conf          slapd.conf
assp.conf                  monit.conf                 sogo-auth.conf
asterisk.conf              murmur.conf                solid-pop3d.conf
bitwarden.conf             mysqld-auth.conf           squid.conf
botsearch-common.conf      nagios.conf                squirrelmail.conf
centreon.conf              named-refused.conf         sshd.conf
common.conf                nginx-botsearch.conf       stunnel.conf
counter-strike.conf        nginx-http-auth.conf       suhosin.conf
courier-auth.conf          nginx-limit-req.conf       tine20.conf
courier-smtp.conf          nsd.conf                   traefik-auth.conf
cyrus-imap.conf            openhab.conf               uwimap-auth.conf
directadmin.conf           openwebmail.conf           vsftpd.conf
domino-smtp.conf           oracleims.conf             webmin-auth.conf
dovecot.conf               pam-generic.conf           wuftpd.conf
dropbear.conf              perdition.conf             xinetd-fail.conf
drupal-auth.conf           phpmyadmin-syslog.conf     znc-adminlog.conf
ejabberd-auth.conf         php-url-fopen.conf         zoneminder.conf
exim-common.conf           portsentry.conf            
exim.conf                  postfix.conf
Apache logs are:
Code:
# ls /var/log/httpd/
access_log        error_log         modsec_audit.log  modsec_debug.log
But "logpath = %(apache_error_log)s" !!! The "apache_error_log" must be change to "error_log" ?

Thank you.
 
Old 01-12-2021, 07:56 AM   #2
wpeckham
LQ Guru
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS, Manjaro
Posts: 5,691

Rep: Reputation: 2716Reputation: 2716Reputation: 2716Reputation: 2716Reputation: 2716Reputation: 2716Reputation: 2716Reputation: 2716Reputation: 2716Reputation: 2716Reputation: 2716
Did you check the how-to documents on the failtoban project pages? https://www.fail2ban.org/wiki/index.php/HOWTOs

Keep in mind also that APACHE changes often, and you might have to adjust for those changes.
 
Old 01-12-2021, 08:06 AM   #3
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,700

Rep: Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972
Quote:
Originally Posted by n00b_noob View Post
Hello,
I found a tutorial to protect some services with Fail2Ban:
Code:
# nano /etc/fail2ban/jail.local
Add the following lines at the end of the file:
Code:
[apache-auth]
enabled = true
port    = http,https
logpath = %(apache_error_log)s

[apache-badbots]
enabled = true
port    = http,https
logpath = %(apache_access_log)s
bantime = 48h
maxretry = 1

[apache-noscript]
enabled = true
port    = http,https
logpath = %(apache_error_log)
Great....and if you told us WHICH tutorial you followed, for what version/distro of Linux, we'd have some ideas what you've done/tried. But you haven't.
Quote:
What is "[apache-auth]"? Is it a predefined rule for Fail2Ban and is under the "filter.d" directory? I mean is that "[apache-auth]" refer to the "apache-auth.conf" file:
Code:
# ls filter.d/
3proxy.conf                exim-spam.conf             proftpd.conf
apache-auth.conf           freeswitch.conf            pure-ftpd.conf
apache-badbots.conf        froxlor-auth.conf          qmail.conf
apache-botsearch.conf      groupoffice.conf           recidive.conf
apache-common.conf         gssftpd.conf               roundcube-auth.conf
apache-fakegooglebot.conf  guacamole.conf             screensharingd.conf
apache-modsecurity.conf    haproxy-http-auth.conf     selinux-common.conf
apache-nohome.conf         horde.conf                 selinux-ssh.conf
apache-noscript.conf       ignorecommands/            sendmail-auth.conf
apache-overflows.conf      kerio.conf                 sendmail-reject.conf
apache-pass.conf           lighttpd-auth.conf         sieve.conf
apache-shellshock.conf     mongodb-auth.conf          slapd.conf
assp.conf                  monit.conf                 sogo-auth.conf
asterisk.conf              murmur.conf                solid-pop3d.conf
bitwarden.conf             mysqld-auth.conf           squid.conf
botsearch-common.conf      nagios.conf                squirrelmail.conf
centreon.conf              named-refused.conf         sshd.conf
common.conf                nginx-botsearch.conf       stunnel.conf
counter-strike.conf        nginx-http-auth.conf       suhosin.conf
courier-auth.conf          nginx-limit-req.conf       tine20.conf
courier-smtp.conf          nsd.conf                   traefik-auth.conf
cyrus-imap.conf            openhab.conf               uwimap-auth.conf
directadmin.conf           openwebmail.conf           vsftpd.conf
domino-smtp.conf           oracleims.conf             webmin-auth.conf
dovecot.conf               pam-generic.conf           wuftpd.conf
dropbear.conf              perdition.conf             xinetd-fail.conf
drupal-auth.conf           phpmyadmin-syslog.conf     znc-adminlog.conf
ejabberd-auth.conf         php-url-fopen.conf         zoneminder.conf
exim-common.conf           portsentry.conf            
exim.conf                  postfix.conf
Apache logs are:
Code:
# ls /var/log/httpd/access_log        error_log         modsec_audit.log  modsec_debug.log
But "logpath = %(apache_error_log)s" !!! The "apache_error_log" must be change to "error_log" ?Thank you.
Did you try reading the fail2ban documentation?
https://www.fail2ban.org/wiki/index.php/MANUAL_0_8

....because that file is mentioned in there. Did you try to do basic research about fail2ban and what that directive does? Because there is a LOT of it available with a brief Google search. And again, these seem to be homework questions....so show us your efforts.
 
Old 01-13-2021, 01:24 AM   #4
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
I am now starting to report this user's threads indicriminately. 69 in 4 months, about the same basic 2-3 topics, that's just insane.
 
1 members found this post helpful.
Old 01-13-2021, 02:25 AM   #5
descendant_command
Senior Member
 
Registered: Mar 2012
Posts: 1,876

Rep: Reputation: 643Reputation: 643Reputation: 643Reputation: 643Reputation: 643Reputation: 643
Add them to the number clocked up as hack3rcon
 
1 members found this post helpful.
Old 01-13-2021, 08:11 AM   #6
shruggy
Senior Member
 
Registered: Mar 2020
Posts: 3,677

Rep: Reputation: Disabled
And not only here on LQ: https://forums.centos.org/search.php...uthor_id=92983
 
1 members found this post helpful.
Old 01-13-2021, 08:25 AM   #7
jeremy
root
 
Registered: Jun 2000
Distribution: Debian, Red Hat, Slackware, Fedora, Ubuntu
Posts: 13,602

Rep: Reputation: 4084Reputation: 4084Reputation: 4084Reputation: 4084Reputation: 4084Reputation: 4084Reputation: 4084Reputation: 4084Reputation: 4084Reputation: 4084Reputation: 4084
n00b_noob,

Please read https://www.linuxquestions.org/quest...#faq_lqwelcome and keep it in mind in your future participation at LQ. Thanks.

--jeremy
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: How to Install and Configure Fail2ban on CentOS 8 LXer Syndicated Linux News 0 09-10-2020 05:33 PM
LXer: How to Install and Configure Fail2ban on Ubuntu 20.04 LXer Syndicated Linux News 0 08-20-2020 08:33 AM
LXer: How to install and configure Fail2Ban on your Ubuntu server LXer Syndicated Linux News 0 06-09-2015 01:22 AM
LXer: How to configure fail2ban to protect Apache HTTP server LXer Syndicated Linux News 0 12-22-2014 04:21 PM
how to configure fail2ban in PCLOS 2007? mexbeachbum Linux - Security 2 09-26-2007 09:19 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 08:30 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration