Sunday, January 29, 2012

DDOS

DOS Attack

1.DOS (Denial Of service)
* Mostly a SYN based attack ( One way hand shaking)
* Attack is from a particular Ip so we can easily blocked in our software firewall

2. DDOS (Distributed Denial Of Service)

* from Different Geo location attack.
* Fullway hand shake attack , Full request , That is SYN and ACK based
* half tcp connection

A. Need to dected is there is a DDOS
B. How much strong it is
C.Precautions
i. application Level (Ie in the Web server configuration file) We can write a script for the Geo location Ips to block, Set 404 error
ii. System Level. ( Kernel Firewall)
iii. Network Level( Null routing)
Useful commands for DDOS detection
1. pptime
2. free -m
3. ps , example ps aux | grep wc -l

If you the attack is from a particular country you can deny all the connection from that country in your csf firewall.

useful commands:
1. tcpdump -i igb1 -nnn -c 10 dst port 80 host
this is for freebsd cmd where "igb1" is the netwok interface name
2. time tcpdump -i igb1 -nnn -c 1000 dst port 80 host 192.168.0.5 | tail
3. tail -1000 /var/log/nginx_aceess.log | awk '{print $1}' | sort | uniq -c | sort -b -k1 -n | tail

4. netstat -n | awk '{ print $5 }' | cut -d ":" -f 1 | grep "[1-9]" | sort | uniq -c | sort -n
5. awk '{print $5}' /proc/net/ip_conntrack|sort |uniq -c |sort -rn |head -25 | column -t
6. netstat -nt | grep :80 | wc -l
7. tcpdump -A dst 192.168.1.14 -s 500 | grep -i refer
8. tcpdump -i eth0 -vvv -nn -s 1700 -w ddos
~]# tcpdump -nn -vv -r ddos | awk '{print $18}' | awk -F\. '{print $1"."$2"."$3"."$4}' | sort | uniq -c | sort -rn | head -25
9. root@ajeesh [~]# /usr/local/apache/bin/apachectl fullstatus



Sunday, January 1, 2012

cpanel apache conf edit

Once you have edited your apache configuration in cpanel server you need to execute the following commands to update the new values to your apche configuration file permanently.

ajeesh@tech2:~$ /usr/local/cpanel/bin/apache_conf_distiller --update

This is useful some times your https link/ document root needs to change regularly on the server. But please execute this command with your own risk on the live servers.

Saturday, December 31, 2011

WHMCS : CURL Error: 7 - couldn't connect to host

Setup > General settings > Security > API IP Access Restriction

I added both the IP's to the list. The main IP for the reseller account 10.10.10.10 was to be added onto the API list.

http://docs.whmcs.com/ResellerClub#CURL_Error:_7_-_couldn.27t_connect_to_host

However, this did not fix the issue.

The second fix was to check the settings for the server.

Setup > Products & Services > Servers > "Select the server" and click on edit settings button

Check whether all the settings are entered correctly and also check the settings for Secure access.

Check "Enable ssl mode for all connections"

This fixed the issue.

Friday, December 30, 2011

Skype installation

skype installation in Linux

recently i have installed skype on my fedora machine. please note my installation steps;

1. created a yum repository

[root@server1 ~]# cd /etc/yum.repos.d/
[root@server1 yum.repos.d]# cat skype.repo
[skype]
name=Skype Repository
baseurl=http://download.skype.com/linux/repos/fedora/updates/i586/
gpgkey=http://www.skype.com/products/skype/linux/rpm-public-key.asc


[root@server1 yum.repos.d]# yum --nogpgcheck install skype
Dependencies Resolved

==============================================================================================
Package Arch Version Repository Size
==============================================================================================
Installing:
skype i586 2.1.0.81-fc10 skype 19 M

Transaction Summary
==============================================================================================
Install 1 Package(s)
Upgrade 0 Package(s)

Total download size: 19 M
Is this ok [y/N]: y
Downloading Packages:
Setting up and reading Presto delta metadata
Processing delta metadata
Package(s) data still to download: 19 M
Transaction Test Succeeded
Running Transaction
Installing : skype-2.1.0.81-fc10.i586 1/1

Installed:
skype.i586 0:2.1.0.81-fc10

Complete!
=======================================

23-05-2013:


MicroSoft released Skype 4.2 version for Linux users

yum remove skype skype-bin
yum install alsa-lib.i686 libXv.i686 libXScrnSaver.i686 qt.i686 qt-x11.i686 pulseaudio-libs.i686 pulseaudio-libs-glib2.i686 alsa-plugins-pulseaudio.i686 qtwebkit.i686
cd /usr/local/src/
wget http://download.skype.com/linux/skype-4.2.0.11-fedora.i586.rpm
rpm -ivh skype-4.2.0.11-fedora.i586.rpm

Friday, December 16, 2011

wrong server load

Recently for the CloudLinux installed server the server load is shown wrongly

for example :

load average: 2136406556.03, 2136819086.23,

This is a known bug in lve0.8.36 kernel where it reports such numbers and the way it handles load on scripts that are seemingly using large I/O. This is corrected with the command `sysctl -w abi.vsyscall32=0`.

OR

sysctl -w kernel.full_loadavg=0

Where previously the variable by default is 1. But this will take some weeks to set the normal load value on your server.But as per the CloudLinux we can fix the issue by update kernel to newer version that is available via:

# yum update kernel
Do it your own risk :)

That is reboot into newer kernel (lve0.8.44).

Thank you,

Thursday, November 24, 2011

LiteSpeed admin pass

How to change the LiteSpeed admin password :

root@server [~]# /usr/local/lsws/admin/misc/admpass.sh

Please specify the user name of administrator.
This is the user name required to login the administration Web interface.

User name [admin]: ajeesh

Please specify the administrator's password.
This is the password required to login the administration Web interface.

Password:
Retype password:
Administrator's username/password is updated successfully!

Friday, November 4, 2011

to clear memory cache

If your server using all your memory and you have no available memory you can safely run this command to clear the memory cache




sync; echo 3 > /proc/sys/vm/drop_caches