Sunday, March 2, 2008

How to Configure APF Firewall?

APF will block unused outgoing and incoming ports. It can also be configured to use information from some block lists. The below port list will work for cPanel. For the other control panels you will need to add in the administration ports.

link http://www.rfxnetworks.com/apf.php

http://www.eth0.us/apf#comment-392

------
-----command-----
cd /usr/local/src
wget http://rfxnetworks.com/downloads/apf-current.tar.gz
tar -zxf apf-current.tar.gz
cd apf-0.*
./install.sh
-----command-----



Now edit config file
-----command-----
pico -w /etc/apf/conf.apf
-----command-----

Scroll down to the "Common ingress (inbound) TCP ports section. At this point you need to find the correct configuration for your control panel.



-----cPanel -----
IG_TCP_CPORTS="20,21,22,25,26,53,80,110,143,443,465,993,995,2082,2083,2086,2087,2095,2096"
IG_UDP_CPORTS="21,53,873"

EGF="1"
EG_TCP_CPORTS="21,22,25,26,27,37,43,53,80,110,113,443,465,873,2089"
EG_UDP_CPORTS="20,21,37,53,873"



----Ensim -----
IG_TCP_CPORTS="21,22,25,53,80,110,143,443,19638"
IG_UDP_CPORTS="53"

EGF="1"
EG_TCP_CPORTS="21,22,25,53,80,110,443"
EG_UDP_CPORTS="20,21,53"



----Plesk -----

IG_TCP_CPORTS="20,21,22,25,53,80,110,143,443,465,993,995,8443"
IG_UDP_CPORTS="37,53,873"

EGF="1"
EG_TCP_CPORTS="20,21,22,25,53,37,43,80,113,443,465,873,5224"
EG_UDP_CPORTS="53,873"

Save the file and start apf via.

-----command-----
apf -s
-----command-----

If everything still works then edit the config file and turn dev mode off. Make sure you can start a new ssh session before changing dev mode off. If you are kicked out you need to go back and look at what caused the problem!
DEVEL_MODE="0"

Now restart APF
-----command-----
apf -r
-----command-----

Automatic way to fix RPM installations

Automatic way to fix RPM installations :

If you are installing rpm which is having many dependancies then you can do it with the up2date utility. It will automatically install all the dependencies for rpm package that is installed. If you have access to Red Hat Network (RHN) you can use the command up2date to update and it will download & install RPM packages.

>>> up2date

It will connect to RHN (Red hat network), automatically download, and install the package.(Only for Registered channel). If there are dependencies or another RPM packages, they will be automatically get downloaded and installed as well.

For example:

# up2date smbfs-2.0.1-4 [programs to access SMB network servers]

The up2date command will automatically resolve, fetch and install any package dependencies for the package to be installed.

Also up2date command will download and install latest version of that package.

FFmpeg

* FFmpeg (http://ffmpeg.mplayerhq.hu)
* FFmpeg-PHP (http://ffmpeg-php.sourceforge.net)
* Mplayer + Mencoder (mencoder is now built into the mplayer svn release )
(http://www.mplayerhq.hu/design7/dload.html)
* flv2tool ***REQUIRES RUBY ON RAILS*** (http://inlet-media.de/flvtool2)
* LAME MP3 Encoder (http://lame.sourceforge.net)
* Libogg + Libvorbis (http://www.xiph.org/downloads)


Login to your server as root, then:

# cd /usr/local/src

Download the sources to your server:

# wget http://www3.mplayerhq.hu/MPlayer/releases/codecs/essential-20061022.tar.bz2
# wget http://rubyforge.org/frs/download.php/9225/flvtool2_1.0.5_rc6.tgz
# wget http://easynews.dl.sourceforge.net/sourceforge/lame/lame-3.97.tar.gz
# wget http://superb-west.dl.sourceforge.net/sourceforge/ffmpeg-php/ffmpeg-php-0.5.0.tbz2
# wget http://downloads.xiph.org/releases/ogg/libogg-1.1.3.tar.gz
# wget http://downloads.xiph.org/releases/vorbis/libvorbis-1.1.2.tar.gz

Extract all sources:

# tar -xzf flvtool2_1.0.5_rc6.tgz
# tar -xzf lame-3.97.tar.gz
# tar -xzf libogg-1.1.3.tar.gz
# tar -xzf libvorbis-1.1.2.tar.gz
# tar -xjf essential-20061022.tar.bz2
# tar -xjf ffmpeg-php-0.5.0.tbz2

Create new directory:

# mkdir /usr/local/lib/codecs/

We need to install SVN and Ruby On Rails:

# up2date -i subversion
# up2date -i ruby

# svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg
# svn checkout svn://svn.mplayerhq.hu/mplayer/trunk mplayer
# cd /usr/local/src/mplayer
# svn update

Copy Codecs for MPlayer:

# mv /usr/local/src/essential-20061022/* /usr/local/lib/codecs/
# chmod -R 755 /usr/local/lib/codecs/

Secure folder TMP:

# mkdir /usr/local/src/tmp
# chmod 777 /usr/local/src/tmp
# export TMPDIR=/usr/local/src/tmp

Lame:

# cd /usr/local/src/lame-3.97
# ./configure
# make && make install

LibOgg:

# cd /usr/local/src/libogg-1.1.3
# ./configure && make && make install

LibVorbis:

# cd /usr/local/src/libvorbis-1.1.2
# ./configure && make && make install

FlvTool2:

# cd /usr/local/src/flvtool2_1.0.5_rc6/
# ruby setup.rb config
# ruby setup.rb setup
# ruby setup.rb install

MPlayer:

# cd /usr/local/src/mplayer
# ./configure && make && make install

FFMpeg:

# cd /usr/local/src/ffmpeg/
# ./configure --enable-libmp3lame --enable-libvorbis --disable-mmx --enable-shared
# echo ‘#define HAVE_LRINTF 1 ‘>>config.h

# make
# make install

# ln -s /usr/local/lib/libavformat.so.50 /usr/lib/libavformat.so.50
# ln -s /usr/local/lib/libavcodec.so.51 /usr/lib/libavcodec.so.51
# ln -s /usr/local/lib/libavutil.so.49 /usr/lib/libavutil.so.49
# ln -s /usr/local/lib/libmp3lame.so.0 /usr/lib/libmp3lame.so.0
# ln -s /usr/local/lib/libavformat.so.51 /usr/lib/libavformat.so.51
# cd /usr/local/src/

FFMpeg-PHP:

# cd /usr/local/src/ffmpeg-php-0.5.0/
# phpize
# ./configure
# make
# make install

Notice: Make sure this is the correct php.ini for the box!!

# echo ‘extension=/usr/local/lib/php/extensions/no-debug-non-zts-20020429/ffmpeg.so’ >> /usr/local/Zend/etc/php.ini
# service httpd restart

Done!





======

http://ffmpeg-php.sourceforge.net/


svn co https://svn.sourceforge.net/svnroot/ffmpeg-php/trunk/ffmpeg-php

Change to the ffmpeg-php extension directory and run phpize (included with your PHP installation) to build configuration files.

1. cd ffmpeg-php
2. phpize

Configure and build the extension.

1. ./configure && make

Install the shared extension.

1. make install (as root)

If everything went as planned, ffmpeg-php is now installed as a shared extension


===============================================================================
OR
===============================================================================.


A few people have asked for this to be done so heres a howto for installing:

FFmpeg
FFmpeg-PHP
Mplayer + Mencoder (mencoder is now built into the mplayer svn release )
flv2tool ***REQUIRES RUBY ON RAILS***
LAME MP3 Encoder
Libogg
Libvorbis


+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++





CODE
cd /usr/local/src



GET CRAP:



wget http://www3.mplayerhq.hu/MPlayer/releases/codecs/essential-20061022.tar.bz2 ( UPDATED 20070308 )

wget http://rubyforge.org/frs/download.php/9225/flvtool2_1.0.5_rc6.tgz

wget http://easynews.dl.sourceforge.net/sourceforge/lame/lame-3.97.tar.gz

wget http://superb-west.dl.sourceforge.net/sourceforge/ffmpeg-php/ffmpeg-php-0.5.0.tbz2

wget http://downloads.xiph.org/releases/ogg/libogg-1.1.3.tar.gz

wget http://downloads.xiph.org/releases/vorbis/libvorbis-1.1.2.tar.gz



EXTRACT THE CRAP:



tar zxvf flvtool2_1.0.5_rc6.tgz

tar zxvf lame-3.97.tar.gz

tar zxvf libogg-1.1.3.tar.gz

tar zxvf libvorbis-1.1.2.tar.gz

tar zxvf flvtool2_1.0.5_rc6.tgz

tar jxvf essential-20061022.tar.bz2 ( UPDATED 20070308 )

tar jxvf ffmpeg-php-0.5.0.tbz2



WE NEED A DIR MADE:



mkdir /usr/local/lib/codecs/



WE NEED TO INSTALL SVN + ROR:



up2date -i subversion

up2date -i ruby

up2date -i ncurses-devel

svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg

svn checkout svn://svn.mplayerhq.hu/mplayer/trunk mplayer

cd /usr/local/src/mplayer

svn update

cd /usr/local/src



COPY CODECS FOR MPLAYER:



mv /usr/local/src/essential-20060611/* /usr/local/lib/codecs/

chmod -R 755 /usr/local/lib/codecs/



SECURE TMP IS A PAIN AT TIMES Wink



mkdir /usr/local/src/tmp

chmod 777 /usr/local/src/tmp

export TMPDIR=/usr/local/src/tmp



LAME:



cd /usr/local/src/lame-3.97

./configure

make && make install



cd /usr/local/src/



LIBOGG:



cd /usr/local/src/libogg-1.1.3

./configure && make && make install

cd /usr/local/src/



LIBVORBIS:



cd /usr/local/src/libvorbis-1.1.2

./configure && make && make install

cd /usr/local/src/



FLVTOOL2:



cd /usr/local/src/flvtool2_1.0.5_rc6/

ruby setup.rb config

ruby setup.rb setup

ruby setup.rb install

cd /usr/local/src/



cd /usr/local/src/mplayer

./configure && make && make install

cd /usr/local/src/



FFMPEG:

cd /usr/local/src/ffmpeg/

./configure --enable-libmp3lame --enable-libogg --enable-libvorbis --disable-mmx --enable-shared



######### IGNORE THIS ECHO LINE The dev's fixed the issue in svn. Im only leaveing it here in case it comes up again ###############
echo '#define HAVE_LRINTF 1 '>>config.h
################################################################################
##############################


make

make install



ln -s /usr/local/lib/libavformat.so.50 /usr/lib/libavformat.so.50

ln -s /usr/local/lib/libavcodec.so.51 /usr/lib/libavcodec.so.51

ln -s /usr/local/lib/libavutil.so.49 /usr/lib/libavutil.so.49

ln -s /usr/local/lib/libmp3lame.so.0 /usr/lib/libmp3lame.so.0

ln -s /usr/local/lib/libavformat.so.51 /usr/lib/libavformat.so.51

cd /usr/local/src/



FFMPEG-PHP:

cd /usr/local/src/ffmpeg-php-0.5.0/

phpize

./configure

make

make install

NOTICE: Make sure this is the correct php.ini for the box!!



echo 'extension=/usr/local/lib/php/extensions/no-debug-non-zts-20020429/ffmpeg.so' >> /usr/local/Zend/etc/php.ini



NOTICE: Make sure this is the correct php.ini for the box!!



service httpd restart



=================

=================

open egress svn port 3090 :


iptables -t filter -I OUTPUT -p tcp --dport 3090 -j ACCEPT



---------------------------------=
=====================

OGG not found while configuring libvorbis-1.1.2

yum install vorbis-tools
=========================================

./configure libogg-1.1.3 : c++ complier error

yum install gcc-c++

========================================

./configure lame-3.97 c complier error
yum install gcc

linuxengineers2 says:
phpize not found while Compile FFMPEG-PHP

To check Php-devel for phpize command

rpm -q php-devel
rpm -ql php-devel | grep phpize

You'll have to make sure the at least the following packages are installed:
automake
autoconf
make
gcc
libtool

==============

wget http://www3.mplayerhq.hu/MPlayer/releases/MPlayer-1.0rc2.tar.bz2
tar jxvf MPlayer-1.0rc2.tar.bz2
cd MPlayer-1.0rc2
./configure && make && make install

Saturday, March 1, 2008

webalizer errors : Unable to lock DNS cache file /usr/local/psa/var/webalizer.cache

If you get following error while running webalizer updater :

Error: Unable to lock DNS cache file /usr/local/psa/var/webalizer.cache

then do as follows:

rm -f /usr/local/psa/var/webalizer.cache
touch /usr/local/psa/var/webalizer.cache
chown root:root /usr/local/psa/var/webalizer.cache
chmod 644 /usr/local/psa/var/webalizer.cache
start /usr/local/psa/var/webalizer.cache
=====================================================================================
/usr/bin/webalizer -n 145street.com -D /usr/local/psa/var/webalizer.cache -p -N 15 -o /home/httpd/vhosts/145street.com/webstat -F clf /home/httpd/vhosts/145street.com/logs/access_log

replace the above domain name with therespective domain name .

500 internal server error

Just a quick note about "Internal Server Error" problems after upgrading Apache on these Plesk machines.

You may start getting the "500 Internal Server Error" errors after doing so, and that is because the upgraded Apache has overwritten the Plesk version of "suexec", a handy little program that allows the webserver to run CGI-BIN programs.

However, you are in luck! Plesk keeps a copy of their modified version of "suexec" around on the box.

How-To restore suexec:
1. log in as the 'root' user on yer box.
2. cd /usr/sbin
3. mv suexec suexec.old (or whatever you want to call it)
4. cp psa-suexec suexec

Technical Jazz:
The problem is that Apache's stock version of suexec doesn't allow (for safety reasons) cgi-bin programs to be execute from any but underneath the MAIN Apache document root. Which, in the case of these Plesk servers is /var/www... since all the virtually hosted addresses live under /home/httpd/vhosts..., the stock Apache suexec doesn't allow that. Modifying suexec is something of a hobby in the unix web administration world, so this isn't entirely odd.

BTW, you can also check the /var/log/suexec.log to see what is being suexec'ed, and what errors are happening. The error you'll see in this case is "command not in docroot".

login get locked due to incorrect logins?

login get locked due to incorrect logins?

Restart plesk service from shell(SSH) using
# service psa restart

How to rename the Domain Name

You can rename the domain name in Plesk using the following steps:
1) go to MySql prompt.
2) give following commands:
use psa;
Under this database there is a table called "domains" in which all the domain name are present under the field "display Name", all you have to do is update the record of the domain in issue to the new one.
The update query for MySql will be as follows:
UPDATE domains SET display Name='New Domain Name' WHERE age='old Domain name';
After this query check the domain in Plesk and it will be renamed.
Alternative Solution :
Here is the solution.
Go to control panel.
click on domain name.
click on Domain Administration option.
Enter the new domain and click ok.
The domain will be renamed.