Finding out versions of java, apache , php and mysql

June 26, 2009 by devenix

Hi,

Use the following to find out the version info

java -version
java version “1.6.0_03″
Java(TM) SE Runtime Environment (build 1.6.0_03-b05)
Java HotSpot(TM) Server VM (build 1.6.0_03-b05, mixed mode)

php -v
PHP 4.3.9 (cgi) (built: Apr 17 2009 19:13:06)
Copyright (c) 1997-2004 The PHP Group

mysql -V
mysql  Ver 14.7 Distrib 4.1.22, for redhat-linux-gnu (i686) using readline 4.3

httpd -v
Server version: Apache/2.0.52

Hope this will  help you to determine the versions of the softwares.

Running a syntax check on /etc/my.cnf

June 3, 2009 by devenix

To verify the my.cnf parameter changes

/usr/libexec/mysqld –help –verbose

Thoughts by Swamy Vivekananda

March 16, 2009 by devenix

When I Asked God for Strength
He Gave Me Difficult Situations to Face

When I Asked God for Brain & Brown
He Gave Me Puzzles in Life to Solve

When I Asked God for Happiness
He Showed Me Some Unhappy People

When I Asked God for Wealth
He Showed Me How to Work Hard

When I Asked God for Favors
He Showed Me Opportunities to Work Hard

When I Asked God for Peace
He Showed Me How to Help Others

God Gave Me Nothing I Wanted
He Gave Me Everything I Needed

The Benefits Of Chandrayaan-1 Mission

November 17, 2008 by devenix

ISRO expressed that Chandrayaan-1 is not an expensive mission and in fact this moon odyssey will help the nation to update the technological expertise in order to explore the outer space and finally setting up a base on the earth’s natural satellite.

S Satish, ISRO spokesperson, while contradicting the critics, who wanted an answer behind the need to spend money for a mission to explore the moon, when many other countries have already done it, said, “Moon mission cost is less than Rs 400 crore, which is just ten per cent of annual budget of ISRO spread over many years.”

The cost of Chandrayaan-1 which has been scheduled to be launched on 22nd October is nearly Rs 386 crore, which includes Rs 100 crore for the establishment of Indian Deep Space Network (IDSN) at Byalalu. This will help to perform the task of getting the radio signals transmitted by future satellites, not just Chandrayaan-1. This mission is also India’s first unmanned lunar mission. The officials of ISRO feel that those who are against this mission are actually not fully aware with the facts related to the mission.

Satish clarified, “For example, previous moon missions have been undertaken by individual countries and it’s no secret that expertise of that nature is not shared. So, India had to do it by itself lest it would lose out in the race for the Moon.”

This mission will also help ISRO to better its technological expertise to a great level.

An ISRO official said, “There is also the pride factor. With China forging ahead in the space field, India cannot lag behind and miss the bus. Moreover, some kind of colonization of Moon cannot be ruled out in the coming decades. We have to have our presence.”

postfix error RCPT from unknown[some ip address] host rejected

October 16, 2008 by devenix

Hi,

Some times we see some messages to be rejected by postfix with erro RCPT from unknown

Solution.
RCPT from
unknown[some ip address]: 550 Client host rejected: cannot find your hostname

if you do

dig -x your ip +short

you will get some hostname as the dig output. (reverse dns)

Reverse DNS of your ip exists and points to some hostname, unfortunately the same host name does not exist in forward dns file. That is the reason why Postfix regards your host as “unknown”.

Don’t use reject_unknown_client in your postfix configuration. It may reject the valid mails also.

This message is looping: it already has my Delivered-To line. (#5.4.6)

August 1, 2008 by devenix

DESC:

 When I send a message now to a user on my server from an outside account.
 I am getting this from qmail.

OBSERVATION:

 You are probably forwarding mail to yourself.

SOLUTION:

 Check your /var/qmail/control/smtproutes file to make sure you are not
 sending mail to a relay which is sending back to you, and also look at
 your forwarding files, .qmail, .qmail-default etc.

5.1.2 – Bad destination host ‘DNS Malformed Query Error looking up domain.com. (MX)

July 14, 2008 by devenix

Resolution

Remove the trailing character from the recipient’s email address in the Address Book or in the To field.

example :

if ur sending to abc@example.com , you may be mistakenly using email address as abc@example.com. , a trailing dot can make this error to happen.

DNS request and IPtables config

July 9, 2008 by devenix

Allow incoming DNS request at port 53

Use following rules only if you are protecting dedicated DNS server.

SERVER_IP is IP address where BIND(named) is listing on port 53 for incoming DNS queries.

Please note that here I’m not allowing TCP protocol as I don’t have secondary DNS server to do zone transfer.

SERVER_IP=”123.108.230.184″

iptables -A INPUT -p udp -s 0/0 –sport 1024:65535 -d $SERVER_IP –dport 53 -m state –state NEW,ESTABLISHED -j ACCEPT
iptables -A OUTPUT -p udp -s $SERVER_IP –sport 53 -d 0/0 –dport 1024:65535 -m state –state ESTABLISHED -j ACCEPT
iptables -A INPUT -p udp -s 0/0 –sport 53 -d $SERVER_IP –dport 53 -m state –state NEW,ESTABLISHED -j ACCEPT
iptables -A OUTPUT -p udp -s $SERVER_IP –sport 53 -d 0/0 –dport 53 -m state –state ESTABLISHED -j ACCEPT

Hope it is easy to write iptables rule for a dns server

LWP failed with code[400] message[FTP return code 150]

July 1, 2008 by devenix

Hi ,

M back,

while installing the cpan modules for perl , i was getting the above error.

so following below solution worked out for it.

Use the cpan command-line tool. This can also be invoked via the command

perl -MCPAN -e shell

In the shell, type

install <packagename>

where <packagename> is something like Time::HiRes or Tk.

If it hangs for ages whilst trying to download files over FTP, or get errors like

LWP failed with code[400] message[FTP return code 150]

then try setting the FTP_PASSIVE environment variable before running cpan:

export FTP_PASSIVE=1

Simple firewall in linux

June 26, 2008 by devenix

Just try this.

To use it:

  1. Create a file named /etc/init.d/firewall
  2. Copy and paste the script into it and save
  3. Edit the ALLOWED variable with port numbers you want to allow, default is ports 22 (SSH) and 80 (HTTP)
  4. Execute:
    touch /usr/local/etc/whitelist.txt && touch /usr/local/etc/blacklist.txt
  5. Edit the whitelist/blacklist files if you want
  6. Execute:
    chmod 755 /etc/init.d/firewall
  7. Execute:
    chkconfig --add firewall && chkconfig firewall on

The script:

#!/bin/bash
# chkconfig: 345 30 99
# description: Starts and stops iptables based firewall

## List Locations
#

WHITELIST=/usr/local/etc/whitelist.txt
BLACKLIST=/usr/local/etc/blacklist.txt

#
## Specify ports you wish to use.
#

ALLOWED="22 80 25"

#
## Specify where IP Tables is located
#

IPTABLES=/sbin/iptables

##
#DO NOT EDIT BELOW THIS LINE
###
RETVAL=0

# To start the firewall
start() {
  echo "Setting up firewall rules..."

	echo 'Allowing Localhost'
	#Allow localhost.
	$IPTABLES -A INPUT -t filter -s 127.0.0.1 -j ACCEPT

	#
	## Whitelist
	#

	for x in `grep -v ^# $WHITELIST | awk '{print $1}'`; do
	        echo "Permitting $x..."
	        $IPTABLES -A INPUT -t filter -s $x -j ACCEPT
	done

	#
	## Blacklist
	#

	for x in `grep -v ^# $BLACKLIST | awk '{print $1}'`; do
	        echo "Denying $x..."
	        $IPTABLES -A INPUT -t filter -s $x -j DROP
	done

	#
	## Permitted Ports
	#

	for port in $ALLOWED; do
	        echo "Accepting port TCP $port..."
	        $IPTABLES -A INPUT -t filter -p tcp --dport $port -j ACCEPT
	done

	for port in $ALLOWED; do
	        echo "Accepting port UDP $port..."
	        $IPTABLES -A INPUT -t filter -p udp --dport $port -j ACCEPT
	done

	$IPTABLES -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
	$IPTABLES -A INPUT -p udp -j DROP
	$IPTABLES -A INPUT -p tcp --syn -j DROP

  RETVAL=0
}

# To stop the firewall
stop() {
  echo "Removing all iptables rules..."
  /sbin/iptables -F
  /sbin/iptables -X
  /sbin/iptables -Z
  RETVAL=0
}

case $1 in
  start)
		stop
    start
    ;;
  stop)
    stop
    ;;
  restart)
    stop
    start
    ;;
  status)
    /sbin/iptables -L
    /sbin/iptables -t nat -L
    RETVAL=0
    ;;
  *)
    echo "Usage: firewall {start|stop|restart|status}"
    RETVAL=1
esac

exit $RETVAL