Skip to content

A little script to block little attack for ddos (UFW linux config)

License

Notifications You must be signed in to change notification settings

Unknown-user-dev/Uniria-UFW

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Uniria UFW Firewall On Linux

For Debian And Another Dist

Github Stars GitHub issues

The Firewall Config Feat Unira UFW; ⓒ Unknown User

Features

✅ Limit Connection per Class C

✅ Stable

✅ Limit connections per IP

✅ Limit Packets per IP

Installation

Edit /etc/ufw/before.rules, putting each part where it belongs

### Add those lines after *filter near on the beginning 
:ufw-http - [0:0]
:ufw-http-logdrop - [0:0]



### Add those lines near the end of the file

### Start HTTP With UFW ###

# Enter rule Uniria
-A ufw-before-input -p tcp --dport 80   -j ufw-http
-A ufw-before-input -p tcp --dport 443  -j ufw-http

# Limit connections per Class C with logdrop
-A ufw-http -p tcp --syn -m connlimit --connlimit-above 50 --connlimit-mask 24 -j ufw-http-logdrop

# Limit connections per IP with logdrop
-A ufw-http -m state --state NEW -m recent --name conn_per_ip --set
-A ufw-http -m state --state NEW -m recent --name conn_per_ip --update --seconds 10 --hitcount 20 -j ufw-http-logdrop

# Limit packets per IP
-A ufw-http -m recent --name pack_per_ip --set
-A ufw-http -m recent --name pack_per_ip --update --seconds 1  --hitcount 20  -j ufw-http-logdrop

# Finally accept the request
-A ufw-http -j ACCEPT

# Log-A ufw-http-logdrop -m limit --limit 3/min --limit-burst 10 -j LOG --log-prefix "[UFW HTTP DROP] "
-A ufw-http-logdrop -j DROP

### End HTTP ###

Testing the results

Make sure UFW runs to test the results with a ddos service

Great success.

Made with ❤ by @Unknown User

About

A little script to block little attack for ddos (UFW linux config)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published