go to whm >> exim configuration editor
then check the option
"Send outgoing mail from the ip that ..."
then go /etc/mailips and add the IP
==========
`There are two options to switch the mail server IP in Cpanel.
Option #1
Login to WHM
Click Exim Configuration Editor
Check the box next to:
"Send outgoing mail from the ip that matches the domain name in /etc/mailips (*: IP can be added to the file to change the main outgoing interface)"
Save Changes
Then edit the file /etc/mailips
nano /etc/mailips
from shell and add:
*: ReplacewithnewIP
Restart exim
service exim restartOption #2
Login to Shell
Access the Exim configuration file:
nano /etc/exim.confLocate remote_smtp
The default setup will look like:
remote_smtp:
driver = smtp
interface = ${if exists {/etc/mailips}{${lookup{$sender_address_domain}lsearch{/etc/mailips}{$value}{}}}{}}
helo_data = ${if exists {/etc/mailhelo}{${lookup{$sender_address_domain}lsearch{/etc/mailhelo}{$value}{$primary_hostname}}}{$primary_ho stname}}Change to:
remote_smtp:
driver = smtp
#interface = ${if exists {/etc/mailips}{${lookup{$sender_address_domain}lsearch{/etc/mailips}{$value}{}}}{}}
#helo_data = ${if exists {/etc/mailhelo}{${lookup{$sender_address_domain}lsearch{/etc/mailhelo}{$value}{$primary_hostname}}}{$primary_ho stname}}
interface = 11.1.1.1.1 # Change to your server IP address.
Save changes and exit.
Restart Exim
=================
Thursday, July 30, 2009
Named Error
root@smx3.hostdime.com.mx(~)$ /etc/init.d/named restart
Stopping named: [ OK ]
Starting named:
Error in named configuration:
zone clone2.dizinc.com.zz/IN: loaded serial 2009021100
zone phpinfotest.com/IN: loaded serial 2009021100
zone transportesmiguel.com/IN: loaded serial 2009021100
zone grupoferrer.com/IN: loaded serial 2009021100
zone jyaa.com.mx/IN: loaded serial 2009021100
zone avpca.org/IN: loaded serial 2009021100
zone hawkanime.net/IN: loaded serial 2009021100
zone nortechengineering.com.mx/IN: loaded serial 2009021100
.
.
.
zone heraldodelbajio.com/IN: loading master file /var/named/heraldodelbajio.com.db: file not found
.
.
.
===========
actually the error is due to some incorrect entries in the /etc/named.conf
1.first check is there any entry for heraldodelbajio.com.db i.e in the error log
2.add it to /etc/named.conf
3.remove or comment following entries
# key "rndckey" {
# algorithm hmac-md5;
# secret "53Ard+LKadYqYxNPTZoMpQ==";
# };
#
# controls {
# inet 127.0.0.1 port 953
# allow { 127.0.0.1; } keys { "rndckey"; };
# };
rndc reload
/scripts/fixrndc
then restart named
this will fix the issue
Stopping named: [ OK ]
Starting named:
Error in named configuration:
zone clone2.dizinc.com.zz/IN: loaded serial 2009021100
zone phpinfotest.com/IN: loaded serial 2009021100
zone transportesmiguel.com/IN: loaded serial 2009021100
zone grupoferrer.com/IN: loaded serial 2009021100
zone jyaa.com.mx/IN: loaded serial 2009021100
zone avpca.org/IN: loaded serial 2009021100
zone hawkanime.net/IN: loaded serial 2009021100
zone nortechengineering.com.mx/IN: loaded serial 2009021100
.
.
.
zone heraldodelbajio.com/IN: loading master file /var/named/heraldodelbajio.com.db: file not found
.
.
.
===========
actually the error is due to some incorrect entries in the /etc/named.conf
1.first check is there any entry for heraldodelbajio.com.db i.e in the error log
2.add it to /etc/named.conf
3.remove or comment following entries
# key "rndckey" {
# algorithm hmac-md5;
# secret "53Ard+LKadYqYxNPTZoMpQ==";
# };
#
# controls {
# inet 127.0.0.1 port 953
# allow { 127.0.0.1; } keys { "rndckey"; };
# };
rndc reload
/scripts/fixrndc
then restart named
this will fix the issue
Check a web page exists
Here is a short method to check if a web page exists from a perl script,
this script will test the existense of a page and do something as a result:
==========
#!/usr/bin/perl
use LWP::Simple;
print “Content-Type: text/htmlnn”;
$url = “ http://site.com/“;
if (head($url)) {
# ok document exists
print “OK: found $url”;
} else {
# something is not well
print “PROBLEM: $url is missing”;
}
=============
this script will test the existense of a page and do something as a result:
==========
#!/usr/bin/perl
use LWP::Simple;
print “Content-Type: text/htmlnn”;
$url = “ http://site.com/“;
if (head($url)) {
# ok document exists
print “OK: found $url”;
} else {
# something is not well
print “PROBLEM: $url is missing”;
}
=============
Saturday, July 25, 2009
How to reset mysql root password ?
1. Stop/ kill the mysqld
# service mysql stop
#pkill -9 mysqld
2) Start the mysql insafe mode as follows
# /usr/sbin/mysqld --skip-grant-tables --user=root &
3) Now update the mysql user tables and root password as follows
#mysql
mysql>use mysql;
mysql>UPDATE user SET Password=PASSWORD('YOUR_PASSWORD') WHERE Host='localhost' AND User='root';
mysql>flush privileges;
Now add the new password “YOUR_PASSWORD” in /root/.my.cnf and start mysql
# service mysql start
// To grant privilege on mysql table
grant EXECUTE on procedure lenbelle_mydbr.sp_MyDBR_UserPassword to 'lenbelle_mydbru'@'localhost';
where lenbelle_mydbr.sp_MyDBR_UserPassword = procedure that having problem
lenbelle_mydbru = dbuser
# service mysql stop
#pkill -9 mysqld
2) Start the mysql insafe mode as follows
# /usr/sbin/mysqld --skip-grant-tables --user=root &
3) Now update the mysql user tables and root password as follows
#mysql
mysql>use mysql;
mysql>UPDATE user SET Password=PASSWORD('YOUR_PASSWORD') WHERE Host='localhost' AND User='root';
mysql>flush privileges;
Now add the new password “YOUR_PASSWORD” in /root/.my.cnf and start mysql
# service mysql start
// To grant privilege on mysql table
grant EXECUTE on procedure lenbelle_mydbr.sp_MyDBR_UserPassword to 'lenbelle_mydbru'@'localhost';
where lenbelle_mydbr.sp_MyDBR_UserPassword = procedure that having problem
lenbelle_mydbru = dbuser
Mysql optimization
MySQL Optimization
Login to your server as root and do a backup of my.cnf mySQL configuration file:
# cp /etc/my.cnf /etc/my.cnf.backup
Edit my.cnf file using nano or other text editor:
# nano /etc/my.cnf
You can use that configuration to optimize default configuration:
[mysqld]
port = 3306
socket = /var/lib/mysql/mysql.sock
skip-locking
skip-innodb
query_cache_limit=8M
query_cache_size=256M
query_cache_type=1
max_connections=500
max_user_connections=100
interactive_timeout=60
wait_timeout=60
connect_timeout=30
thread_cache_size=128
key_buffer=16M
join_buffer=1M
max_allowed_packet=16M
table_cache=1024
record_buffer=1M
sort_buffer_size=2M
read_buffer_size=2M
max_connect_errors=100
# Try number of CPU's*2 for thread_concurrency
thread_concurrency=2
myisam_sort_buffer_size=64M
#log-bin
server-id=1
[mysqldump]
quick
max_allowed_packet = 16M
[mysql]
no-auto-rehash
[isamchk]
key_buffer = 256M
sort_buffer_size = 256M
read_buffer = 2M
write_buffer = 2M
[myisamchk]
key_buffer = 256M
sort_buffer_size = 256M
read_buffer = 2M
write_buffer = 2M
[mysqlhotcopy]
interactive-timeout
Save and exit
Login to your server as root and do a backup of my.cnf mySQL configuration file:
# cp /etc/my.cnf /etc/my.cnf.backup
Edit my.cnf file using nano or other text editor:
# nano /etc/my.cnf
You can use that configuration to optimize default configuration:
[mysqld]
port = 3306
socket = /var/lib/mysql/mysql.sock
skip-locking
skip-innodb
query_cache_limit=8M
query_cache_size=256M
query_cache_type=1
max_connections=500
max_user_connections=100
interactive_timeout=60
wait_timeout=60
connect_timeout=30
thread_cache_size=128
key_buffer=16M
join_buffer=1M
max_allowed_packet=16M
table_cache=1024
record_buffer=1M
sort_buffer_size=2M
read_buffer_size=2M
max_connect_errors=100
# Try number of CPU's*2 for thread_concurrency
thread_concurrency=2
myisam_sort_buffer_size=64M
#log-bin
server-id=1
[mysqldump]
quick
max_allowed_packet = 16M
[mysql]
no-auto-rehash
[isamchk]
key_buffer = 256M
sort_buffer_size = 256M
read_buffer = 2M
write_buffer = 2M
[myisamchk]
key_buffer = 256M
sort_buffer_size = 256M
read_buffer = 2M
write_buffer = 2M
[mysqlhotcopy]
interactive-timeout
Save and exit
Friday, July 24, 2009
How to disable telnet
Login as root to your server, now:
Edit /etc/xinetd.d/telnet
# nano /etc/xinetd.d/telnet
Search for: "disable = no" (you can use Ctrl+W) ,
Change it to: disable = yes
Save and Exit
Restart xinted
# /etc/rc.d/init.d/xinetd restart
Edit /etc/xinetd.d/telnet
# nano /etc/xinetd.d/telnet
Search for: "disable = no" (you can use Ctrl+W) ,
Change it to: disable = yes
Save and Exit
Restart xinted
# /etc/rc.d/init.d/xinetd restart
How To Install Rkhunter
If you are running a Web Server, Mail Server, Hosting Server or VPS Server and you need to provide security against rootkits, so we recommend you to install Rkhunter.
RKhunter is compatible with the most popular Hosting Control Panels like cPanel, Plesk, Ensim etc.
"Rootkit scanner is scanning tool to ensure you for about 99.9%* you're clean of nasty tools.
This tool scans for rootkits, backdoors and local exploits by running tests like:
- MD5 hash compare
- Look for default files used by rootkits
- Wrong file permissions for binaries
- Look for suspected strings in LKM and KLD modules
- Look for hidden files
- Optional scan within plaintext and binary files
Rootkit Hunter is released as GPL licensed project and free for everyone to use.
* No, not really 99.9%.. It's just another security layer"
( http://www.rootkit.nl/ )
Install Rkhunter:
# wget http://downloads.rootkit.nl/rkhunter-1.2.7.tar.gz
# tar -zxvf rkhunter-1.2.7.tar.gz
# cd rkhunter-1.2.7
# ./installer.sh
Update Rkhunter:
# rkhunter --update
Run a Test Scan (help to prevent false positives):
# /usr/local/bin/rkhunter -c
Setup a daily scan report:
# nano /etc/cron.daily/rkhunter.sh
and add it:
#!/bin/bash
(/usr/local/bin/rkhunter -c --cronjob 2>&1 mail -s "Daily Rkhunter Scan Report" email@domain.com)
Change premissions:
# chmod +x /etc/cron.daily/rkhunter.sh
rkhunter version:
rkhunter --version
RKhunter is compatible with the most popular Hosting Control Panels like cPanel, Plesk, Ensim etc.
"Rootkit scanner is scanning tool to ensure you for about 99.9%* you're clean of nasty tools.
This tool scans for rootkits, backdoors and local exploits by running tests like:
- MD5 hash compare
- Look for default files used by rootkits
- Wrong file permissions for binaries
- Look for suspected strings in LKM and KLD modules
- Look for hidden files
- Optional scan within plaintext and binary files
Rootkit Hunter is released as GPL licensed project and free for everyone to use.
* No, not really 99.9%.. It's just another security layer"
( http://www.rootkit.nl/ )
Install Rkhunter:
# wget http://downloads.rootkit.nl/rkhunter-1.2.7.tar.gz
# tar -zxvf rkhunter-1.2.7.tar.gz
# cd rkhunter-1.2.7
# ./installer.sh
Update Rkhunter:
# rkhunter --update
Run a Test Scan (help to prevent false positives):
# /usr/local/bin/rkhunter -c
Setup a daily scan report:
# nano /etc/cron.daily/rkhunter.sh
and add it:
#!/bin/bash
(/usr/local/bin/rkhunter -c --cronjob 2>&1 mail -s "Daily Rkhunter Scan Report" email@domain.com)
Change premissions:
# chmod +x /etc/cron.daily/rkhunter.sh
rkhunter version:
rkhunter --version
Subscribe to:
Posts (Atom)