Categories

Thursday 24 April 2014

How to enable Java Plugin to firefox on centos

Hi,

Below are the steps to install and enable java plugin for firefox. First we need to install java on the machine and then do the following steps to enable the plugin on the firefox.



root@test:~# ln -sf /opt/java/jre1.7.0_05/lib/i386/libnpjp2.so /usr/lib/mozilla/plugins/

root@test:~# export JAVA_HOME="/opt/java/jre1.7.0_05"

Testing the plugin.

root@test:~# firefox http://java.com/en/download/testjava.jsp

Regards
Syamkumar.M

Tuesday 15 April 2014

How to Detect and secure Linux Cpanel Server From Spamming

Hi,

We faced some severe spamming issue on a Cpanel server, upon  checking the email queue, I can see that there is more than 1 lakh of emails. On checking the headers I can see that almost all of them are spam. Below are the steps that I have  taken for fixing the spamming issues on the server.

Exim command to detect the email queue is

exim -bpc

exim -bp|exiqsumm 

command will give you summary of the queue. Once you get the Message IDs from the above command you can view the Header of an email using the command

exim -Mvh Message ID


This will list the headers including the php script which is sending emails, if any.

X-php-script

You can check the body of the message as well in exim to make sure that it was a body of spam email

exim -Mvb Message-ID


Mostly you will get the php script from the exim -Mvh command. But some times you won't get the php scripts from the headers. The hackers might made some custom changes so that it won't appear in the headers.

Then we can use the below command which will detect the directory under which exim is sending emails.

grep cwd /var/log/exim_mainlog | grep -v /var/spool | awk -F"cwd=" '{print $2}' | awk '{print $1}' | sort | uniq -c | sort -n

Also you will get the common subject of spam emails by searching for  duplicate subject lines from the exim logs.

awk -F"T=\"" '/<=/ {print $2}' /var/log/exim_mainlog | cut -d\" -f1 | sort | uniq -c | sort -n

The above commands will give you the directory in which exim is currently executing the emails.The above command will also list the count of emails. So you will know from which directory the emails are sending heavily. Just cd into the directory and check the php files inside or scan with available antivirus(clamav inside that directory)

clamscan -i -r Directory-Name


This will list the vulnerable php files. You just need to delete those files first.

After you find the files which caused the spamming you might need to run a full system scanning on the server using clamav antivirus to find out any other suspicious files are residing on the server.


clamscan -i -r /


Below are the steps to make the system more secure against spamming

1)First install a antivirus like clamav on the server and then scan whole the server and automate it to run daily or weekly using crontab.

2)Install CSF firewall on the server and enable lfd on it

3)Install chrootkit or RK hunter on the server and automate the scanning of those using cron jobs

4)Disable  shell access for users  on the Cpanel servers unless it is required.

5)Disable any unanonymous FTP uploads on the Cpanel server.

6)Disable variables like open_basedir and php exec_shell and register_globals of php on the server

Regards
Syamkumar.M





Sunday 6 April 2014

How to change Outgoing IP of exim in a Cpanel server

Hi All,

Some times the IP of a cpanel server may got black listed due to spamming and hence we shouldn't be able to send emails to gmail or yahoo etc. This would affect whole customers of a server as no email communication is not possible.  A work around or temperory solution for this issue was to change the outgoing email IP of the cpanel server. Below is the steps to change the ip of a outgoing exim email server in Cpanel.

1)First you need to stop the email service exim through command line.

root@server [~]# /etc/init.d/exim stop

2)Now Login to your WHM control panel and do the changes on the section Exim configuration Manager on WHM.

Reference /etc/mailips for outgoing SMTP connections [?]
Send outgoing mail from the IP address that matches the domain name in /etc/mailips (more information)
Make the above settings to on.
3)Now login to the server as root and then open the configuration file /etc/mailips

add the new outgoing ip adress for exim as 

*:X.X.X.X

Where x.x.x.x is the ip adress you need to change. Save the configuration file and exit.


4)Restart the exim service

/etc/init.d/exim restart




Now the email will be sending from new fresh ip which is not black listed.


Regards
Syamkumar.M


Ad