Sunday, May 9, 2010

Step by Step Installing mod_security from Source in Linux Centos5.4, Fedora12 Howto

To Install mod Security from the source go to the Website of Mod security and download the packages
[superuser@ashwin modse]# get http://www.modsecurity.org/download/modsecurity-apache_2.5.12.tar.gz

–2010-05-05 15:19:12– http://www.modsecurity.org/download/modsecurity-apache_2.5.12.tar.gz

Saving to: `modsecurity-apache_2.5.12.tar.gz’

100%[=======================================>] 1,392,209 1235.9Mb/s in 5s

2010-05-05 15:19:18 (1235.7 MB/s) – `modsecurity-apache_2.5.12.tar.gz’ saved [1392209/1392209]

[superuser@ashwin modse]# tar -zxf modsecurity-apache_2.5.

To see the Full Tutorial:

Step by Step Installing mod_security from Source in Linux Centos5.4, Fedora12 Howto

Thursday, May 6, 2010

Howto Add New User, New Group and modify Users, Groups in Linux - Centos5.4, Fedora 11 - Part 1

Adding users in Linux helps you from giving all user Administrative (root access) rights if the system is used by Multiple people. Its one of the basic command but still very important which need to studied in much details, The More detail you know about adding user and adding group modifying existing users and groups may lead with excellent system administration skills and also help you with securing system. There are many attributes to read when we learn about useradd and groupadd command in linux. In this article we will go indepth of Adding, Modifying User and groups and also discussing about various parameters while using these commands.

Adding New User in Linux

Adding a new user to your linuxbox is as simple as running a command with a argument which is the username to be created

[root@ashwin ~]# useradd ashwin


Great You have created a new user but now into the technical details how does the user gets the home directory, how is the UID,GID set, how the default shell is assigned and other different features gets assigned when addding a user.

When you add a user immediately some files are checked if the user is already present Files

1. /etc/passwd
2. /etc/groups
3. /etc/shadows

If the user is not present in the above 3 files the next step is to look for another set of files which by default assign values to a newly added user the file which is looked is
 # cat /etc/login.defs 


The above file contains all the default parameter like, UID, GID to be set for new user, Home Directory (If not specified explicitly). Now once the user is added the home directory is created in /home/username by default and assigned a unique UID,GID. When you see the contents of /home/username you will find files

[ashwin@ashwin ~]$ ll -a /home/ashwin/
-rw-r--r--. 1 root root 18 2009-04-08 16:16 .bash_logout
-rw-r--r--. 1 root root 176 2009-04-08 16:16 .bash_profile
-rw-r--r--. 1 root root 124 2009-04-08 16:16 .bashrc
-rw-r--r--. 1 root root 500 2009-04-10 17:22 .emacs
drwxr-xr-x. 2 root root 4096 2009-03-18 06:22 .gnome2
drwxr-xr-x. 4 root root 4096 2010-03-19 12:20 .mozilla
-rw-r--r--. 1 root root 658 2009-03-02 22:50 .zshrc

Now from where these files came from, yes this files are copied to every newly added user from the /etc/skel folder.


[ashwin@ashwin ~]$ ll -a /etc/skel/
-rw-r--r--. 1 root root 18 2009-04-08 16:16 .bash_logout
-rw-r--r--. 1 root root 176 2009-04-08 16:16 .bash_profile
-rw-r--r--. 1 root root 124 2009-04-08 16:16 .bashrc
-rw-r--r--. 1 root root 500 2009-04-10 17:22 .emacs
drwxr-xr-x. 2 root root 4096 2009-03-18 06:22 .gnome2
drwxr-xr-x. 4 root root 4096 2010-03-19 12:20 .mozilla
-rw-r--r--. 1 root root 658 2009-03-02 22:50 .zshrc


Now a Bit more depth on useradd, we'll now discuss some parameters while adding a new user to change the default home directory, UID, GID, Default Shell Login, Password

The Following arguments can be used to the command useradd

-b, --base-dir BASE_DIR base directory for the new user account
home directory
-c, --comment COMMENT set the GECOS field for the new user account
-d, --home-dir HOME_DIR home directory for the new user account
-D, --defaults print or save modified default useradd
configuration
-e, --expiredate EXPIRE_DATE set account expiration date to EXPIRE_DATE
-f, --inactive INACTIVE set password inactive after expiration to INACTIVE
-g, --gid GROUP force use GROUP for the new user account
-G, --groups GROUPS list of supplementary groups for the new user account
-h, --help display this help message and exit
-k, --skel SKEL_DIR specify an alternative skel directory
-K, --key KEY=VALUE overrides /etc/login.defs defaults
-l, do not add the user to the lastlog and faillog databases
-m, --create-home create home directory for the new user account
-M, do not create user's home directory(overrides /etc/login.defs)
-N, --no-user-group do not create a group with the same name as the user
-o, --non-unique allow create user with duplicate (non-unique) UID
-p, --password PASSWORD use encrypted password for the new user account
-r, --system create a system account
-s , --shell SHELL the login shell for the new user account
-u, --uid UID force use the UID for the new user account
-U, --user-group create a group with the same name as the user
-Z, --selinux-user SEUSER use a specific SEUSER for the SELinux user mapping



    Examples


1. Add user with home directory in /opt/username

[root@ashwin ~]# useradd -d /opt/ username

2. Add user with defined home directory UID, GID

[root@ashwin ~]# useradd -d /opt/ -u 800 -g 800 username


3. Defining password while adding a new user

[root@ashwin ~]# useradd -d /opt/ -u 800 -g 800 -p password username

4. Defining the login shell for the new user account

[root@ashwin ~]# useradd -d /opt/ -u 800 -g 800 -p password -s /bin/sh username

[root@ashwin ~]# useradd -d /opt/ -u 800 -g 800 -p password -s /bin/nologin username

Explore around with the parameters you would find many features in it.

Also Look For Parts Two to know more depth knowledge of User and Group adding in Linux

Wednesday, May 5, 2010

Step by Step Installing mod_security from Source in Linux Centos5.4, Fedora12 Howto

To Install mod Security from the source go to the Website of Mod security and download the packages
[superuser@ashwin modse]# get http://www.modsecurity.org/download/modsecurity-apache_2.5.12.tar.gz

--2010-05-05 15:19:12-- http://www.modsecurity.org/download/modsecurity-apache_2.5.12.tar.gz

Saving to: `modsecurity-apache_2.5.12.tar.gz'

100%[=======================================>] 1,392,209 1235.9Mb/s in 5s

2010-05-05 15:19:18 (1235.7 MB/s) - `modsecurity-apache_2.5.12.tar.gz' saved [1392209/1392209]

[superuser@ashwin modse]# tar -zxf modsecurity-apache_2.5.12.tar.gz
[superuser@ashwin modse]# cd modsecurity-apache_2.5.12

Stop Apache httpd
[superuser@ashwin modse]# service httpd stop
[superuser@ashwin apache2]# /configure --with-apxs=/path/to/httpd-2.x.y/bin/apxs

Compile with:
[superuser@ashwin apache2]# make

Optionally test with:
[superuser@ashwin apache2]# make test

Optionally build the ModSecurity Log Collector with:
[superuser@ashwin apache2]# make mlogc

Install the ModSecurity module with:
[superuser@ashwin apache2]# make install

If you get the below error you need to recompile apache with DSO and APXS

configure: looking for Apache module support via DSO through APXS
configure: error: couldn't find APXS

Solution
[superuser@ashwin modse]# get http://apache.siamwebhosting.com/httpd/httpd-2.2.15.tar.gz
[superuser@ashwin modse]# cd httpd-2.2.15
[superuser@ashwin httpd-2.2.15]# ./configure --enable-so --with-pcre
[superuser@ashwin httpd-2.2.15]# make
[superuser@ashwin httpd-2.2.15]# make install

Now Change you directory to /your/path/mod-security/apache2/
Install MOD-Security
[superuser@ashwin apache2]# make install

Congratulation you have successfully installed mod-security now to make it work add the following lines in your apache configuration file
[superuser@ashwin apache2]# vi /etc/httpd/conf/httpd.conf
LoadFile /usr/lib/libxml2.so
LoadFile /usr/lib/liblua5.1.so

# Load the ModSecurity module with:
LoadModule security2_module modules/mod_security2.so

Now Restart Apache Service and you ready to Go
superuser@ashwin apache2]# service httpd start

Thursday, April 15, 2010

Email Marketing In India - How Do I Choose One from Many

Email Marketing In India




As the name say Email used for marketing communications. it is nothing but broadcasting of emails to the general public who can be potential customer or are already your customers.In this article we'll discuss Emailing Marketing in India.

India being the quickest revenue generating country for a new product launch and also being the HIGHEST ROI (Return on Investment) country entrepreneurs have kept an eagles eye launching their product/services publicly. As computer reach in India increased a lot in the last 5 years there it has became easier for marketers to plan out strategies while being cost effective and fruitful. As Email marketing has made people Night Millionaires it has been a big time headache for consumers and end users receiving hundreds or even thousands of SPAM mail landing into their Mailbox. These have made life of MSP's (Mail Service Providers), ISP's (Internet Service providers) to be on the toes every second and tighten the security of the services provided. Also their are many legitimate mails which land up in Users SPAMBOX which is due to some users in the network sending unsolicited commercial email and the IP getting listed in the SPAM Sources.

To select and judge the best in business Email marketing companies you should always check the following points:

1. Server Locations
2. Deliverable of mail
3. Handling Queues
4. Reports
5. Support (Prefer Local Support)
6. Track Record of Company (Google it out for Review You will get the Best)

Advantages
E-mail marketing (on the Internet) is popular with companies for several reasons:

  • An exact return on investment can be tracked ("track to basket") and has proven to be high when done properly. E-mail marketing is often reported as second only to search marketing as the most effective online marketing tactic.

  • Advertisers can reach substantial numbers of e-mail subscribers who have opted in (i.e., consented) to receive e-mail communications on subjects of interest to them.

  • Over half of Internet users check or send e-mail on a typical day.


Disadvantages

  • A report issued by the e-mail services company Return Path, as of mid-2008 e-mail deliverability is still an issue for legitimate marketers. According to the report, legitimate e-mail servers averaged a delivery rate of 56%; twenty percent of the messages were rejected, and eight percent were filtered.

  • Companies considering the use of an e-mail marketing program must make sure that their program does not violate spam laws such as the United States' Controlling the Assault of Non-Solicited Pornography and Marketing Act (CAN-SPAM),the European Privacy and Electronic Communications Regulations 2003, or their Internet service provider's acceptable use policy.

  • As of there are less Strict Spam Laws in India


Companies That has being into the business for long and gained lot of trust in the Email Marketing Industries in India
1. Quantumlink Communications Pvt. Ltd.
They have a state of art Service Name MAILDIRECT managed by Highly skilled team of System Administrators backed up with Professional Support and highly motivated Sales team which cares for your ROI.

MailDirect is hosted on high-end servers, which ensures high-speed Internet connectivity, resulting in extremely low delivery times and zero choke of your bandwidth. Companies can only upload your message and the list, all the rest is done through a very intuitive browser-based interface on the server and your Email / SMS communication campaign is ready to roll.

You can Download Brochure Here

Visit the Company Website at www.qlc.in

2. EMAIL Marketing in India
Best in its class for Bulk Mailing
Visit http://www.emailmarketingindia.com

Friday, April 9, 2010

Howto Install RED5 Flash Media Server in Fedora 11, Centos 5.4, Redhat

Red5 is an Open Source Flash Media Server written in Java that supports:

* Streaming Audio/Video (FLV and MP3)
* Recording Client Streams (FLV only)
* Shared Objects
* Live Stream Publishing
* Remoting (AMF)

This is a reverse engineered open source project which aims to produce a feature-complete implementation written in Java. It os one of the Full implementation RTMP servers other than:

Adobe Flash Media Server,
Onlinelib VCS Video Communication Server
Wowza Media Server
WebORB Integration Server
haXeVideo

In this tutorial we'll learn howto installRED5 on Centos 5.4,Fedora, Redhat and other Linux Distribution, There are many ways to achieve this but this is how i installed RED5 Media Server on Fedora 11.

Red5 Requires Java Development Kit (JDK) to run so you have to install Java onto the system,You can acheive this in 2 ways
1. Either Use Yellow DOG Updater
# yum -y install java-1.6.0-openjdk java-1.6.0-openjdk-devel


OR

Download JDK and Compile
cd /usr/java 
IF /usr/java cannot be found
mkdir /usr/java
Go to the Link and Download http://java.sun.com/javase/downloads/widget/jdk6.jsp and Download jdk-6u19-linux-i586.bin

mv /home/ashwin/Download/jdk-6u19-linux-i586.bin /usr/java/

chmod +x jdk-6u19-linux-i586.bin
./jdk-6u19-linux-i586.bin

You will see
JAVA_HOME="/usr/java/jdk1.6"
export JAVA_HOME
echo $JAVA_HOME


Great Now you have installed JAVA now proceed

Another Important requirement is ANT (It is a Apache Project) which we require to compile the RED5 Code, Good News is you dont need to compile ANT as it is already in binary format Just extract and install it in /usr/java


#cd /home/ashwin/
#w.get http://mirrors.kahuki.com/apache/ant/binaries/apache-ant-1.8.0-bin.tar.bz2
#tar -jxf apache-ant-1.8.0-bin.tar.bz2
#mv apache-ant-1.8.0 /usr/local/ant


Now we need to Export the JAVA and ANT Environment Variables which would help us in installing and proper running if RED5 Server


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


vi /etc/bashrc

# ALSO Put the Above Here
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



Now download the latest RED5 CODE from the site to build


cd /home/ashwin/
svn checkout http://red5.googlecode.com/svn/java/server/trunk/ red5
mv red5 /usr/local/
cd /usr/local/red5
ant prepare
ant dist


You would you screen scrolling and you are not able to understand anything "CHILL" All is well and RED5 Media Server is getting compiled, AT the END you would SEE

BUILD SUCCESSFUL

If you see this you have made it you have done 95% of the work. Now copy the conf directory from dist/ and test the red5 installation.

cp -r dist/conf .
./red5.sh


STARTING, STOPPING,RESTARTING RED5 Media Server
I have created a Init Script Click Here

INIT Script to Start,STOP, RESTART RED5 Media Server

Start RED5

/etc/init.d/red5 start


TESTING RED5

Go TO your Browser Address Bar and Type

http://your.ip.address:5080

Check Out the Demos
http://your.ip.address:5080/demos/


ISSUE

When you run ./red5.sh, it will show you Installer service created. Thats mean everything runs fine and red5 server is up. But if you went to port_tester.swf using demos above or your application shows connections FAILS, this is an issue of RTMPT and RTMPTS. You can see it by running


/usr/local/red5/red5.sh

output trancated

[INFO] [main] org.red5.server.tomcat.TomcatLoader – RTMPT server bean was not found
[INFO] [main] org.red5.server.tomcat.TomcatLoader – RTMPS server bean was not found

output truncated

If you see this you have to uncomment the RTMPT and RTMPTS TomcatLoader in/usr/local/red5/conf/red5-core.xml



vi /usr/local/red5/conf/red5-core.xml

Search for a lines



Remove the from end of


Same goes for RTMPS



Remove the from end of




Restart the red5 services and connection fails problem will be fixed.

Init Script to Start, Stop, Restart RED5 Media Server

Click Here Howto Install RED5 Flash Media Server in Fedora 11, Centos 5.4, Redhat

RED5 is Open Source Media Flash Server, Highly Scalable and Customizable

Just Copy the Code in

vi /etc/init.d/red5


COPY the Below Code

#!/bin/sh
# Author : Ashwin
# Description: Red5 Media Flash streaming server

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



chmod 755 /etc/init.d/red5

Test It

/etc/init.d/red5 start
/etc/init.d/red5 stop
/etc/init.d/red5 restart

Tuesday, April 6, 2010

Howto setup local yum repository on RedHat Fedora12 Centos5.4

This article is about Setting up a Local yum repository to be used for local network. Local Yum Repository can save internet bandwidth downloading all your packages from the local repository over FAST LAN Network.

If You want to use it in your network the best option to be used is using Httpd - Apache so the yum repository will be acessible via web.

Step 1
Check if Httpd is installed and running

[root@localhost ~]# ps ax | grep http

3617 ? Ss 0:00 /usr/sbin/httpd
3621 ? S 0:00 /usr/sbin/httpd
3622 ? S 0:00 /usr/sbin/httpd
3623 ? S 0:00 /usr/sbin/httpd
3624 ? S 0:00 /usr/sbin/httpd
3625 ? S 0:00 /usr/sbin/httpd
3626 ? S 0:00 /usr/sbin/httpd
3627 ? S 0:00 /usr/sbin/httpd
3628 ? S 0:00 /usr/sbin/httpd
3629 ? S 0:00 /usr/sbin/httpd

If it is not running then Start HTTPD

[root@localhost ~]# /etc/init.d/httpd start

OR

[root@localhost ~]# service httpd start


and if you haven't installed httpd yet then you can do it by

[root@localhost ~]# yum install httpd


Now make httpd start at every system boot automatically by putting it in system Startup.

[root@localhost ~]# chkconfig --levels 235 httpd on

Start apache
[root@localhost ~]# /etc/init.d/httpd start
OR
[root@localhost ~]# service httpd start


How to Build the Repository
We will use Apache's default Document root to store the packages, Default DocumentRoot for apache is "/var/www/html".

Create a dir in the Document Root named yum. We will create two more directories
base-pkg : This would contain all the packages of the Linux Distribution you are making repository for.
updates : This would contain all the update packages for your Linux Distribution

[root@localhost ~]# mkdir /var/www/html/yum
[root@localhost ~]# mkdir /var/www/html/yum/base-pkg
[root@localhost ~]# mkdir /var/www/html/yum/updates


BUILDING YOU REPOSITORY

To build you yum repository the easy way is copy all the contents from the Linux Distribution DVD/CD Media to the repository location in this case /var/www/html/yum, Make sure that you copy all the contents (Packages) into the base-pkg directory. If you have a Media follow the Steps Below


[root@localhost ~]# mount /dev/cdrom /mnt
[root@localhost ~]# cp -v /mnt/Packages/* /var/www/html/yum/base-pkg/
[root@localhost ~]# umount /mnt


Now we need a tool "createrepo" which would create a repository for the linux distibution. By default it is comes installed with all Distribution of linux, but if its not installed use yum to install it.
Check if createrepo is installed
[root@localhost ~]# which createrepo
/usr/bin/createrepo


If you get the above result skip the next step and start Building the repository if its not installed then install it
[root@localhost ~]# yum install createrepo


Now Run the createrepo tool

[root@localhost ~]# createrepo /var/www/html/yum/base-pkg/

[root@localhost ~]# ls -l /var/www/html/yum/base-pkg/repodata/
-rw-r--r-- 1 root root 2227275 2010-02-18 11:51 filelists.xml.gz
-rw-r--r-- 1 root root 6487453 2010-02-18 11:51 other.xml.gz
-rw-r--r-- 1 root root 747714 2010-02-18 11:51 primary.xml.gz
-rw-r--r-- 1 root root 951 2010-02-18 11:51 repomd.xml

The Second step building repository is updating your updates directory for all new packages. Go to the Main website of the Linux Distribution you are preparing repostory for and check the updates link or use the below links

CENTOS : rsync://centos.arcticnetwork.ca/centos/5.4/updates/i386/RPMS/
FEDORA : rsync rsync://mirror.aarnet.edu.au/fedora/linux/updates/12/i386/

As per you distribution rsync the data to the updates directory
FOR CENTOS RUN
[root@localhost ~]# rsync -avrt rsync://centos.arcticnetwork.ca/centos/5.4/updates/i386/RPMS/ --exclude=debug/ /var/www/html/yum/updates/
FOR CENTOS RUN
[root@localhost ~]# rsync -avrt rsync://mirror.aarnet.edu.au/fedora/linux/updates/12/i386/ --exclude=debug/ /var/www/html/yum/updates/


To get the updates regularly you can put the above command inthe crontab so that you updates directories are updated periodically

[root@localhost ~]# crontab -e 
* * 2 * * rsync -avrt rsync://centos.arcticnetwork.ca/centos/5.4/updates/i386/RPMS/ --exclude=debug/ /var/www/html/yum/updates/


You have created local yum repository, now to make clients on your network to use the local repository, create a file mylocal.repo in /etc/yum.repos.d

[root@localhost ~]# vim /etc/yum.repos.d/mylocal.repo
Add the Following Lines

[base-local]
name=Centos $releasever - $basearch
failovermethod=priority
baseurl=http://192.168.1.1/yum/base-pkg/
enabled=1
gpgcheck=0

[updates-local]
name=Centos $releasever - $basearch - Updates
failovermethod=priority
baseurl=http://192.168.1.1/yum/updates/
enabled=1
gpgcheck=0


THAT's IT, Now you can update all your packages over high Speed Lan connectivity instead of Internet.