LinuxQuestions.org
Visit Jeremy's Blog.
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 03-04-2024, 11:26 PM   #1
BluePukeko
LQ Newbie
 
Registered: Mar 2024
Posts: 5

Rep: Reputation: 0
Question fail2ban on a NFS network sharing one log file


I'm restructuring my systems and running everything on a ProxMox hypervisor with one VM being a dedicated NFS file server.
The idea being that I can assign one large disk partition of 3Tb across all servers rather than splitting the 3Tb into smaller chunks for each of up to 10 VM's

As part of this restructuring I'm thinking that the file logs could be shared by all servers as well, in other words one Apache2 log file for each of the apache servers on all the servers with an extra field added to the log record with the machine name or other identifier.

In general this approach looks promising BUT!!!!

Fail2Ban, as far as I have been able to ascertain does not have provision for customising the log file.

It would be particularly useful to combine all log records for Fail2Ban as I could get a better picture of overall attacks and also have all VM's ban IP address that have tried to attack other VM's.

So my question is, has anybody found a way of adding extra fields to the Fail2Ban log file or maybe have some suggestion of work-a-rounds.
 
Old 03-10-2024, 11:21 PM   #2
elgrandeperro
Member
 
Registered: Apr 2021
Posts: 415
Blog Entries: 2

Rep: Reputation: Disabled
That is NOT how apache logs work. They don't open/close the file for each connection, they keep the fd open. So when for instance you rotate the files, most likely the other apaches are going to write into the old file. and chaos will ensue.

You can insert what you want into the apache log file, you would just write a filter in fail2ban to trigger the action. I guess I don't understand your comment perhaps.

One way to unify your fail2ban you can forward the apache logs using syslog to a central server. That server can interpret the log files and push out the fail2ban commands to all your servers. The syslog server can either watch each log or a unified one. There is no problem with "sharing" syslog that you would have with an nfs mount. The only commands it probably need to push is one to ban and ip and one to unban and ip, since the management would be a unified instance.

Last edited by elgrandeperro; 03-10-2024 at 11:26 PM.
 
Old 03-18-2024, 02:16 PM   #3
BluePukeko
LQ Newbie
 
Registered: Mar 2024
Posts: 5

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by elgrandeperro View Post
That is NOT how apache logs work. They don't open/close the file for each connection, they keep the fd open. So when for instance you rotate the files, most likely the other apaches are going to write into the old file. and chaos will ensue.

You can insert what you want into the apache log file, you would just write a filter in fail2ban to trigger the action. I guess I don't understand your comment perhaps.

One way to unify your fail2ban you can forward the apache logs using syslog to a central server. That server can interpret the log files and push out the fail2ban commands to all your servers. The syslog server can either watch each log or a unified one. There is no problem with "sharing" syslog that you would have with an nfs mount. The only commands it probably need to push is one to ban and ip and one to unban and ip, since the management would be a unified instance.
Thanks for your reply.
You have confirmed what I had assumed was must likely the stituation.
From observation of Linux behaviour I was sure if the log files were opened written to and then closed for each entry, or what appeared to be the more likely that they were opened when the application started and closed when the application was closed or restarted.
From many year ago I had the feeling that Unix and most likely Linux used file ID's rather than names to access files and therefore changing a file name or even moving it made no difference to an application accessing the file.
I will now need to review my approach to this concept and find an alternative approach.

Thank you once again for responding.
 
  


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
How to log internal-sftp chroot jailed users access log to /var/log/sftp.log file LittleMaster Linux - Server 0 09-04-2018 03:45 PM
Fail2ban: detect changes in log file in NFS directory? drdidji Linux - Security 8 11-03-2014 12:44 AM
apache log file issue with fail2ban plisken Linux - Security 2 03-24-2014 05:30 PM
fail2ban log errors for ssh jail linuxlover.chaitanya Linux - Security 2 07-24-2010 07:01 AM
[SOLVED] Configuring Conky to read log file entries - apache + fail2ban djsmiley2k Linux - Desktop 1 04-26-2010 04:29 AM

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

All times are GMT -5. The time now is 05:51 PM.

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