Thursday 21 August 2014

Network Monitoring In Linux

#vnStat

vnStat is a console-based network traffic monitor for Linux and BSD that keeps a log of network traffic for the selected interface(s). It uses the network interface statistics provided by the kernel as information source. This means that vnStat won't actually be sniffing any traffic and also ensures light use of system resources. However, in Linux at least a 2.2 series kernel is required.

This program is open source / GPL'ed and can be installed either as root or as a single user. Better instructions are included in the README. Feel free to send comments by email (remove the spamfilter) or try contacting me from irc (Vergo @ IRCNet).


http://humdi.net/vnstat/

Thursday 3 July 2014

Best open source webmail clients

Best open source webmail clients


There are too many webmail clients are available on web.
Choosing best out of them is quit difficult task for any one.
After exploring tens of webmail clients, I will vote for following webmail client as top 3  webmail clients:
  • Roundcube: I would rate it as the best and easy to install. It has rich text editor and clent side filtering support. Also it hase good web interface.
RoundCube
RoundCube
  • Zimbra: Not explored much about, but based on futures its quite a popular webmail
Zimbra
  • SquirrelMail: Its basic webmail with basic web interface. There is no rich text editor support. There are lot of plugins available for SquirrelMail. 
SquirrelMail
SquirrelMail
  • RainLoop: Recently I seen this webmail client so thought to share. UI is good in RailLoop. I am not tested it but when I walk through installation procedure its looking straight forward and easy.
RainLoop WebMail
RainLoop WebMail
All above webmails are open source.

Thursday 26 June 2014

MySQL Replication CentOS All Databases

** THIS BLOG WORKS ONLY WITH MySQL VERSION 5.1 or EARLIER **
If you’re going to do it, do it right. Usually blogs have you do this for only 1 Database, that’s pretty much worthless, we’re going to do it right using the traditional Master/Slave Setup. This article assumes you have two Boxes with MySQL already installed, started, just not yet configured. Here’s what we have:
Standard Setup, Port 3306, same MySQL Version 5.1.69
MASTER = 192.168.1.241
SLAVE = 192.168.1.242
Let’s get Started!
Edit the MySQL configuration file on your master (you may want to make a backup)
 MySQL Replication CentOS All Databases
add these lines below the [mysqld] part somewhere
 MySQL Replication CentOS All Databases
now restart MySQL
 MySQL Replication CentOS All Databases
Now we have to create a slave user (service account) in order to process replications, so login to MySQL
 MySQL Replication CentOS All Databases
you prob. do not want to use the example credentials we have:
 MySQL Replication CentOS All Databases
now run the next few commands: MySQL Replication CentOS All Databases
now we need to write our Position Number down (it’s unique every time, this is our example, yours will be different)
exit to a shell, and dump the database info MySQL Replication CentOS All Databases
and Unlock all tables on Master
 MySQL Replication CentOS All Databases
now copy/sftp the .db to the SLAVE server.
from here, login and edit the MySQL config
 MySQL Replication CentOS All Databases
append the following to the config (please edit username/password and host if different)
 MySQL Replication CentOS All Databases
import your dump (do not yet restart MySQL until after you have imported the DUMP)
 MySQL Replication CentOS All Databases
modify the slave in MySQL
 MySQL Replication CentOS All Databases
 MySQL Replication CentOS All Databases
Perfect! It’s working! (if not check your username/password configuration for replication user in MySQL)
 MySQL Replication CentOS All Databases
Now to show off a bit:
create a database on the Master
 MySQL Replication CentOS All Databases
now let’s go to the slave:
 MySQL Replication CentOS All Databases

On CentOS 6 or Red Hat 6, installing a DHCP server

On CentOS 6 or Red Hat 6, installing a DHCP server is not too difficult. I’ll show you how it works!



First, install the DHCP server:
$ sudo yum install dhcp


The configuration file (blank) is located here:

/etc/dhcp/dhcpd.conf


To copy a sample configuration file over for the production file, use the following command:


$ sudo cp /usr/share/doc/dhcp-4.1.1/dhcpd.conf.sample /etc/dhcp/dhcpd.conf


Next edit /etc/dhcp/dhcpd.conf as needed, then save:

$ sudo nano /etc/dhcp/dhcpd.conf


For help on the syntax see the Red Hat doc here.



After making changes to the /etc/dhcp/dhcpd.conf file as needed, one other file must be changed to specify the NIC that dhcp listens on.

$ sudo nano /etc/sysconfig/dhcpd


# Command line options here
DHCPDARGS=eth0
Finally, cross your fingers, and start DHCP:
$ sudo service dhcpd start
If upon starting the dhcp server it fails, check /var/log/messages to look for what is wrong.

$ sudo service dhcpd start
Starting dhcpd:                                            [FAILED]


$ cat /var/log/messages

Dec 10 08:15:35 centos dhcpd: No subnet declaration for eth0 (10.112.12.34).

Dec 10 08:21:36 centos dhcpd: bad range, address 10.112.239.20 not in subnet 10.112.12.0 netmask 255.255.255.224


On CentOS 6 or Red Hat 6, installing a DHCP server is not too difficult. I’ll show you how it works!



First, install the DHCP server:
$ sudo yum install dhcp


The configuration file (blank) is located here:

/etc/dhcp/dhcpd.conf


To copy a sample configuration file over for the production file, use the following command:


$ sudo cp /usr/share/doc/dhcp-4.1.1/dhcpd.conf.sample /etc/dhcp/dhcpd.conf


Next edit /etc/dhcp/dhcpd.conf as needed, then save:

$ sudo nano /etc/dhcp/dhcpd.conf


For help on the syntax see the Red Hat doc here.



After making changes to the /etc/dhcp/dhcpd.conf file as needed, one other file must be changed to specify the NIC that dhcp listens on.

$ sudo nano /etc/sysconfig/dhcpd


# Command line options here
DHCPDARGS=eth0
Finally, cross your fingers, and start DHCP:
$ sudo service dhcpd start
If upon starting the dhcp server it fails, check /var/log/messages to look for what is wrong.

$ sudo service dhcpd start
Starting dhcpd:                                            [FAILED]


$ cat /var/log/messages

Dec 10 08:15:35 centos dhcpd: No subnet declaration for eth0 (10.112.12.34).

Dec 10 08:21:36 centos dhcpd: bad range, address 10.112.239.20 not in subnet 10.112.12.0 netmask 255.255.255.224


Wednesday 18 June 2014

Server wide permission issue after enabling suphp

test@server[~]#cat /root/suphppermission.sh
#!/bin/bash
# Reset the directory permissions.
chmod 755 /opt/suphp
find /opt/suphp -type d -exec chmod 755 {} \;
# Reset permission,ownership for cPanel user
for user in `/bin/ls /var/cpanel/users`; do
chown -R ${user}:${user} /home/${user}/public_html
chmod 755 /home/${user}/public_html
find /home/${user}/public_html -type f -exec chmod 644 {} \;
find /home/${user}/public_html -type d -exec chmod 755 {} \;
# Remove php_values in the .htaccess file.
find /home/${user}/public_html -name ‘.htaccess’ -exec sed -ie ‘s/php_value/#php_value/’ {} \;
find /home/${user}/public_html -name ‘.htaccess’ -exec sed -ie ‘s/php_flag/#php_flag/’ {} \;
done

Malware scanner installation




cd /usr/local/src
wget http://www.rfxn.com/downloads/maldetect-current.tar.gz
tar -xzvf maldetect-current.tar.gz
cd maldetect-*
sh install.sh