Thursday, 31 December 2009
Child pid xxx exit signal Segmentation fault (11)
Mailman Error “Bug in Mailman version 2.1.11.cp3?
Error
===============
Bug in Mailman version 2.1.11.cp3
We’re sorry, we hit a bug!
Please inform the webmaster for this site of this problem. Printing of traceback and other system information has been explicitly inhibited, but the webmaster can find this information in the Mailman error logs.
===============
Command
chmod 02775 -R /usr/local/cpanel/3rdparty/mailman/
Wednesday, 30 December 2009
How to stop generating core files
Thursday, 24 December 2009
cPanel :: Unable to locate clamd
root@sertech[~]# /scripts/restartsrv_clamd
Unable to locate clamd
Please follow the steps as given below:
# Red Hat Enterprise Linux 5 / i386:
rpm -Uhv http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
# Red Hat Enterprise Linux 5 / x86_64:
rpm -Uhv http://apt.sw.be/redhat/el5/en/x86_64/rpmforge/RPMS//rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm
Then install it through yum:
yum install clamd
And finally restart clamd service:
/scripts/restartsrv_clamd
Wednesday, 23 December 2009
How to enable SSI includes by using .htaccess
Including executables are no longer allowed by default apache configuration. IncludesNOEXEC is now the default, SSI includes are now disabled by default. This is done to prevent server abuse / insure server security. We recommend using PHP coding wherever possible. If using cgi includes is ABSOLUTELY necessary you may enable the includes via :
1. Create/edit the .htaccess file (you may find it within public_html folder) to permit the execution of CGI programs with the following options:2. Enter the following:
Options +Includes +ExecCGIAddHandler cgi-script .cgi .pl
OR
AddType text/html .shtmlAddHandler server-parsed .shtmlOptions Indexes FollowSymLinks Includes
3. Save .htaccess file.
Sunday, 20 December 2009
How to Move or Copy an SSL Certificate from one Server to Another
There's two parts to moving a SSL cert. First, you will need to export the certificate on the old server. Then, you will need to import the cert to the new server. Here is a detailed description of the process to follow for both steps:
Here are the steps you should follow to export to the cert on the existing server:
1) Go to Start -> Run and enter MMC
2) From the menu bar, select Console -> Add Remove Snap In
3) Click the "Add" button. Select the Certificates snap in, and then click "Add" again
4) Choose the "Computer Account". Click Next.
5) Select "Local Computer" Click Finish.
6) Now click "Close" and then "OK"
7) Now expand the "Certificates" object in the MMC and drill down to Personal -> Certificates.
8) You should see your existing cert. listed. Right click on the cert and go to All Tasks -> Export
9) Choose "Yes, export the private key". Click "Next".
10) At the next screen, leave the default settings and hit "Next"
11) Enter a password to secure the exported cert. Click Next.
12) Enter a file name. The cert will be exported to this file name. Click Next.
13) Click Finish.
On the destination server, follow this procedure:
1) Copy the exported file over to the new server
2) Follow steps 1-7 outlined above
3) Right Click on the certificiates folder and choose "All Tasks -> Import "
4) Click Next. Browse to the file you copied over in step 1. Click Next
5) Enter the password you entered in step 11 above. Check the box "Mark the private key as exportable". Click Next
6) You want to place the cert into the Personal store - this is selected by default. Click Next.
7) Click Finish.
8) Now you will need to go into IIS and assign the SSL cert to the site.
Friday, 18 December 2009
How To Configure CSF Firewall
You can see the features on following site.
http://www.configserver.com/cp/csf.html
1) Download CSF
[root@server1 ~]# cd /usr/src
[root@server1 src]# wget http://www.configserver.com/free/csf.tgz
2) Install CSF
[root@server1 src]# tar zxvf csf.tgz
[root@server1 csf]# cd csf
[root@server1 csf]# ./install.sh
It will compile and install csf under /etc/csf/ directory, now we will configure it.
3) Configuration
First run following command that you have all the required iptables modules available for running CSF full. Don’t worry if you cannot run all the features, so long as the script doesn’t report any FATAL errors
[root@server1 csf]# perl /etc/csf/csftest.pl
Testing ip_tables/iptable_filter…OK
Testing ipt_LOG…OK
Testing ipt_multiport/xt_multiport…OK
Testing ipt_REJECT…OK
Testing ipt_state/xt_state…OK
Testing ipt_limit/xt_limit…OK
Testing ipt_recent…OK
Testing ipt_owner…OK
Testing iptable_nat/ipt_REDIRECT…OK
RESULT: csf should function on this server
Looks 100% OK.
Now if you are running apf_bfd firewall, it has to be removed for csf works.
[root@server1 csf]# sh /etc/csf/remove_apf_bfd.sh
Removing apf and/or bfd…
/etc/csf/remove_apf_bfd.sh: line 5: apf: command not found
error reading information on service apf: No such file or directory
error reading information on service apf: No such file or directory
…Done
sure i dont use it, so not found.
Now to configure csf config file to implement firewall as per our need.
[root@server1 csf]# vi /etc/csf/csf.conf
The following TAG will run csf in Testing Mode as if we by mistake block ourself out, it will flush all firewall rules in 5 minutes to get us in and fixed it.
TESTING = “1?
We will change it to zero “0? when we finished and sure we have all right rules in.
Put your all ports which you want to be open on your server for incoming traffic seperated by comma.
TCP_IN = “20,21,22,25,53,80,110,143,443,465,587,993,995?
Also open any port you want for outgoing traffic
TCP_OUT = “20,21,22,25,53,80,110,113,443?
Same goes for UDP_IN and UDP_OUT, be remember if you are running DNS service, so you have to open port 53 in UDP_IN as DNS port 53 runs on udp rather than tcp
UDP_IN = “20,21,53?
To allow outgoing traceroute add 33434:33523 to this list
UDP_OUT = “20,21,53,113,123,33434:33523?
If you like to people ping your server without any timout than change following value to zero “0? because default value limit ping 1 per second, which may show you ping timeout and you may have impression of that your server is dropping packets.
ICMP_IN_RATE = “0?
SYNFLOOD protection is already enabled and if you want to change the RATE or BURST value you can use following lines to match your traffic.
SYNFLOOD = “0?
SYNFLOOD_RATE = “100/s”
SYNFLOOD_BURST = “150?
currently the RATE is 100/s and BURST can upto 150. This can be varry from server to server.
To protect your server any specific port from DOS attacks, you can define it in PORTFLOOD tag. This option limits the number of connections per time interval that new connections can be made to specific ports.
By default its empty and i did like to limit 20 connections per 5 sec to port 80 (webserver).
PORTFLOOD = “80;tcp;20;5?
It defines protect port 80 running on protocol tcp, 20 connections per 5 seconds. Use the same for more ports followed by semmi colon ;.
Define email address to which you need to get alerts and define email address to which you want to get.
LF_ALERT_TO = “sohaileo@gmail.com”
LF_ALERT_FROM = “csf@sohailriaz.com”
This will implement firewall more than you need. It has tons of options and you can edit csf.conf for your need.
After this save the file and restart the csf service.
[root@server1 csf]# /etc/init.d/csf start
Dont scare of large iptables commands running in
The CSF will start in Testing mode and now you have to check rules are implement correctly or not and if you have accidently block yourself, wait for 5 minutes and then relogin to fix it.
If you completed with configuation and sure that every rules is implemented correctly then change Testing from 1 to 0 for run CSF permanently.
TESTING = “0?
and restart the service again to activate it.
[root@server1 csf]# /etc/init.d/csf restart
To allow IP addresses through iptables insert, one IP per line. If want to allow full block use CIDR notation
[root@server1 csf]# vi /etc/csf/csf.allow
192.168.0.1
192.168.1.0/24
These IP should also be define in /etc/csf/csf.ignore to be ignore from lfd daemon from checking.
To deny IP addresses will be allowed through iptables, one IP address per line. If want to deny full block use CIDR notation
[root@server1 csf]# vi /etc/csf/csf.deny
192.168.0.5 #do not delete
The #do not delete option will tell csf to igonore the DENY_IP_LIMIT tag and dont delete ip from this file.
Now you have full feature firewall install and running without any error. The work you have to do now is to re-read /etc/csf/csf.conf file full and check every option it gives and change accordingly to your firewall need. I hope you will now easily edit it and do more with it. If you need any help please comments to benefit for all.
Fantastico shows error 'You cannot install more than one script in the root directory of a domain'
1. Log in cPanel and click on File Manager;
2. Navigate to .fantasticodata in your Home Directory;
3. Delete the file installed_in_root.php.
This will ensure there is no Fantastico information remaining from previous installations.
If you still have problems with your Fantastico, Please contact you sysadmin for further help
How to remove the blocked ip using iptables
- First check that ip is blocked or not
- iptables –L –n | grep
DROP all -- 125.99.10.123 216.240.157.91
- to unblock the ip give the command
iptables -D INPUT -s 125.99.10.123 -d 216.240.157.91 -j DROP
Now the ip is unblocked.
Install RED5 Server on Centos 5.3
1) Download and Install Java
RED5 server depends on Java. CentOS 5.3 comes with OpenJDK 1.6 and install it using yum.
yum -y install java-1.6.0-openjdk java-1.6.0-openjdk-devel
2) Download and Install Ant (Apache Project)
Ant will need to compile RED5 server code. Ant comes in binary form, so just download and install it in /usr/local directory.
cd /usr/src
wget http://opensource.become.com/apache/ant/binaries/apache-ant-1.7.1-bin.tar.gz
tar zxvf apache-ant-1.7.1-bin.tar.gz
mv apache-ant-1.7.1/ /usr/local/ant
3) Export Variables for Ant and Java
export ANT_HOME=/usr/local/ant
export JAVA_HOME=/usr/lib/jvm/java
export PATH=$PATH:/usr/local/ant/bin
export CLASSPATH=.:$JAVA_HOME/lib/classes.zip
Also export these variables in /etc/bashrc to become available for every user login or for any terminal opens.
echo ‘export ANT_HOME=/usr/local/ant’ >> /etc/bashrc
echo ‘export JAVA_HOME=/usr/lib/jvm/java’ >> /etc/bashrc
echo ‘export PATH=$PATH:/usr/local/ant/bin’ >> /etc/bashrc
echo ‘export CLASSPATH=.:$JAVA_HOME/lib/classes.zip’ >> /etc/bashrc
4) Download and Install RED5 Server
Here the latest version available for RED5 is 0.7 on site but download from google code using svn as the tarball of 0.7 on site is missing some of the files.
cd /usr/src
svn checkout http://red5.googlecode.com/svn/java/server/trunk/ red5
mv red5 /usr/local/
cd /usr/local/red5
ant prepare
ant dist
you will see a ton of lines, but you should get at last
BUILD SUCCESSFUL
that’s mean its install and now copy the conf directory from dist/ and test the red5 installation.
cp -r dist/conf .
./red5.sh
If it shows Installer service created in the last then everything is fine here, press ctrl+c and move to next step to create init script.
5) Init Script
Now we will create init script for red5 to start, stop and restart easily.
vi /etc/init.d/red5
download http://www.sohailriaz.com/downloads/red5.txt and copy / paste code in it. The init script code also be viewed below.
#!/bin/sh
# For RedHat and cousins:
# chkconfig: 2345 85 85
# description: Red5 flash streaming server
# processname: red5
PROG=red5
RED5_HOME=/usr/local/red5
DAEMON=$RED5_HOME/$PROG.sh
PIDFILE=/var/run/$PROG.pid
# Source function library
. /etc/rc.d/init.d/functions
[ -r /etc/sysconfig/red5 ] && . /etc/sysconfig/red5
RETVAL=0
case “$1? in
start)
echo -n $”Starting $PROG: ”
cd $RED5_HOME
$DAEMON >/dev/null 2>/dev/null &
RETVAL=$?
if [ $RETVAL -eq 0 ]; then
echo $! > $PIDFILE
touch /var/lock/subsys/$PROG
fi
[ $RETVAL -eq 0 ] && success $”$PROG startup” || failure $”$PROG startup”
echo
;;
stop)
echo -n $”Shutting down $PROG: ”
killproc -p $PIDFILE
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$PROG
;;
restart)
$0 stop
$0 start
;;
status)
status $PROG -p $PIDFILE
RETVAL=$?
;;
*)
echo $”Usage: $0 {start|stop|restart|status}”
RETVAL=1
esac
exit $RETVAL
Now start the service
/etc/init.d/red5 start
check status
/etc/init.d/red5 status
red5 (pid XXXXX) is running…
again you can do stop, restart.
Saturday, 12 December 2009
HowTo install and configure FFmpeg and FFmpeg-Php on a DA server
Install FFMPEG CentOS
cd /root
echo "[dag]" > /etc/yum.repos.d/dag.repo
echo "name=Dag RPM Repository for Red Hat Enterprise Linux" >> /etc/yum.repos.d/dag.repo
echo "baseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/dag" >> /etc/yum.repos.d/dag.repo
echo "gpgcheck=0" >> /etc/yum.repos.d/dag.repo
echo "enabled=1" >> /etc/yum.repos.d/dag.repo
yum -y install ffmpeg ffmpeg-devel flvtool2 mencoder
wget http://internap.dl.sourceforge.net/sourceforge/ffmpeg-php/ffmpeg-php-0.6.0.tbz2
tar -xjf ffmpeg-php-0.6.0.tbz2
cd ffmpeg-php-0.6.0/
/usr/local/bin/phpize
./configure --with-php-config=/usr/local/bin/php-config
make
make install
cp /usr/local/lib/php/extensions/no-debug-non-zts-20060613/ffmpeg.so /usr/local/lib/php/extensions/
echo "extension=ffmpeg.so" >> /etc/php.ini
service httpd restart
How to install Roundcubemail (webmail alternative)
I found roundcube mail while searching projects on freshmeat. Already in Alpha stage is runs very nice, has a great template system and uses xhtml/css 2 (although the xhtml could be strict and much better) the default template is great. It currently lacks a search but that is coming in the future.
http://www.roundcube.net/
So lets get started.
=============================
1) Create a mysql db via direct admin. I called mine admin_webmail (you should all know how to do this!)
2) Download and unpack the package:
Code:
# cd /var/www/html
# wget http://easynews.dl.sourceforge.net/s...0051007.tar.gz
# tar xvfz roundcube_webmail_0.1-20051007.tar.gz
3) Ensure proper permissions of the folders:
Code:
# chown -R root.root roundcubemail
# cd roundcubemail
# chown -R apache logs temp
4) Import their SQL file:
Code:
# cd SQL
//replace the following with the database username and password you created in step 1
# mysql -u admin_webmail -p
Enter Password: *******
Once in, import their SQL file:
Code:
use admin_webmail
SOURCE mysql.initial.sql
now the import should be complete.
5) Setup db config variables
Code:
# cd ../config/
# nano db.inc.php
all you have to do here is change the "$rcmail_config['db_dsnw'] = " config information, mine looks like this:
Code:
$rcmail_config['db_dsnw'] = 'mysql://admin_webmail:myPasswordHere@localhost/admin_webmail';
the format is: mysql://:@host/database_name
save that file and close it.
6) Setup the application config:
Code:
# nano main.inc.php
find this line:
Code:
$rcmail_config['enable_caching'] = TRUE;
Replace with:
Code:
$rcmail_config['enable_caching'] = FALSE;
next find:
Code:
$rcmail_config['default_host'] = '';
replace with:
Code:
$rcmail_config['default_host'] = 'localhost';
7) *optional* you may want to setup an apache alias, you can overwrite your current webmail one with the following:
Edit httpd.conf:
Code:
# nano /etc/httpd/conf/httpd.conf
Find this line:
Code:
Alias /webmail /var/www/html/webmail/
Replace with:
Code:
Alias /webmail /var/www/html/roundcubemail/
then restart apache
Code:
# service httpd restart
You are done!
Login @ http://www.domain.com/webmail/
Questions, Comments, Typos, Suggestions, Praise post here please and I will update this main thread.
Thanks,
Pushkar
Reply With Quote
Thursday, 10 December 2009
Friday, 6 November 2009
Allowing Users to Customize AwStats
allow_awstats_include=1
Alternatively, you can go to WHM > Statistics Software Configuration, and click on Allow Awstats configuration Include file
This will allow users to have an awstats.conf.include file in /home/$username/tmp/awstats, which can be used to override settings from the main AwStats configuration for the server.
Saturday, 31 October 2009
How to install memcache on linux server?
memcached is meant to work in concert with something like the MySQL query cache, not replace it. The two implementations excel at vastly different things: memcached is an object cache, while MySQL provides a query cache.
memcached is extremely fast. It uses libevent, which provides a mechanism to execute a callback function when a specific event occurs on a file descriptor, to scale to any number of open connections. On a modern Linux system memcached utilizes epoll, is completely non-blocking for network I/O, ensures memory never gets fragmented, and uses its own slab allocator and hash table to achieve 0(1) virtual memory allocation.
How it install it on Linux server ?
#curl -O http://monkey.org/~provos/libevent-1.4.9-stable.tar.gz
#tar -xzvf libevent-1.4.9-stable.tar.gz
#cd libevent*
#./configure
#make
#make install
Now let’s download the newest Memcached source
#curl -O http://www.danga.com/memcached/dist/memcached-1.3.0.tar.gz
#tar zxf memcached-1.3.0.tar.gz
#cd memcached-1.3.0
#./configure
#make
#make install
Then add /usr/local/lib to LD_LIBRARY_PATH in your .bash_profile
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
export LD_LIBRARY_PATH
How it Works
First, you start up the memcached daemon on as many spare machines as you have. The daemon has no configuration file, just a few command line options, only 3 or 4 of which you’ll likely use:
Run Memcached as a daemon (d = daemon, m = memory, u = user, l = IP to listen to, p = port)
#memcached -d -m 1024 -u root -l 127.0.0.1 -p 11211 –u nobody
This starts memcached as a daemon (-d) on the IP address and port specified with -l and -p, respectively, running as the user nobody (-u), allocating 1024 for object storage (-m). You should adjust the amount of storage to suit your needs; many memcached installs run with 4 GB. Once you are comfortable with your startup options, add the appropriate command to your startup scripts.
Create a /etc/init.d/memcached file and add above line to start memcached when the server boots With memcached installed and running, it’s time to get PHP talking to the object cache. While multiple PHP API exists, the one in the PECL repository is recommended. If you are running a newer version of PHP, installation is as simple as:
# pecl install memcache
Or you can use following steps to install PECL memcache manually.
#cd /usr/local/src
#curl -O http://pecl.php.net/get/memcache
#tar zxvf memcache*
#cd memcache-*
#phpize
#./configure
#make && make install
Now we have to make sure PHP loads the newly built memcache.so library by adding the following line to php.ini:
extension=memcache.so
Now restart Apache:
Service httpd restart
Once it sucussfully install you can create phpinfo() on your webserver should now confirm that memcache is installed.
Wednesday, 28 October 2009
Error codes : FTP
FTP is most widely used application using which you can manage upload download data for your website/server. While using FTP program you may come across many error or message which you need to understand and will have to react accordingly.
Following are few of them which you should know.
421 -: too many users logged to the same account.
530 -: It represent that wrong login password has been used
550 -: If the file exist it means you have no access to the file or dir. 550 error message stats that the account you have currently logged in does not have permission to perform the action you are trying to execute or you may be trying to upload to the wrong directory or trying to delete a file.
120 :- Service ready in nnn minutes.
125 :- Transfer of data started, data connection is with server is open
150 :- File status okay; about to open data connection.
200 :- no error with fired command.
202 :- specified command is not implemented
211 :- System status
212 :- Shows directory status.
213 :- shows file status.
214 :- you can get meaning of a particular non-standard command very useful for non technical support guys.
220 :- Service ready for new user.
221 :- it stats that particular service is closing control connection.
225 :- Data connection open; no transfer in progress.
226 :- Closing data connection.
227 :- Entering Passive Mode
230 :- User logged in, proceed.
250 :- Requested file action okay, completed.
331 :- User name okay, need password.
332 :- Need account for login.
350 :- Requested file action pending further information
421 :- Service not available, closing control connection.
425 :- Can’t open data connection.
426 :- It indicates that connection is closed; and transfer is aborted.
450 :- Requested file action not taken.
451 :- Requested action aborted. Local error in processing.
452 :- Requested action not taken may be due to insufficient storage space in system.File unavailable (e.g., file busy).
500 :- Syntax error, command unrecognized. This may include errors such as command line too long.
501 :- Syntax error in parameters or arguments.
502 :- Command not implemented.
503 :- Bad sequence of commands.
504 :- Command not implemented for that parameter.
530 :- Not logged in.
532 :- Need account for storing files.
550 :- Requested action not taken. Reason : File unavailable (e.g., file not found, no access).
551 :- Requested action aborted. Reason : Page type unknown.
552 :- Requested file action aborted due to exceeded storage allocation (for current directory or dataset).
553 :- Requested action not taken. File name not allowed.
Setting or Changing MYSQL Root Password
Setting/changing MYSQL root Password
Setting up mysql database password is one of the important tasks which a webmaster should take care of. If you have never set a root password for MySQL, then server does not require a password at all for connecting as root and if you have already set password for your database and for some reason if you want to change it then you can do so using following commands.
To setup root password for MySQL databases for first time you need to login to your server as root and will have to use mysqladmin command at shell prompt as follows:
$ mysqladmin -u root password “mysql_password“
However, if you want to change/update your root password, then you will have to use following command
$ mysqladmin -u root -p oldpassword newpassword
after you fire above command you will have to provide password for your MySQL database.
Fantastico error : Fantastico is not installed at the default location
Many webmaster having cPanel server may get following error when you try to install/upgrade fantastico on your cPanel server. You may get few complaints from your customers stating that when they try to access fantastico they get below error code.
” I got this error when I click on the fantastico button in Cpanel. Fantastico is not installed at the default location “
/usr/local/cpanel/3rdparty/fantastico. Either move the Fantastico
directory from it’s current location to
/usr/local/cpanel/3rdparty/fantastico OR enable ioncube loaders in WHM ->
Tweak settings “
For this error you will have to update your cpanel version to latest version. You can also set your server for auto cpanel update using following settings :
- Login to your WHM > Choose “Update Config” > Tick “Automatic (Stable Tree)”you need to check if ioncube is installed on server and it should be enable in WHM -> Tweak settings.
- you can update fantastico manually using following command cd /usr/local/cpanel/whostmgr/docroot/cgi/fantastico/scripts/ ; /usr/local/cpanel/3rdparty/bin/php cron.php
- You can also rebuild cpanel’s php using /scripts/makecpphp
- You can also force cpanel update using following command /scripts/upcp –force
Once your server is updated, you may be able to install Fantastico again and can use it easily without any problem.
How to add a range of IPs on a BSD box.
FreeBSD is a popular free Unix like open source operating system that is based on the Berkeley Software Distribution (BSD) version of the Unix operating system. FreeBSD runs only on the Intel PC platform (i386 and higher) having atleast Pentium processor and also on amd64, Alpha/AXP, IA-64, PC-98 and UltraSPARC processors. You can consider FreeBSD as an alternative to Linux which will run Linux applications. Its said that its fast, stable, and is appropriate for Internet server or as a file server. FreeBSD supports all major X Window desktops, such as KDE and GNOME.
If you want to add Dedicated IPs on server having FreeBSD you need to follow following instructions.
First login to your FreeBSD server as a ‘non-root’ user. You should have an account in the ‘wheel’ group. Once you logged in your server just run the following commands to switch users to ‘root’
su -
Password:
server#
you will get command prompt as ‘#’ which indicates that you are operating server as ‘root’ user. Now run following commands as root :
ee /etc/rc.conf
now for example, if we want to add 4 IPs for your server [ 192.168.1.3 - 192.168.1.6 ] you need to implement following :
Code:
ifconfig_fxp0=”inet 192.168.1.2 netmask 255.255.255.248?
ifconfig_fxp0_alias0=”inet 192.168.1.3 netmask 255.255.255.255?
ifconfig_fxp0_alias1=”inet 192.168.1.4 netmask 255.255.255.255?
ifconfig_fxp0_alias2=”inet 192.168.1.5 netmask 255.255.255.255?
ifconfig_fxp0_alias3=”inet 192.168.1.6 netmask 255.255.255.255?
Note that changes to the _aliasNN and also the netmask changes to 255.255.255.255 from 255.255.255.248. The IP’s will not work unless you use a 255.255.255.255 netmask for the alias IP’s.
Once you added the entries to your file you need to press ‘ESC’ and have to save this file. You need to reboot the server so that all new IP’s would get bounded with your server and you can use them.
You have other option too, you can also use ifconfig command for adding IP’s on your server, in this case you don’t have to reboot your server. You can also add extra Dedicated IPs if you have WHM/cPanel control panel with your server. just login to your WHM account and add new Dedicated IP using WHM >> Add a new IP.
Installing SSL on server using WHM
*) Login to WHM.
*) Click on Install an SSL Certificate and Setup the Domain under the SSL/TLS menu.
*) Enter the domain, user name, and IP address for the certificate in the Domain, User, and IP Address fields.
*) Click on the Fetch button to paste the .key and .crt files for the domain into the fields, if they are currently on your server. Otherwise, copy and paste the .key and .crt files into the available display areas.
*) Paste the ca bundle for the certificate in the bottom display area
*)Click on the Submit button.
that’s all you have successfully installed an SSL certificate for req
How to trap cPanel ( WHM ) Password Modification
If your account is hosted on Linux hosting server then most webhosting service provider will offer you WHM/cPanel as hosting control panel depending on hosting package you choose. WHM/cpanel offer you large number of features using which you can manage your hosting account or website very easily. you can set/reset password of cpanel, can manage email accounts, hosting accounts, can easily disk quota, create FTP accounts, setup CMS etc….. Most important feature you have with these control panels is that you can change password of cpanel using cpanel aswell as WHM. You may have to change reset your control panel password for some security reason, thus this feature is very important for all webmasters.
If you want to know the password which have changed password of cpanel then you need to create a module in /usr/local/Cpanel/ChangePassword/. This will run as root when password is changed in WHM or cPanel.
Module features :
You can access following variables using above module :
- user (string) - Account Username
- newpass (string) - Account Password
- message (string)*** - Password Change Status Message
- rawout (string)*** - Password Change output
- service_ref (string)*** - Password Change Service
Thus in order to access above module you will have to do the following :
#!/usr/bin/perl
package Cpanel::ChangePassword::Sendtobilling;
use strict;
my %OPTS = @_;
my $user = $OPTS{’user’};
my $newpass = $OPTS{’newpass’};
#Add function to create object and password send
Username / Password can then be send to remote location thus you can retrieve password which have tried to change password of cpanel.
Unblock IP using CSF firewall - VPS server
you just need to edit csf.deny using vi csf.deny you need to remove IP address which you want to unblock from this file. Once you have edited above file you need to restart Firewall. For restarting Firewall you can use csf –r
Secure backup server
Tuesday, 27 October 2009
Error : Upgrading to 2.8.5 Wordpress
Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 2354937 bytes) in /home1/ottousco/satmareanul.com/wp-includes/http.php on line 1324
Might need to increase the amount of memory a PHP script may consume
1. If you have access to your PHP.ini file, change the line in PHP.ini
If your line shows 32M try 64M:
memory_limit = 64M ; Maximum amount of memory a script may consume (64MB)
2. If you don't have access to PHP.ini try adding this to an .htaccess file:
php_value memory_limit 64M
3. Try adding this line to your wp-config.php file:
define('WP_MEMORY_LIMIT', '64M');
4. Talk to your host.
Monday, 26 October 2009
Exim Error: Ratelimit database not available
2009-07-20 21:58:07 Failed to get write lock for /var/spool/exim/db/ratelimit.lockfile: timed out
2008-07-20 21:58:07 H=[xx.xx.xx.xx] temporarily rejected connection in “connect” ACL: ratelimit database not available
To fix such an error , the exim cache database on the server side needs to be clear off to stop this message.
Run the folllowing command on root :
# rm -fv /var/spool/exim/db/*
Output :
removed `/var/spool/exim/db/ratelimit’removed `/var/spool/exim/db/ratelimit.lockfile’removed `/var/spool/exim/db/retry’removed `/var/spool/exim/db/retry.lockfile’removed `/var/spool/exim/db/wait-dk_remote_smtp’removed `/var/spool/exim/db/wait-dk_remote_smtp.lockfile’removed `/var/spool/exim/db/wait-remote_smtp’removed `/var/spool/exim/db/wait-remote_smtp.lockfile’
Then run the following command on root:
# service exim restart
If this doesn’t work , then run /scripts/upcp –force on the server and then check exim_mainlog for the changes.
Sunday, 25 October 2009
Password protecting a directory with Apache and .htaccess
The Apache web server can read .htaccess files located anywhere in your document root to perform different tasks and control settings without changing the configuration files. This may be useful where you don't have access to change the configuration files or don't want to mangle with the configuration files to perform easy tasks. In this tutorial we're going to password protect a single directory on your web site.
First we'll need to create a file containing users and passwords:
htpasswd -c /etc/apache2/.htpasswd user1
htpasswd /etc/apache2/.htpasswd user2
You can store the password file anywhere you like but I chose to store it where the Apache configuration files are located.
Now create a .htaccess file in the folder you wish to protect (pico /var/www/secret/.htaccess)
AuthType Basic
AuthUserFile /etc/apache2/.htpasswd
AuthName "Enter password"
Require valid-user
Make sure Apache allows .htaccess to override settings. Add these lines into your virtual host configuration and change the directory to your document root (pico /etc/apache2/sites-enabled/000-default):
AllowOverride All
The AllowOverride setting may already be in your virtual host configuration. Make sure it is set to All.
If you changed the AllowOverride setting, restart Apache:
/etc/init.d/apache2 restart
The directory should now be password protected.
If you are getting server errors, make sure the Apache user has permission to read both the .htaccess file and .htpasswd.
chmod 755 /var/www/secret/.htaccess
chmod 755 /etc/apache2/.htpasswd
Monitoring PowerDNS with MRTG
Monitoring PowerDNS is easy with MRTG, just install these two packages and create a config file and you're good to go!
apt-get install libsnmp-session-perl mrtg
Add this to a config file, for example /etc/mrtg.cfg (pico /etc/mrtg.cfg)
Interval: 5
WorkDir: /var/www/mrtg
WriteExpires: yes
Options[_]: growright,nopercent
XSize[_]: 600
Target[udp-queries]: `/etc/init.d/pdns mrtg udp-queries udp-answers`
Options[udp-queries]: growright,nopercent,perminute
MaxBytes[udp-queries]: 600000
AbsMax[udp-queries]: 600000
Title[udp-queries]: Queries per minute
PageTop[udp-queries]: Queries per minute
WithPeak[udp-queries]: ymwd
YLegend[udp-queries]: queries/minute
ShortLegend[udp-queries]: q/m
LegendI[udp-queries]: udp-questions
LegendO[udp-queries]: udp-answers
Target[perc-failed]: `/etc/init.d/pdns mrtg udp-queries udp-answers`
Options[perc-failed]: growright,dorelpercent,perminute
MaxBytes[perc-failed]: 600000
AbsMax[perc-failed]: 600000
Title[perc-failed]: Queries per minute, with percentage success
PageTop[perc-failed]: Queries per minute, with percentage success
WithPeak[perc-failed]: ymwd
YLegend[perc-failed]: queries/minute
ShortLegend[perc-failed]: q/m
LegendI[perc-failed]: udp-questions
LegendO[perc-failed]: udp-answers
Target[packetcache-rate]: `/etc/init.d/pdns mrtg packetcache-hit udp-queries`
Options[packetcache-rate]: growright,dorelpercent,perminute
Title[packetcache-rate]: packetcache hitrate
MaxBytes[packetcache-rate]: 600000
AbsMax[packetcache-rate]: 600000
PageTop[packetcache-rate]: packetcache hitrate
WithPeak[packetcache-rate]: ymwd
YLegend[packetcache-rate]: queries/minute
ShortLegend[packetcache-rate]: q/m
LegendO[packetcache-rate]: total
LegendI[packetcache-rate]: hit
Target[packetcache-missrate]: `/etc/init.d/pdns mrtg packetcache-miss udp-queries`
Options[packetcache-missrate]: growright,dorelpercent,perminute
Title[packetcache-missrate]: packetcache MISSrate
MaxBytes[packetcache-missrate]: 600000
AbsMax[packetcache-missrate]: 600000
PageTop[packetcache-missrate]: packetcache MISSrate
WithPeak[packetcache-missrate]: ymwd
YLegend[packetcache-missrate]: queries/minute
ShortLegend[packetcache-missrate]: q/m
LegendO[packetcache-missrate]: total
LegendI[packetcache-missrate]: MISS
Target[latency]: `/etc/init.d/pdns mrtg latency`
Options[latency]: growright,nopercent,gauge
MaxBytes[latency]: 600000
AbsMax[latency]: 600000
Title[latency]: Query/answer latency
PageTop[latency]: Query/answer latency
WithPeak[latency]: ymwd
YLegend[latency]: usec
ShortLegend[latency]: usec
LegendO[latency]: latency
LegendI[latency]: latency
Target[recursing]: `/etc/init.d/pdns mrtg recursing-questions recursing-answers`
Options[recursing]: growright,nopercent,gauge
MaxBytes[recursing]: 600000
AbsMax[recursing]: 600000
Title[recursing]: Recursive questions/answers
PageTop[recursing]: Recursing questions/answers
WithPeak[recursing]: ymwd
YLegend[recursing]: queries/minute
ShortLegend[recursing]: q/m
LegendO[recursing]: recursing-questions
LegendI[recursing]: recursing-answers
Make mrtg create a new report every 5 minutes by adding the following line in crontab (type crontab -e):
0,5,10,15,20,25,30,35,40,45,50,55 * * * * env LANG=C /usr/bin/mrtg /etc/mrtg.cfg
Create a summary page showing all graphs:
indexmaker /etc/mrtg.cfg > /var/www/mrtg/index.html
If using the default mrtg/apache configuration you can access the graphs here: http://yourserver/mrtg
Installing PowerDNS on etch/lenny
The PowerDNS Nameserver is a modern, advanced and high performance authoritative-only nameserver. It is written from scratch and conforms to all relevant DNS standards documents. Furthermore, PowerDNS interfaces with almost any database.
This tutorial has been tested and is working on Debian etch and lenny
1. Install the PowerDNS server and MySql backend using apt
apt-get install pdns-server pdns-backend-mysql
2. Create a new database (or use existing) and execute the following SQL queries to create the PowerDNS table structure:
create table domains (
id INT auto_increment,
name VARCHAR(255) NOT NULL,
master VARCHAR(128) DEFAULT NULL,
last_check INT DEFAULT NULL,
type VARCHAR(6) NOT NULL,
notified_serial INT DEFAULT NULL,
account VARCHAR(40) DEFAULT NULL,
primary key (id)
)type=InnoDB;CREATE UNIQUE INDEX name_index ON domains(name);
CREATE TABLE records (
id INT auto_increment,
domain_id INT DEFAULT NULL,
name VARCHAR(255) DEFAULT NULL,
type VARCHAR(6) DEFAULT NULL,
content VARCHAR(255) DEFAULT NULL,
ttl INT DEFAULT NULL,
prio INT DEFAULT NULL,
change_date INT DEFAULT NULL,
primary key(id)
)type=InnoDB;
CREATE INDEX rec_name_index ON records(name);
CREATE INDEX nametype_index ON records(name,type);
CREATE INDEX domain_id ON records(domain_id);create table supermasters (
ip VARCHAR(25) NOT NULL,
nameserver VARCHAR(255) NOT NULL,
account VARCHAR(40) DEFAULT NULL
);
3. Configure PowerDNS to use the MySql backend by adding this line into the configuration file (pico /etc/powerdns/pdns.conf)
launch=gmysql
4. Configure MySql login information for the PowerDNS server that can read from the tables you created earlier by adding lines similar to these (pico /etc/powerdns/pdns.d/pdns.local)
gmysql-host=127.0.0.1
gmysql-user=pdns
gmysql-password=password
gmysql-dbname=pdns
Replace the username, password and dbname with a valid login information and database name.
5. Restart PowerDNS
/etc/init.d/pdns restart
Now you should have a fully functional PowerDNS server installed. To manage the database (adding zones and records), consider using the Poweradmin web-based administration tool.
Tuesday, 20 October 2009
How to change server time/timezone linux
# ln -sf /usr/share/zoneinfo/Africa/Johannesburg /etc/localtime
Repairing /scripts when upcp gets killed off
# tar -x -v -C / -j -p -f scripts.tar.bz2
# chmod 755 /scripts/cpanelsync
# /scripts/cpanelsync httpupdate.cpanel.net /cpanelsync/RELEASE/scripts /scripts
# /scripts/upcp --force
Wednesday, 7 October 2009
How to install or upgrade to PHP 5.2.x
To upgrade to PHP 5.2.x on CentOS/RHEL/Fedora:
Step 1) Set up the atomic channel:
wget -q -O - http://www.atomicorp.com/installers/atomic.sh | sh
Step 2) Upgrade to PHP 5.2.x:
yum upgrade
Step 3) Replace the PHP 4 php.ini with PHP 5.2.x's (if applicable):
mv /etc/php.ini.rpmnew /etc/php.ini
Step 4) Replace the php.conf with the PHP 5.2.x php.conf (if applicable):
mv /etc/httpd/conf.d/php.conf.rpmnew /etc/httpd/conf.d/php.conf
Step 5) Restart the webserver
service httpd restart
(or)
/etc/init.d/httpd restart
Checklist
1) Source code installations of extensions, like Ioncube loader, or other extensions that have to be updated. Ive created php-ioncube-loader, php-zend-optimizer, and php-eaccelerator packages to fix this for you automatically.
2) php.ini settings, like memory_limit
3) execstack -c on any extensions that claim to need an executible stack (ASL users only).
Known Issues
1) VPS and RHEL users, If you dont use the atomic installer, you're going to miss some dependencies, like sqlite3. Have fun with that!
2) RHEL4 users (and possibly others) can resolve the sqlite3 dependencies by grabbing rpms from the CentOS repositories. The atomic installer fixes this for you automatically. If you dont use it... have fun with that!
rpm -Uvh http://isoredirect.centos.org/centos/4/os/i386/CentOS/RPMS/sqlite-3.3.6-2.i386.rpm http://isoredirect.centos.org/centos/4/os/i386/CentOS/RPMS/sqlite-devel-3.3.6-2.i386.rpm
up2date php
OR
yum update php
Works like a charm
3) PHP 5.2.5 causes problems with Horde and Apache configuration files on PSA 8.2.1 and lower. PSA 8.3.0 has fixed this problem, so the easiest way to fix these issues is to upgrade to PSA 8.3.0 or higher. Otherwise, you'll need to perform the following extra steps:
3a) Modify /etc/httpd/conf.d/zz010_psa_httpd.conf
Change this:
php_admin_value include_path "/usr/share/psa-horde:/usr/share/psa-horde/pear:."
to
php_admin_value include_path "/usr/share/psa-horde/lib:/usr/share/psa-horde:/usr/share/psa-horde/pear:."
Note this file is changed every time plesk is updated, so you'll need to go back and fix this when it does.
This also fixes the PHP Fatal error: Can't load Horde/SessionObjects.php, open_basedir restriction problem.
3b) General issues with php_admin_value:
The fix for now is to replace the use of php_admin_value with php_value. I have only tested this as far as the domains on this server. You will find this used all over the place in zz010_psa_httpd.conf, domain level httpd.includes, and most likely in your own customizations. The biggest problems Ive had are with register_globals and include_path, I have not run into any issues with PSA httpd.include files and open_basedir.
4) Plesk Sitebuilder is not compatible with 5.2.x on systems that did not come with it natively. Either remove it, with yum remove sb-publish, or you *might* be able to get it to work by using the php-sqlite2 from the Fedora 8 plesk repo. php-sqlite2 was added to the atomic repo to handle sitebuilder integration.
Problems with MySQL databases and PLESK 9 after upgrade.
If you get the following error after upgrading when you try to log into PLESK then you need to upgrade your database tables:
ERROR: PleskFatalException
bad column in table: `backup_time` time NOT NULL default '00:00:00',
[...]
Issue the following command from the shell:
mysqlcheck --check-upgrade --all-databases --auto-repair -uadmin -pyouradminpassword
followed by:
cat /usr/share/mysql/mysql_fix_privilege_tables.sql | /usr/bin/mysql --no-defaults --force --user=admin --password=youradminpassword ----host=localhost --database=mysql --host=localhost --database=mysql
How to install or upgrade to PHP 5.2.x
To upgrade to PHP 5.2.x on CentOS/RHEL/Fedora:
Step 1) Set up the atomic channel:
wget -q -O - http://www.atomicorp.com/installers/atomic.sh | sh
Step 2) Upgrade to PHP 5.2.x:
yum upgrade
Step 3) Replace the PHP 4 php.ini with PHP 5.2.x's (if applicable):
mv /etc/php.ini.rpmnew /etc/php.ini
Step 4) Replace the php.conf with the PHP 5.2.x php.conf (if applicable):
mv /etc/httpd/conf.d/php.conf.rpmnew /etc/httpd/conf.d/php.conf
Step 5) Restart the webserver
service httpd restart
(or)
/etc/init.d/httpd restart
Checklist
1) Source code installations of extensions, like Ioncube loader, or other extensions that have to be updated. Ive created php-ioncube-loader, php-zend-optimizer, and php-eaccelerator packages to fix this for you automatically.
2) php.ini settings, like memory_limit
3) execstack -c on any extensions that claim to need an executible stack (ASL users only).
Known Issues
1) VPS and RHEL users, If you dont use the atomic installer, you're going to miss some dependencies, like sqlite3. Have fun with that!
2) RHEL4 users (and possibly others) can resolve the sqlite3 dependencies by grabbing rpms from the CentOS repositories. The atomic installer fixes this for you automatically. If you dont use it... have fun with that!
rpm -Uvh http://isoredirect.centos.org/centos/4/os/i386/CentOS/RPMS/sqlite-3.3.6-2.i386.rpm http://isoredirect.centos.org/centos/4/os/i386/CentOS/RPMS/sqlite-devel-3.3.6-2.i386.rpm
up2date php
OR
yum update php
Works like a charm
3) PHP 5.2.5 causes problems with Horde and Apache configuration files on PSA 8.2.1 and lower. PSA 8.3.0 has fixed this problem, so the easiest way to fix these issues is to upgrade to PSA 8.3.0 or higher. Otherwise, you'll need to perform the following extra steps:
3a) Modify /etc/httpd/conf.d/zz010_psa_httpd.conf
Change this:
php_admin_value include_path "/usr/share/psa-horde:/usr/share/psa-horde/pear:."
to
php_admin_value include_path "/usr/share/psa-horde/lib:/usr/share/psa-horde:/usr/share/psa-horde/pear:."
Note this file is changed every time plesk is updated, so you'll need to go back and fix this when it does.
This also fixes the PHP Fatal error: Can't load Horde/SessionObjects.php, open_basedir restriction problem.
3b) General issues with php_admin_value:
The fix for now is to replace the use of php_admin_value with php_value. I have only tested this as far as the domains on this server. You will find this used all over the place in zz010_psa_httpd.conf, domain level httpd.includes, and most likely in your own customizations. The biggest problems Ive had are with register_globals and include_path, I have not run into any issues with PSA httpd.include files and open_basedir.
4) Plesk Sitebuilder is not compatible with 5.2.x on systems that did not come with it natively. Either remove it, with yum remove sb-publish, or you *might* be able to get it to work by using the php-sqlite2 from the Fedora 8 plesk repo. php-sqlite2 was added to the atomic repo to handle sitebuilder integration.
Problems with MySQL databases and PLESK 9 after upgrade.
If you get the following error after upgrading when you try to log into PLESK then you need to upgrade your database tables:
ERROR: PleskFatalException
bad column in table: `backup_time` time NOT NULL default '00:00:00',
[...]
Issue the following command from the shell:
mysqlcheck --check-upgrade --all-databases --auto-repair -uadmin -pyouradminpassword
followed by:
cat /usr/share/mysql/mysql_fix_privilege_tables.sql | /usr/bin/mysql --no-defaults --force --user=admin --password=youradminpassword ----host=localhost --database=mysql --host=localhost --database=mysql