DDOS attacks from amazon servers

Well today one of our client server had worst ddos attack against server main IP. While analyzing i found it is coming from amazon hacked servers. As amazon is offering free ec2 servers for 1 year so some of people don’t care about it after getting it as free. They do not use it and forget it after getting it. These servers are easy to get hacked and then can be used to attack other servers by hackers.

Here is the quick solution for linux centos 7 to deal with these attacks:

1. Access your server from ssh, you can use putty

2. Once you logged in with root access you have to install network monitoring tool, i found Trafshow tool very help full to see what IPs are attacking.

3. Install it with :

yum install trafshow -y

if you get nothing found error, just install epel-release repo by executing following command:

yum install epel-release -y

4. Once you install Trafshow, now you are ready to check incoming requests from IPs. Run following below command:

trafshow -i eth0 tcp

where eth0 is network card, you need to change it with your network interface. if you’re not sure about network interface, run following command:

ifconfig

It will return all the interfaces.

5. Once you run command trafshow -i eht0 tcp it will display all the connections with IPs. Here you can block them by various techniques. One is to add these IPs in config Server Firewall.

6. Here is the list of amazon IPs:

https://ip-ranges.amazonaws.com/ip-ranges.json

Read More

Change directories and files permissions from ssh

Here are the commands to change directories permission recursively to 755 and files permissions to 644 recursively:

To change directories/folders permissions to 755:

$ find /opt/lampp/htdocs -type d -exec chmod 755 {} \;

To change files permissions to 644:

$ find /opt/lampp/htdocs -type f -exec chmod 644 {} \;

Where, /opt/lampp/htdocs is the location of directory. You can use “.” without quotes to scan and change under current directory/folder.

FileZilla FTP error failed to retrieve directory listing

FilezillaMany people complain about filezilla ftp error that it is not listing directories, sometimes the issue is with firewall on local computer or sometimes it is with remote hosting server.
It gets connected but while listing directories it returns error “failed to retrieve directory listing”

According to my findings i came to know the issue is with Filezilla’s few versions. So i tried with Filezilla version 3.5.3 and i did not get even single error with it.

You can download it and check it by yourself:

Read More

How to call SOAP api from PHP

This tutorial explains calling of SOAP API with PHP code, there is also work around for the problems while accessing host URL.

This code is tested with PHP 5.6.x version and is working without any issue.

 
Create PHP file and paste following below code in it, save and you’re done.
In below code we are calling SMS SOAP API to send SMS’.
Read More

Redirect old domain to new domain with 301

Here are the few lines of code you can add into your .htaccess to redirect your old domain to new domain with 301 (permanent redirect) code.

Open .htaccess file in any editor and add following below lines, please replace websterz.info with your own domain.

RewriteEngine On
RewriteCond %{HTTP_HOST} ^websterz.info [NC,OR]
RewriteCond %{HTTP_HOST} ^www.websterz.info [NC]
RewriteRule ^(.*)$ http://websterz.info/$1 [L,R=301,NC]

 

That’s all 🙂