Search


Thursday, August 23, 2012

Change Time zone in Linux server

 How to change the Time zone in Linux

The procedure to change the timezone is to create a symlink to file /etc/localtime. All the time zone information  list can be found in /usr/share/zoneinfo/

mv /etc/localtime /etc/localtime-old
ln -sf /usr/share/zoneinfo/EST localtime

Monday, July 23, 2012

Upgrade ClamAV on CPanel Servers

It is a common question for CPanel administrators why Cpanel does not keep ClamAV up to date. I don’t have the answer but i can demonstrate a simple workaround to upgrade clamav yourself with as little work as possible. You can identify if you use an old ClamAV version if you execute the command “freshclam” and the output is something like:


ClamAV update process started at Wed Mar 26 11:51:12 2008
WARNING: Your ClamAV installation is OUTDATED!
WARNING: Local version: 0.97.4 Recommended version: 0.97.5
DON'T PANIC! Read http://www.clamav.net/support/faq
main.inc is up to date (version: 45, sigs: 169676, f-level: 21, builder: sven)
daily.inc is up to date (version: 6393, sigs: 64747, f-level: 26, builder: ccordes)
So, let’s start and update clamav. At the moment of writing this the current stable release of ClamAV is 0.97.5
1. Login to your server through SSH
2. cd /usr/local/cpanel/modules-install/clamavconnector-Linux-i686
3. wget http://garr.dl.sourceforge.net/sourceforge/clamav/clamav.0.97.5tar.gz
4. Edit the file “install” with the command “vi install”
1. Alter the line “AVV=0.97.4″ and make it “AVV=0.97.5″
2. Alter the line “AVVOLD=0.97.3" and make it “AVVOLD=0.91.4″
3. Save the file
5. echo “0.97.5″ > progversion
6. Execute the script install with the command “./install”
7. Wait for the compilation to finish and check your mail servers functionality.

Clear Exim queue using eximstats

If the exim mail queue becomes large and mail server got blocked. You can follow the below steps to clear the exim queue.  If the queue is very large, its will take time to clear the exim queue using the command exim -Mrm

Clear Exim queue using eximstats



Login to mysql
mysql
mysql> use eximstats
mysql> delete from sends;
mysql> delete from smtp;
mysql> delete from failures;
mysql> delete from defers;

Friday, April 13, 2012

Drupal overview and Security Issues.

Drupal is a powerful and flexible framework for building virtually any kind of website.

Drupal  Current stable version   7.0

How do I know which version of Drupal I’m running?

Go to Administer (or Administration) >> Reports >> Status report. This will list your version number if you have Drupal 6.0 or later. In Drupal 5.x and earlier, the path to go to is Administer >> Logs >> Status report.
Failing that, look for a file called CHANGELOG.txt in the root of your Drupal directory and open it up to find the version you are running.
If CHANGELOG.txt is missing, you can also check in system.module for a line at the top like:
define('VERSION', '5.5');
If this is present, it will tell you which version you are running. If not, you have a version earlier than 4.7.2.


How do I know which version of a module or theme I’m running?

 You can see the versions of your installed modules and themes on the modules and themes administration screens. In Drupal 7, go to Administration >> Modules or Administration >> Appearance, and you will see a column listing the version number. (In Drupal 6, the equivalent pages can be found at Administer >> Site building >> Modules and Administer >> Site building >> Themes.)

 

 




Wednesday, March 7, 2012

how to block access from restrcited IPs in IIS7

1. Go to IIS then domain.
2. Open "IP address and Domain restriction"
3. Click "Edit Feature Settings" in the right panel and change it to "Deny".
4. Click "Add Allow Entry and add IP addresses and/or ranges"

Tuesday, January 3, 2012

DirectAdmin Server Hardening

1. Connect to the server using SSH and login as the admin user.
2. Switch to the root user using the su command.
3. Using your Web browser, browse to the DirectAdmin control panel at     http://<server ip>:2222.
3. Sign into the control panel using the DirectAdmin admin username and password.

 Change Shell Passwords

1. Make sure you are connected to the server as the root user using SSH.
2. Change the admin user’s password:
     # /usr/bin/passwd admin
     (set new password)
3. Change the root user’s password:
     # su -
     # /usr/bin/passwd
     (set new password)

Setup Secure Shell (SSH) Service

1. Add the admin user to the wheel group:
    # usermod -G wheel admin
2. Edit the server’s SSH configuration file:
    # nano -w /etc/ssh/sshd_config
3. To allow only SSH protocol 2 connections, find the line:
     #Protocol 2, 1
4. Uncomment it and change it to:
     Protocol 2
5. Next, to disable direct root login, find the line:
     #PermitRootLogin yes
6. Uncomment it and change it to:
PermitRootLogin no
7. Next, to change the port that SSH listens on, find the line:
    #Port 22
8. Uncomment it and change it to:
Port 1022
9. Save the file and exit the editor.
10. Restart the SSH service:
     # service sshd restart


 Change the Server Admin Username

1. Change the admin username:
    # cd /usr/local/directadmin/scripts
    # ./change_username.sh admin newuser
2. Edit the server’s SSH configuration file:
    # nano -w /etc/ssh/sshd_config
3. Find the line:
     AllowUsers admin
4. Change it to:
    AllowUsers newuser
5. Save the file and exit the editor.
6. Restart the SSH service:
    # service sshd restart
7. Edit the DirectAdmin list of allowed admins file:
    # nano -w /usr/local/directadmin/data/admin/admin.list
8. Change the line with the admin username to the new username for the  admin account.
9. Save the file and exit the editor.

Set the Server’s Date and Time

1. Set the server’s time zone:
    # rm -f /etc/localtime
    # ln -s /usr/share/zoneinfo/America/New_York /etc/localtime
2. Update the current system time:
    # /usr/bin/rdate -s clock.psu.edu
3. Set the ZONE entry in the file /etc/sysconfig/clock to  “America/New_York”.
4. Set the hardware clock:
     # /sbin/hwclock –-systohc
5. Setup a new hourly cron job to keep the server’s time accurate:
    # touch /etc/cron.hourly/rdate
    # chmod 755 /etc/cron.hourly/rdate
    # nano -w /etc/cron.hourly/rdate
6. Paste the following lines into the new cron file:
     #!/bin/sh
     host=”clock.psu.edu”
     /usr/bin/rdate -s $host >/dev/null 2>&1 && /sbin/hwclock –-systohc >/dev/null 2>&1
7. Save the file and exit the editor.



**  Not complete

DirectAdmin control Panel Installtion

Make sure you are having the following packages installed  in the server.  Ie you have to meet the minimum system requirements. 
SSH, gcc, g++, openssl-devel installed

If you are not having the following packages you have to install it in the server. The following are the typical commands used before we install DirectAdmin.

On Rehat/Fedora/Centos:
yum install wget gcc gcc-c++ flex bison make bind bind-libs bind-utils openssl openssl-devel perl quota libaio libcom_err-devel libcurl-dev

Make sure you have purchased Directadmin license.  


Your server is now prepared to install DirectAdmin, so let’s begin.
Run:
wget http://directadmin.com/setup.sh
chmod +x setup.sh

./setup.sh

Now installation procedure will start.

Sunday, January 1, 2012

Joomla .htaccess Rules

 Htaccess   rules in joomla an example:  Add the below rules to the .htaccess file in the default document root 


##
# @version $Id: htaccess.txt 14401 2010-01-26 14:10:00Z louis $
# @package Joomla
# @copyright Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved.
# @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
# Joomla! is Free Software
##
#####################################################
# READ THIS COMPLETELY IF YOU CHOOSE TO USE THIS FILE
#
# The line just below this section: 'Options +FollowSymLinks' may cause problems
# with some server configurations. It is required for use of mod_rewrite, but may already
# be set by your server administrator in a way that dissallows changing it in
# your .htaccess file. If using it causes your server to error out, comment it out (add # to
# beginning of line), reload your site in your browser and test your sef url's. If they work,
# it has been set by your server administrator and you do not need it set here.
#
#####################################################
## Can be commented out if causes errors, see notes above.
Options +FollowSymLinks
#
# mod_rewrite in use
RewriteEngine On
########## Begin - Rewrite rules to block out some common exploits
## If you experience problems on your site block out the operations listed below
## This attempts to block the most common type of exploit `attempts` to Joomla!
#
## Deny access to extension xml files (uncomment out to activate)
#<Files ~ "\.xml$">
#Order allow,deny
#Deny from all
#Satisfy all
#</Files>
## End of deny access to extension xml files
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]
# Block out any script trying to base64_encode crap to send via URL
RewriteCond %{QUERY_STRING} base64_encode.*\(.*\) [OR]
# Block out any script that includes a <script> tag in URL
RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR]
# Block out any script trying to set a PHP GLOBALS variable via URL
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
# Block out any script trying to modify a _REQUEST variable via URL
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
# Send all blocked request to homepage with 403 Forbidden error!
RewriteRule ^(.*)$ index.php [F,L]
#
########## End - Rewrite rules to block out some common exploits
# Uncomment following line if your webserver's URL
# is not directly related to physical file paths.
# Update Your Joomla! Directory (just / for root)
# RewriteBase /
########## Begin - Joomla! core SEF Section
#
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/index.php
RewriteCond %{REQUEST_URI} (/|\.php|\.html|\.htm|\.feed|\.pdf|\.raw|/[^.]*)$ [NC]
RewriteRule (.*) index.php
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
#
########## End - Joomla! core SEF Section