ffmpeg-php error

While compiling ffmpeg-php:-

Error: /usr/src/ffmpeg-php-0.6.0/ffmpeg_frame.c: In function ‘zif_ffmpeg_frame_toGDImage’: /usr/src/ffmpeg-php-0.6.0/ffmpeg_frame.c:336: error: ‘PIX_FMT_RGBA32′ undeclared (first use in this function) /usr/src/ffmpeg-php-0.6.0/ffmpeg_frame.c:336: error: (Each undeclared identifier is reported only once /usr/src/ffmpeg-php-0.6.0/ffmpeg_frame.c:336: error: for each function it appears in.) /usr/src/ffmpeg-php-0.6.0/ffmpeg_frame.c: In function ‘zif_ffmpeg_frame_ffmpeg_frame’: /usr/src/ffmpeg-php-0.6.0/ffmpeg_frame.c:421: error: ‘PIX_FMT_RGBA32′ undeclared (first use in this function)

————————————————————————————–

Fix: With the latest version of ffmpeg-php (0.6.0), update ffmpeg_frame.c and replace every instance of PIX_FMT_RGBA32 with PIX_FMT_RGB32

vi ffmpeg_frame.c

:%s/PIX_FMT_RGBA32/PIX_FMT_RGB32

:w :q!

./configure make make install add extension=”ffmpeg.so” inside php.ini .

Dealing with Exim Spammers

There are two aspects to dealing with spam for a server administrator:

1. Inbound spam to users

2. Outbound spam from compromised scripts

Both need very different approaches to help detect, remove and resolve.

Inbound spam is the scourge of the modern internet and, the inconvenience to users aside, can cause serious performance and resource issues on the server. These can affect both the server overall and the timely deliver of clean email in particular.

The best way to tackle inbound spam is at the entry point into the server – the MTA, i.e. exim the SMTP server of choice for cPanel. By blocking spam before it has even entered the server you save both on server resources used when delivering the email in addition to 3rd party tools to help detect spam further along the email relay process.

To do this you need to do work at the RCPT stage of the SMTP protocol. This occurs during the transaction between the sender and recipient SMTP servers and comes before the actual body of an email arrives on a server.

The primary form of spam attack is the Dictionary Attack: A common technique for spammers to use is what is known as a dictionary attack on a domain. A dictionary attack, in our context, is a single SMTP connection that attempts to send email from a spam source to a random set of names on our domain, e.g. bob@ourdomain.com fred@ourdomain.com harry@ourdomain.com, in the hope that one of the many hundreds that we try will get a hit and deliver our spam.

This technique is used by spammers mainly because most people don’t advertise their email addresses (due to spam!) and they want to access this untapped market.

To prevent this type of spam getting through, it is essential that you do not use the Default Address (catchall) feature within cPanel to receive emails wherever possible. You should always setup specific Forwarders (aliases) for any email addresses you use and set the Default Address to :fail: for each domain.

By using :fail: exim will automatically reject email at the SMTP RCPT stage and make dictionary attacks redundant. Additionally, you can use exim ACLs to block such spammers who repeatedly perform dictionary attacks to further relieve the server of the load from dealing with them. See: http://www.configserver.com/free/eximdeny.html

From a server performance perspective, it is essential that you use :fail: and not :blackhole: with email addresses or the Default Address to block such spam. Mor information about the reasoning for this is presented here.

Another preventative measure is to enable the WHM options:

WHM > Exim Configuration Editor > Verify the existance of email senders. WHM > Exim Configuration Editor > Use callouts to verify the existance of email senders.

These two options have exim check that any server that attempts to relay email to your server can actually receive email in reply. This is part of the RFC requirements of an SMTP server and the inability of a server to do so indicates a likely spammer.

There are numerous other checks that you can also perform at the SMTP RCPT stage in exim ACLs. Examples are using RBL checks to reject email from IP addresses that originate from IP addresses that are know to harbour spammers, e.g.:

deny message = Message rejected – $sender_fullhost is in an RBL, see $dnslist_text !hosts = +relay_hosts !authenticated = * dnslists = bl.spamcop.net : sbl-xbl.spamhaus.org

You can also check the format of email headers to ensure that they’re RFC compliant, which many spam servers are not. A typical example is checking the SMTP HELO/EHLO protocol command to ensure it’s correctly structured, e.g.:

deny message = HELO/EHLO set to my IP address condition = ${if match {$sender_helo_name}{11.22.33.44} {yes}{no}}

(where 11.22.33.44 is your servers main IP address)

deny message = EHLO/HELO does not contain a dotted address condition = ${if match{$sender_helo_name}{\\.}{no}{yes}}

Finally, once the email has passed through these hoops, you can implement a 3rd party application to scan emails and tag them as likely spam. cPanel has an inbuilt solution that uses SpamAssassin to score email likely to be spam. You can then have such emails filtered to a special account or the client can filter such emails based on the email header record modifications made by SpamAssassin.

An alternative is to use a more thorough tool such as MailScanner which can be very effective at scoring spam emails. A free installation tool is available for cPanel servers from us here or as a paid service here.

However, a cPanel server using such a tool is not supported by cPanel and would have to be removed/disabled before cPanel would investigate any email related issues should you need support.

Outbound spam from compromised scripts

Outgoing spam is likely to come from two sources:

1. Indirectly from a compromised web script in a clients account

2. Directly from a client

The starting point for both will be the exim mainlog:

/var/log/exim_mainlog (Linux)

/var/log/exim/mainlog (FreeBSD)

For the purpose of this document I am going to assume a Linux OS.

The most laborious way to track messages down is to trawl the exim mainlog and to look for anomalous behaviour. This is actually very difficult to do and you really need to narrow down exactly what you are looking for.

Tracking down spammers is a difficult affair, but can be made easier with some preparation of your servers environment. I would strongly advise that you add the following to the exim configuration to enable some extended logging that greatly improves the ease in tracking down on-server spammers:

In WHM > Exim Configuration Editor > Switch to Advanced Mode > in the first textbox add the following line and then Save:

log_selector = +arguments +subject

This tells exim to log the path on disk from where the email was executed and the subject of the email. You can then interrogate the exim mainlog more easily. The best way to do this is to obtain the original email header from the spam originating from your server. This you should receive either from the person reporting the spam, or from remnants of a spam attack in the exim mail queue. The part required in the email is the exim message id in the Received: header line within the email header of the spam.

As an example, take the following email header:

Return-path: Received: from [11.22.33.44] (helo=barfoo.com) by foobar.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.52) id 1FZ8z3-0006M4-Do for fred@foobar.com; Thu, 27 Apr 2006 17:04:49 +0100 Received: from forums by barfoo.com with local (Exim 4.43) id 1FZ8zt-0005lz-E7 for fred@foobar.com; Thu, 27 Apr 2006 12:05:41 -0400 To: fred@foobar.com Subject: Buy Me! From: bob@barfoo.com

The Received: header lines are added to the email header, so the original Received: line that we’re interested in is:

Received: from forums by barfoo.com with local (Exim 4.43) id 1FZ8zt-0005lz-E7 for fred@foobar.com; Thu, 27 Apr 2006 12:05:41 -0400

And the id we want is 1FZ8zt-0005lz-E7

This is the unique identifier for this email that has originated from the server. With this, we can follow the exim transaction on the server to see how it was processed using:

grep 1FZ8zt-0005lz-E7 /var/log/exim_mainlog

(be aware that the exim_mainlog files may have been rotated so you may have to expand compressed archives and search them instead)

This transaction may look something like this:

2006-04-27 17:43:41 1FZ8zt-0005lz-E7 fred@foobar.com R=lookuphost T=remote_smtp H=foobar.com [44.33.22.11] X=TLSv1:AES256-SHA:256 2006-04-27 17:43:53 1FZ8zt-0005lz-E7 Completed

In this example, we can see that the email originated from the nobody user locally on the server. This means that the likely spam was sent from a script on the server. The nobody user is used to run the Apache web server and is the default username and group that Apache will execute web scripts as. Two things can affect this:

1. suexec, if enabled, will run CGI scripts as the owner of the script file, typically the cPanel account name

2. phpsuexec, if enabled, will run PHP scripts in the same manner as CGI script

Suexec is typically always enabled on web servers and phpsuexec may or may not be. If phpsuexec is not enabled, then in all likelihood, the script run under the nobody account will be a PHP script.

From the example above we can see that a script was run from with the /home/ClientX/public_html/phpBB/ directory on the server, which would suggest a compromised PHP script within that directory.

Here’s another example of a spam originating from a client instead of a script. This can happen either with malicious intent, or if the clients PC has been compromised by a virus or worm:

2006-04-27 17:54:51 1FZ9lT-000707-O2 fred@foobar.com R=boxtraper_autowhitelist T=boxtrapper_autowhitelist 2006-04-27 17:54:52 1FZ9lT-000707-O2 => fred@foobar.com R=lookuphost T=remote_smtp H=foobar.com [44.33.22.11] X=TLSv1:AES256-SHA:256 2006-04-27 17:54:52 1FZ9lT-000707-O2 Completed I

n this example, the key part is: A=fixed_plain:bob@barfoo.com

This shows that the email was authenticated for relaying using SMTP AUTH (i.e. fixed_plain) and the username bob@barfoo.com from that clients PC.

As you can see, there is a great depth to the amount of work needed to track down spammers on a server, plus there’s the additional work of closing holes in insecure scripts if they are the cause.

Some instances can be much more complex and require trawling through the Apache logs for domains in /usr/local/apache/domlogs/* which is not a trivial matter. The best security from such exploitation is to keep your server secure and to be aware of who and what you allow on your server.

Apache Graceful Restart Requested Every Two Hours

Apache by default logs data directly to log files. While this isn’t a bad thing, it is not your only option. Both Apache 1.x and Apache 2.x bring with them the option of enabling something called “Piped Logging”, though cPanel will only allow you to enable it for version 2.x.

 

Piped logging is extremely powerful when used correctly, and has far more flexibility than what we are using here. The way it is described here, we will be attempting to negate the memory hungry apache processes that creep up when a server is hosting very low traffic websites (less than 1 request per second) with traditional Apache log configurations.

The restart notices were appearing in the log 12 times a day along with any other scheduled or manual restarts. This is an excerpt of yesterday’s error log.

# grep 'Aug 13' /usr/local/apache/logs/error_log | grep 'Graceful'
[Fri Aug 13 01:12:46 2010] [notice] Graceful restart requested, doing restart
[Fri Aug 13 03:10:53 2010] [notice] Graceful restart requested, doing restart
[Fri Aug 13 05:08:28 2010] [notice] Graceful restart requested, doing restart
[Fri Aug 13 07:05:49 2010] [notice] Graceful restart requested, doing restart
[Fri Aug 13 08:05:13 2010] [notice] Graceful restart requested, doing restart
[Fri Aug 13 09:11:05 2010] [notice] Graceful restart requested, doing restart
[Fri Aug 13 11:08:16 2010] [notice] Graceful restart requested, doing restart
[Fri Aug 13 13:05:19 2010] [notice] Graceful restart requested, doing restart
[Fri Aug 13 15:02:23 2010] [notice] Graceful restart requested, doing restart
[Fri Aug 13 17:16:05 2010] [notice] Graceful restart requested, doing restart
[Fri Aug 13 19:13:09 2010] [notice] Graceful restart requested, doing restart
[Fri Aug 13 21:10:11 2010] [notice] Graceful restart requested, doing restart
[Fri Aug 13 23:07:14 2010] [notice] Graceful restart requested, doing restart

The Fix!

Enter Piped logging. Enabling piped logging in this way has a few different effects, but the one we are primarily concerned with is preventing Apache from initiating that graceful restart request every two hours.

Pre-implementation:

Note: You will need to have root access to the server in order to implement piped logging.

Software Requirements:
Cpanel Version: 11.25.0-R43471 or later
Apache Version 2 or later

You can check your versions with the following commands:
cPanel:
[host - root]: cat /usr/local/cpanel/version
For Apache:
[host - root]: /usr/local/apache/bin/httpd -v

Implementation

There are two possible ways to implement this fix, one is via the command line, the other is through the WHM.

Method 1: All Command Line

Make a backup of the Apache config:

[host:root]: cp /usr/local/apache/conf/httpd.conf /usr/local/apache/conf/httpd.prepipedlogging

Edit /var/cpanel/cpanel.config:

[host:root]: vi /var/cpanel/cpanel.config

Add the following

enable_piped_logs=1

Make cPanel aware of the change:

[host:root]: /usr/local/cpanel/whostmgr/bin/whostmgr2 --updatetweaksettings

Rebuild the Apache config:

[host:root]: /scripts/rebuildhttpdconf

Stop and Start Apache:

/etc/init.d/httpd stop
/etc/init.d/httpd start

Method 2: Allow cPanel/WHM to do the hard parts

Make a backup of the Apache config:
[host:root]: cp /usr/local/apache/conf/httpd.conf /usr/local/apache/conf/httpd.prepipedlogging

Log into WHM, and follow this sequence to the right place:
Service Configuration >> Apache Configuration >> Piped Log Configuration
Enable piped Apache logging, save it and let it rebuild the configuration.

 

 

Buggy Wget Fantastico issue

This is a script written by me, copy and run this from the shell.
#!/bin/bash
#
# Script for correct wget version and installing Fantastico
#
# Usage: sh fantastico-wget.sh
#
# Script written by Nithin Sunny

echo “####### WGET BUGGY VERSION ISSUE with FANTASTICO INSTALLATION (FIX) #######”
echo -e “\n”
if [ “$(uname -i)” == ‘x86_64’ ]; then
echo “This is a 64 bit server…”
cd
wget http://ftp.gnu.org/gnu/wget/wget-latest.tar.gz
tar xfz wget-latest.tar.gz
cd wget-*
./configure
make
make install
cd ../
rm -Rf wget-*
echo -e “\n”
echo “Fantastico Installation………………………”
cd /usr/local/cpanel/whostmgr/docroot/cgi
wget -N http://www.netenberg.com/files/free/fantastico_whm_admin.tgz
tar -xzpf fantastico_whm_admin.tgz
rm -rf fantastico_whm_admin.tgz
echo -e “\n”
echo “This will install a clean copy of wget on your server at /usr/local/bin/wget; Go into WHM as root, click on the Fantastico Admin area and click install. On the screen, be sure to enter /usr/local/bin/wget as the path to wget…….”
echo -e “\n”
echo “Then click to start the installation….”
exit 1;
else
echo “This is a 32 bit server…”
rpm -qa wget ;
wget ftp://ftp.funet.fi/pub/mirrors/ftp.redhat.com/pub/fedora/linux/core/5/i386/os/Fedora/RPMS/wget-1.10.2-3.2.1.i386.rpm
chattr -ia /usr/bin/wget
rpm -e wget ;
rpm -ivh –force wget-1.10.2-3.2.1.i386.rpm ;
rpm -qa wget ;
echo -e “\n”
echo “Fantastico Installation………………………”
cd /usr/local/cpanel/whostmgr/docroot/cgi
wget -N http://www.netenberg.com/files/free/fantastico_whm_admin.tgz
tar -xzpf fantastico_whm_admin.tgz
rm -rf fantastico_whm_admin.tgz
echo -e “\n”

echo “Go into WHM as root, click on the Fantastico Admin area and click install. “
echo -e “\n”
echo “Then click to start the installation…”
fi