AWG Blogs

Sunday, May 19, 2013

Installing Stunnel on CenOS 5

Download tar.gz file from
to ~/temp
gzip -dc stunnel-4.56.tar.gz | tar xvf -
cd stunnel-4.56
make install

vi /usr/local/etc/stunnel/stunnel.conf-sample
add the line
fips = no
change cert = line to read
cert = /usr/local/etc/stunnel/stunnel.pem
adjust service section, e.g. for forwarding smtp securely

cp /usr/local/etc/stunnel/stunnel.conf-sample /etc/stunnel/stunnel.conf
cp /etc/stunnel/stunnel.conf /usr/local/etc/stunnel/stunnel.conf
#this last one to satisfy stunnel from cmd line, the prior for the service
#perhaps should make them hard linked

cp /usr/local/share/doc/stunnel/examples/stunnel.init /etc/init.d/stunnel
cd /etc/init.d
chmod 755 stunnel

vi stunnel
modify top of file to read:
#! /bin/sh -e
# description: stunnel Start Stop Restart
# processname: stunnel
# chkconfig: 234 20 80

then in startdeamons() change the install line to read:
install -d -o nobody -g nobody /var/run/stunnel

save file
echo "ENABLED=1" > /etc/default/stunnel

Disable sendmail
chkconfig sendmail off; service sendmail stop

Enable stunnel
chkconfig --add stunnel
In case tests are running:
pkill stunnel 
service stunnel start