Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 534428

Summary: net-misc/stunnel : openrc init.d scripts need intelligence to check if a pid file is created
Product: Gentoo Linux Reporter: csefko <csefko>
Component: Current packagesAssignee: Anthony Basile <blueness>
Status: RESOLVED INVALID    
Severity: normal    
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description csefko 2015-01-03 13:10:23 UTC
Hi,

I am having problems with starting stunnel via init script. It looks like it was started successfully, but pid file is not created (the same problem is for all versions 5.07 and 5.08 and 5.09):

# /etc/init.d/stunnel start
 * /run/stunnel: correcting mode
 * /run/stunnel: correcting owner
 * Starting stunnel ...                            [ ok ]
# /etc/init.d/stunnel status
 * status: crashed
# ps aux|grep stunnel
root     15902  0.0  0.0  27704   568 ?        Ss   20:09   0:00 /usr/bin/stunnel /etc/stunnel/stunnel.conf

Could you please look at it?

Thanks
Comment 1 Jeroen Roovers (RETIRED) gentoo-dev 2015-01-04 09:11:33 UTC
Why is it using /var/run for DEFAULT_PIDFILE instead of /run?
Comment 2 Anthony Basile gentoo-dev 2015-01-04 14:40:42 UTC
(In reply to Jeroen Roovers from comment #1)
> Why is it using /var/run for DEFAULT_PIDFILE instead of /run?

It is using /run/stunnel/stunnel.pid by defualt


(In reply to csefko from comment #0)
> /usr/bin/stunnel /etc/stunnel/stunnel.conf

This is a config file problem.  You need to specify a pidfile in there.  Add

pid = /run/stunnel/stunnel.pid


We shouldn't stop stabilization for this since its up to the user to get the config file right.  But, this is subtle enough that the user can legitimately say "how was I supposed to know that"?

I'm going to redo this for the next release of stunnel.  I'll give an example config file with this issue documented and I'll add intelligence to init.d script to alert the user to the problem in his/her config file.

@csefko, in the mean time. just add that line to your config.

Thanks for the report!
Comment 3 csefko 2015-01-04 22:58:40 UTC
Hi,

Thanks for looking into it. Meanwhile I figured it out too that I need to specify pid in /etc/stunnel/stunnel.pid.
Firstly I was just looking only into /etc/init.d/stunnel and there is an explicit usage of PID which confused me:
start-stop-daemon --start --pidfile "${PIDFILE}" ...
It looks like the code was created for multiple stunnel runs (like we have only one /etc/init.d/net.lo and symbolic link net.eth0->net.lo) when I look how PIDFILE is evaluated.
So I did something like this (which works fine):
cd /etc/init.d
ln -s stunnel stunnel.abc
ln -s stunnel stunnel.def
# /etc/stunnel/abc.conf
...
pid = /run/stunnel/abc.pid
...

# /etc/stunnel/def.conf
...
pid = /run/stunnel/def.pid
...

But you are right that user should be warn about it (because I spent few hours to figure it out).

Thanks again