Monday, March 22, 2010

How to configure IPSEC on linux

Scientific Linux or fedora/RHEL comes with ipsec-tools.
Host-to host config:
configure ifcfg-ipsec[number] on both machine
DST=X.X.X.X
TYPE=IPSEC
ONBOOT=yes
IKE_METHOD=PSK

Configure keys-ipsec[number]
IKE_PSK=secretkey

use setkey -f [filename] to set policy

use ifup ipsec[number] to start encryption.

use command tcpdump -n -i host [IPaddress of other machine] to find out whether encryption is taking place or not.



Wednesday, March 10, 2010

How to start service in LINUX on startup

To start a service in Linux on startup there are two methods.

i) if it is standard service and has a script in /etc/init.d just check its status

chkconfig --list service name

if is off

make it on by the following commands

chkconfig service name on

Similarly you can make a service off by following command

chkconfig service name off

other way write a script put it in /etc/init.d

add run following command

chkconfig --add service name
chkconfig service name on

simlarly you can remove a service for the list

chkconfig --del service name

ii) put the startup code in rc.local file.

Monday, January 25, 2010

To Store file in postgres database

There are two methods to store a file in database.

1. use either bytea type of database (Stores file as bytestream <1 GB)

2. use large objects type ( stores file in separate table referenced by integer OID)


for more information see the following links

http://www.postgresql.org/docs/7.4/interactive/jdbc-binary-data.html#JDBC-BINARY-DATA-EXAMPLE