Bug#924312: stunnel4: Fails to stop with sysvinit: start-stop-daemon: matching only on non-root pidfile /var/lib/stunnel4///stunnel4.pid is insecure

Axel Beckert <[email protected]> Mon, 11 Mar 2019 21:28:04 +0100
Newsgroups gmane.linux.debian.devel.bugs.rc,gmane.linux.debian.devel.lsb
Organization The Debian Project
Message-ID <[email protected]>
--xjyYRNSh/RebjC6o
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Control: reassign -1 lsb-base
Control: forcemerge 921558 -1
Control: affects 921558 + stunnel4

Hi Paul,

Paul Gevers wrote:
> On Mon, 11 Mar 2019 14:15:25 +0100 Axel Beckert <[email protected]> wrote:
> > Version: 3:5.50-3
>=20
> ^^^^^^^^^^^^^^^^^^^
> I don't think the bug is only in this version, is it?

No. But for a reason I did not expect:

In contrary to the other cases of this issue I run into recently
(miredo and smokeping), stunnel4's init script doesn't use
start-stop-daemon directly but via killproc() from
/lib/lsb/init-functions of lsb-base. And the actual bug seems to be in
that shell script library:

    125 # start-stop-daemon uses the same algorithm as "pidofproc" above.
    126 killproc () {
    127     local pidfile sig status base name_param is_term_sig OPTIND
    128     pidfile=3D
    129     name_param=3D
    130     is_term_sig=3D
    131=20
    132     OPTIND=3D1
    133     while getopts p: opt ; do
    134         case "$opt" in
    135             p)  pidfile=3D"$OPTARG";;
    136         esac
    137     done
    138     shift $(($OPTIND - 1))
    139=20
    140     base=3D${1##*/}
    141     if [ ! $pidfile ]; then
    142         name_param=3D"--name $base --pidfile /var/run/$base.pid"
    143     else
    144         name_param=3D"--pidfile $pidfile"
    145     fi
    [=E2=80=A6]     [=E2=80=A6]
    152     status=3D0
    153     if [ ! "$is_term_sig" ]; then
    154         if [ -n "$sig" ]; then
    155             /sbin/start-stop-daemon --stop --signal "$sig" \
    156                 --quiet $name_param || status=3D"$?"
    157         else
    158             /sbin/start-stop-daemon --stop \
    159                 --retry 5 \
    160                 --quiet $name_param || status=3D"$?"
    161         fi
    162     else
    163         /sbin/start-stop-daemon --stop --quiet \
    164             --oknodo $name_param || status=3D"$?"
    165     fi

Since neither name_param nor any of the start-stop-daemon --stop calls
contain --exec or -x nor does killproc allow to pass additional
parameters, this looks like a bug in lsb-base. And indeed, it is and
is also already reported: https://bugs.debian.org/921558

Reassigning accordingly.

> This bug is currently blocking the migration of stunnel4 to testing
> which is needed to have openssl migrate. I'd like to do that today
> because tomorrow the full freeze starts.

Should be solved now. Thanks for poking me so that I had a closer
look!

		Regards, Axel
--=20
 ,''`.  |  Axel Beckert <[email protected]>, https://people.debian.org/~abe/
: :' :  |  Debian Developer, ftp.ch.debian.org Admin
`. `'   |  4096R: 2517 B724 C5F6 CA99 5329  6E61 2FF9 CD59 6126 16B5
  `-    |  1024D: F067 EA27 26B9 C3FC 1486  202E C09E 1D89 9593 0EDE

--xjyYRNSh/RebjC6o
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: Digital signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iQIcBAEBCAAGBQJchsTSAAoJEGvmY8daNcl1XHEP/2qRjBLV3sya+748hkH+ClV/
EyoFYg/fPCkQga4kmtWKDb5RyYLsSzLLxF+f1MINtOf167zF8JI/n+8oq96iLNTg
tQqxojRB1BSXmHqLYVeyj2NCXHC8C499D8Xvr/DcM6SZMsXa9enaPoNxy3AHTH/5
5uUkbpM/81Ff0COmRU6tKWCF6zYx9yZbEJhhF5Rl5rhoJsJeimdlNHlZAw3/zpgn
xYDC+6XK7XtFEk0GSHC51A+iHsl51XB8G1O1EFHIwpvLjcET8ZY4G6LCQJW2srrX
rDuoCxFKBDKd8r0sE/NiP9aZOmPDU4/kcrhhXxEgJl4ZsZdMRrMoQI4Z4w/7LkCm
xgk+cSHg8IcRvt8FEVBa9afPcPegWLDnntHMle/q/knZ4a82W1kkBxQtTan2whqY
dPzt+FUAYW/qtjBKXJHYzI8bTbgNqff9IFd7YOGOiKkaIR8wcLqf3LIfXRsXWQ6o
C4sZa1+EZ7wqtz3DtmCTnbDuP7sjJ2tCq0tD9mLMy1/BisgkpWASiUJ0dLh25PIv
jSNyTbqheniLRqmQNRVvIT9T3SZs/7rwsUwmP8BjSFn0z4xDkrVy8r2GKfYA8ZHY
VRYgvf2F4xv8ZtGSVmOmv/oiBsxL4O7hEN5IMtnEIR2qXcapCMmOjwiEqyIPhWM8
HzgrDgIFzWE8TG2Uo0mD
=jY1d
-----END PGP SIGNATURE-----

--xjyYRNSh/RebjC6o--