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 09-18-2017, 08:11 AM   #1
Thiefy
LQ Newbie
 
Registered: Jul 2016
Posts: 24

Rep: Reputation: Disabled
Exclamation Software for protection.


Hi, i got a bit of a problem where i'm being DDOS'ed/BruteForced on my website witch sends from thousands different IP addresses empty refers, and empty post/get packages. I wrote a script witch takes access log, counts how many tries that ip address made if its more then 30 in 10 min it black list's the IP but it's just a temporary solution. So My question is, what software i could use to prevent myself from these kinds of attacks?

EDIT: forgot to mention all the connection's don't come directly to the server comes by proxy.

Thanks in advance.
Thiefy

Last edited by Thiefy; 09-18-2017 at 08:19 AM.
 
Old 09-18-2017, 08:14 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,901

Rep: Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318
probably fail2ban ?
 
Old 09-18-2017, 08:17 AM   #3
Thiefy
LQ Newbie
 
Registered: Jul 2016
Posts: 24

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by pan64 View Post
probably fail2ban ?
Can you argument why you would use it? I know there is few of them like mod_security and snort.


Thanks for the reply
Thiefy.
 
Old 09-18-2017, 12:27 PM   #4
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
I use fail2ban because I don't know mod_security or snort.

"few of them"?

Just sayin'

Last edited by Habitual; 09-18-2017 at 12:29 PM.
 
Old 09-24-2017, 12:41 AM   #5
justmy2cents
Member
 
Registered: May 2017
Location: U.S.
Distribution: Un*x
Posts: 237
Blog Entries: 2

Rep: Reputation: Disabled
In addition to fail2ban I would use psad+fwsnort.. Fwsnort integrates with the firewall which makes it harder to exploit than Snort. Psad is like fail2ban but its blocks IPs that port scan your system. You can set thresholds for what kind of portscans you deem worthy of a ban (like noisy scans or extra stealthy scans)

Last edited by justmy2cents; 09-24-2017 at 12:47 AM.
 
Old 09-24-2017, 09:03 AM   #6
Sefyir
Member
 
Registered: Mar 2015
Distribution: Linux Mint
Posts: 634

Rep: Reputation: 316Reputation: 316Reputation: 316Reputation: 316
I don't believe fail2ban would be very helpful in this case.
Fail2ban operates by blocking connections that have had multiple failed connections from a particular ip address. This isn't true during a DDOS.

You'll need to decide to filter with the firewall or the webserver itself. The firewall (iptables) is good for heavy handed stuff but the webserver can generally do more delicate filtering (like checking for referral types)

For iptables, using something like the length limit may be good for empty requests, conntrack may be good for ensuring connections have actually been established. Make sure to log and check these before implementing instead of just dropping them since you will discover mysterious issues.
https://www.frozentux.net/documents/iptables-tutorial/
Conntrack Length match
Make sure to not lock yourself out by having some external method of logging in / automatic disabling of firewall.
How to prevent myself from locking out of iptables



I don't know the webserver you're using, but nginx has some good tools for filtering connections
https://www.cyberciti.biz/tips/linux...-security.html

Code:
## Deny certain Referers ###
     if ( $http_referer ~* (babes|girl) )
     {
         # return 404;
         return 403;
     }
##
Finally, if you're hosting with a provider, contact them. Part of their job is often to handle DDOS attacks on your behalf.

Last edited by Sefyir; 09-24-2017 at 09:07 AM.
 
Old 09-24-2017, 10:19 AM   #7
justmy2cents
Member
 
Registered: May 2017
Location: U.S.
Distribution: Un*x
Posts: 237
Blog Entries: 2

Rep: Reputation: Disabled
He said ddos/brute force so Fail2ban can come into play here, especially as it comes with alot of pre-built filters for apache which will help alot with the overall security. But here are some more suggestions to mitigate DoS attacks, thats from this book im reading: 1) Use an IPS (like snort or fwsnort) which literally monitors for DoS attacks 2) Configure firewalls to block malformed traffic 3) Minimize IP spoofing by filtering out external packets that appear to come from an interal address 4) Block all ICMP traffic inbound to your network unless you need it, and even then it should only be allowed to come in to specific hosts 5) Disable all uneeded TCP/UDP small services such as echo and chargen

Last edited by justmy2cents; 09-24-2017 at 10:30 AM.
 
  


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
password protection for installing new software trapper501 Linux - Newbie 15 08-07-2011 01:55 PM
Is there necessity in protection of Linux software? DmitriySF Programming 1 04-23-2009 10:26 AM
Wine and software protection dongles SolidSnake Linux - Software 0 11-19-2004 11:03 AM
Software protection problems cougar2004 Linux - Security 2 02-26-2004 12:35 PM
software protection systems cougar2004 Linux - Software 1 02-26-2004 07:36 AM

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

All times are GMT -5. The time now is 12:41 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