Wednesday, May 25, 2016

Mitigating DDoS Attacks : configure nginx to filter Http Flood

Try add like the following directives to your nginx webserver configuration to prevent from HTTP flooding attacks by limiting the rate of requests and limiting the number of connections for unique ip address (user) :


1. Edit your naginx config file

nano /etc/nginx/nginx.conf

and search for "http" tag :

http {

        ##
        # Basic Settings
        ##

2. After "##"add the following directives :

#Limiting the Number of Connections for unique IP
limit_conn_zone $binary_remote_addr zone=limit_per_ip:10m;
limit_conn limit_per_ip 20;

#Limiting the Rate of Requests/s for unique IP
limit_req_zone $binary_remote_addr zone=allips:10m rate=60r/s;
limit_req zone=allips burst=60 nodelay;


3. now should your nginx config file looks like this :
http {

        ##
        # Basic Settings
        ##
#Limiting the Number of Connections for unique IP
limit_conn_zone $binary_remote_addr zone=limit_per_ip:10m;
limit_conn limit_per_ip 20;

#Limiting the Rate of Requests/s for unique IP
limit_req_zone $binary_remote_addr zone=allips:10m rate=60r/s;
limit_req zone=allips burst=60 nodelay;

. . .

4. Save & exit
CTRL+X then y

5. restart your nginx webserver
service nginx restart

or use :
/etc/init.d/nginx restart


*** The best way to protect your website and server from common DDos attacks is to use incapsula solution : https://www.incapsula.com

Monday, May 16, 2016

How to fix sudo command not found debian 8

This tutorial let you to fix : sudo after debian installation is missed.

-bash: sudo: command not found


1. Start debian in recovery mode (in Grub boot menu choose : Advanced options for Debian GNU/Linux)


then choose from list Debian GNU/Linux, with .... (recovery mode) 
2. Activate or reset root password with this command :

passwd root

and then enter your new root password 

after that reboot recovery mode with this command :

reboot

3. After reboot, in Grub menu : choose Debian GNU/Linux with normal mode (NOT rescue mode)

4. in gnome desktop open terminal and enter this command line to login with root

su

5. Install sudo :

apt-get install sudo

6. Add your username to sudo group :

adduser yourusername sudo

now add your username to this file :

nano /etc/sudoers 

then search for line with "%sudo  ALL=(ALL:ALL) ALL" after this line put :

yourusername ALL=(ALL:ALL) ALL

exit file & save (ctrl+x then y)

7. now enter in terminal : 

exit 

to exit root to your defaut username

8. test with any command with sudo like : sudo apt-get install htop  and enter your password now should sudo works

:-)


links list 2

Linux auto clicker Is   Max Auto Clicker safe to use? How to Auto Scroll without using your mouse | Windows and Linux