[stunnel-users] Possible problem found in init script with 'dirty' config file

F. J. Blanco security.debian at gmail.com
Mon Aug 4 20:55:12 CEST 2014

   Hi there.

   Perhaps this is a foolishness, but it happens to me, triggering a
great headache.

   I'm Debian (Wheezy) user, using stunnel 4.53-1.1.

   I copied the stunnel configuration from another machine for a
simple LAN SMTP relay. When I tried to reload the script, I got this:

# /etc/init.d/stunnel4 start
> Reloading configuration SSL tunnels: /etc/init.d/stunnel4: 34: test: /var/lib/stunnel4/: unexpected operator

   A few hours laters, I discovered the problem was in config file, in
the chroot parameter:

chroot = /var/lib/stunnel4

   Specifically, with a hide space at the end of the line:

chroot = /var/lib/stunnel4[ ]

   In the init script, in the function get_pids(), this mistake caused
that this checkout fails:

if test -f $CHROOT/$PIDFILE; then
       cat $CHROOT/$PIDFILE

'cat /var/lib/stunnel4///stunnel.pid' is not the same as 'cat
/var/lib/stunnel4/[ ]//stunnel.pid'

   Perhaps a suggestion, a little change here:

CHROOT=`grep "^chroot" $file|sed "s;.*= *;;"`

   Adding a space filter:

CHROOT=`grep "^chroot" $file|sed "s;.*= *;;" | tr -d " "`


More information about the stunnel-users mailing list