Wednesday, May 28, 2014

Install ClamAV and Configure Daily Scanning on CentOS

ClamAV is an open source (GPL) antivirus engine designed for detecting Trojans, viruses, malware and other malicious threats on Linux. 

In this article, we will only be configuring ClamAV to run scheduled/on-demand scans; not resident scans.

1. Install EPEL repo

Before we can do proceed, you must ensure that you have the EPEL yum repository enabled.
CentOS 6 – 32-bit
CentOS 6 – 64-bit
CentOS 5 – 32-bit
 CentOS 5 – 64-bit
After running the above commands for your relevant CentOS version, the following file is created:
/etc/yum.repos.d/epel.repo
The above file can be edited directly to enable or disable the EPEL repo.

 2. Install required ClamAV packages

1yum install clamav clamd

3. Start the clamd service and set it to auto-start

1/etc/init.d/clamd on
2chkconfig clamd on
3/etc/init.d/clamd start

4. Update ClamAV’s signatures

1/usr/bin/freshclam
Note: ClamAV will update automatically, as part of /etc/cron.daily/freshclam.

B. Configure Daily Scan

In this example, we will configure a cronjob to scan the /home/ directory every day:

1. Create cron file:

1vim /etc/cron.daily/manual_clamscan
Add the following to the file above. Be sure to change SCAN_DIR to the directory that you want to scan:
1#!/bin/bash
2SCAN_DIR="/home"
3LOG_FILE="/var/log/clamav/manual_clamscan.log"
4/usr/bin/clamscan -i -r $SCAN_DIR >> $LOG_FILE
Give our cron script executable permissions:
1chmod +x /etc/cron.daily/manual_clamscan
You can even run the above script to ensure that it works correctly.

Tuesday, May 13, 2014

Install FFMPEG and FFMPEG-PHP in CentOS 6

Installing FFMpeg


 Add dag's repository by adding the following to /etc/yum.repos.d/dag.repo
[dag]
name=Dag RPM Repository for Red Hat Enterprise Linux
baseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/dag
gpgcheck=1
gpgkey=http://dag.wieers.com/packages/RPM-GPG-KEY.dag.txt
enabled=1
protect=0
next import dag's rpm gpg key by
wget http://dag.wieers.com/packages/RPM-GPG-KEY.dag.txt -P /tmp
rpm --import /tmp/RPM-GPG-KEY.dag.txt
Proceed with installing FFMPEG and some development packages
yum install ffmpeg-devel php-devel re2c php-xml ffmpeg
verify FFMPEG is installed successfully by executing
ffmpeg
you should get something like
FFmpeg version 0.6.5, Copyright (c) 2000-2010 the FFmpeg developers
built on Jan 29 2012 17:52:15 with gcc 4.4.5 20110214 (Red Hat 4.4.5-6)
configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --mandir=/usr/share/man --incdir=/usr/include --disable-avisynth --extra-cflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fPIC' --enable-avfilter --enable-avfilter-lavf --enable-libdc1394 --enable-libdirac --enable-libfaac --enable-libfaad --enable-libfaadbin --enable-libgsm --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libx264 --enable-gpl --enable-nonfree --enable-postproc --enable-pthreads --enable-shared --enable-swscale --enable-vdpau --enable-version3 --enable-x11grab
libavutil 50.15. 1 / 50.15. 1
libavcodec 52.72. 2 / 52.72. 2
libavformat 52.64. 2 / 52.64. 2
libavdevice 52. 2. 0 / 52. 2. 0
libavfilter 1.19. 0 / 1.19. 0
libswscale 0.11. 0 / 0.11. 0
libpostproc 51. 2. 0 / 51. 2. 0
Hyper fast Audio and Video encoder


Compile and install the FFMPEG-PHP extension
mkdir /srv/build
cd /srv/build
wget http://downloads.sourceforge.net/project/ffmpeg-php/ffmpeg-php/0.6.0/ffmpeg-php-0.6.0.tbz2
tar -xjf ffmpeg-php-0.6.0.tbz2
cd ffmpeg-php-0.6.0/

phpize
./configure
now run the following to prevent compilation failure with something like ffmpeg_frame.c:421: error: ‘PIX_FMT_RGBA32’ undeclared (first use in this function)
sed -i 's#PIX_FMT_RGBA32#PIX_FMT_RGB32#' ./ffmpeg_frame.c
and compile and install using
make
make install
you should end up with something like
Installing shared extensions:     /usr/lib64/php/modules/


Load the FFMPEG-PHP extension and reload Apache
Add the following at the end in php.ini.
[ffmpeg] 
extension=ffmpeg.so
restart the webserver by
/etc/init.d/httpd restart
verify that the FFMPEG-PHP extension is loaded
php -i | grep ffmpeg
php -m | grep ffmpeg


If you get the below errors:


/root/ffmpeg/ffmpeg-php-0.7.0/ffmpeg_movie.c: In function 'zim_ffmpeg_movie___construct':
/root/ffmpeg/ffmpeg-php-0.7.0/ffmpeg_movie.c:318: error: 'list_entry' undeclared (first use in this function)
/root/ffmpeg/ffmpeg-php-0.7.0/ffmpeg_movie.c:318: error: (Each undeclared identifier is reported only once
/root/ffmpeg/ffmpeg-php-0.7.0/ffmpeg_movie.c:318: error: for each function it appears in.)
/root/ffmpeg/ffmpeg-php-0.7.0/ffmpeg_movie.c:318: error: 'le' undeclared (first use in this function)
/root/ffmpeg/ffmpeg-php-0.7.0/ffmpeg_movie.c:353: error: expected ';' before 'new_le'
/root/ffmpeg/ffmpeg-php-0.7.0/ffmpeg_movie.c:363: error: 'new_le' undeclared (first use in this function)

Solution:
Please change the following lines in ffmpeg_movie.c
Changes in ffmpeg_movie.c:
row 311: list_entry *le; TO zend_rsrc_list_entry *le;
row 346: list_entry new_le; TO zend_rsrc_list_entry new_le;
row 360: hashkey_length+1, (void *)&new_le, sizeof(list_entry), TO
hashkey_length+1, (void *)&new_le,sizeof(zend_rsrc_list_entry)

Putty - Password less login

Steps to generate key and access server without passwords.
Written by : Harijith R.          
Prerequisites : Download putty-0.63-installer.exe from the URL: http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html.
putty-0.63-installer.exe is a Windows installer for everything except PuTTYtel.
Step 1
Generate a public/private key pair on your local desktop. From the Start menu, run Start > All Programs > PuTTY > PuTTYgen as illustrated below.


Fig. 1 Initial PuTTYgen window.

Click the Generate button. You will be prompted to move the mouse over the blank area to generate some randomness. Do so. Shortly thereafter, the program will generate the key and display the result (see Figure 2).

Fig. 2 After keys have been generated.

click the "Save private key" button to save the private key to a file (Figure 3).

Fig. 3 Saving the private key in file mykey.ppk.
Step 2
Install the public key on the remote host to which you want to connect. Do this by pasting the public key from the Clipboard into the the authorized_keys file, which is located in the .ssh directory in your home directory on the remote host.
Step 3
Verify that public key authentication works. Basic public key authentication is enabled for a particular session in the Connection > SSH > Auth window. You must load the session profile (Figure 6) before configuring the Auth window (Figure 7).

Fig. 6 Load the appropriate session profile.

Fig. 7 Connection > SSH > Auth window.
Browse to select the saved private key which we saved in step 1 in the "Private key file for authentication" text box.
Be sure to go back to the Session window and click Save to update the profile. The session will use public key authentication as demonstrated in Figure 8.

Fig. 8 Logging in using basic public key authentication.


Twitter Delicious Facebook Digg Stumbleupon Favorites More

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Affiliate Network Reviews