Thursday, August 20, 2015

How to find IP Address that Launch DDOS Attack


To find out which IPs did that do the following,

Option 1 :- If you know which domain is attacked. SSH to your server & issue the following command. Make sure you replace “DOMAIN” with your domain name. If you are using cPanel/WHM and the domain is not the primary domain, normally it will be the sub domain of the primary domain.

less /usr/local/apache/domlogs/DOMAIN | awk '{print $1}' | sort | uniq -c | sort -n

Option 2  :- If you don’t know which domain is attacked. SSH to your server & issue the following command. Option 1 if preferable especially if your server is very busy has many domain. It will take quite sometimes to process the log file. You can check by issuing “top -c” command to find out which domain consume the most resources.

less /usr/local/apache/logs/access_log | awk '{print $1}' | sort | uniq -c | sort -n


Both of the option will give the ip and number of connections in the descending order. For example:
1
2
3
4
5
6
7
.....
.....
.....
.....
17843 56.51.155.156
19234 66.156.66.266
234578 156.56.16.76

In the above case we can see too many connections from those ips and it is abnormal. You can block these ips in the firewall such as ConfigServer Firewall (“csf”).


Monday, August 3, 2015

Exim mail relay from an IP without authentication

create the file /etc/alwaysrelay and add the IP addresses .

For example:

                  vi  /etc/alwaysrelay  
Add the IPs in the file

192.168.1.100
10.0.60.22

Then, restart exim (/etc/init.d/exim restart or ‘service exim restart’)

After this either restart antirelayd or wait for a little while and it will automatically include these IPs in /etc/relayhosts