Bug 455815 - stunnel lacks an init script
stunnel lacks an init script
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: stunnel (Show other bugs)
rawhide
All Linux
medium Severity high
: ---
: ---
Assigned To: Avesh Agarwal
Fedora Extras Quality Assurance
: FutureFeature, Reopened
: 455817 (view as bug list)
Depends On: 445053
Blocks:
  Show dependency treegraph
 
Reported: 2008-07-17 19:28 EDT by Chris Weyl
Modified: 2014-04-28 23:30 EDT (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of:
: 1103273 (view as bug list)
Environment:
Last Closed: 2014-04-28 23:30:09 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
an initscript proposal (at least as a basis for one) (1.10 KB, text/plain)
2008-11-30 21:14 EST, Thomas M Steenholdt
no flags Details

  None (edit)
Description Chris Weyl 2008-07-17 19:28:07 EDT
+++ This bug was initially created as a clone of Bug #445053 +++

stunnel lacks a sysv initscript as well as user creation we've come to expect
from system services.  (see, e.g., dnsmasq)
Comment 1 Miloslav Trmač 2008-07-17 19:38:16 EDT
*** Bug 455817 has been marked as a duplicate of this bug. ***
Comment 2 Thomas M Steenholdt 2008-11-30 21:14:10 EST
Created attachment 325164 [details]
an initscript proposal (at least as a basis for one)

I'm currently using this initscript on CentOS with stunnel chrooted in /var/run/stunnel/ (this affects the initscript, since stunnel creates it's pid file inside the chroot.
Comment 3 Miloslav Trmač 2008-12-03 11:38:48 EST
Thanks for the script.

Fedora scripts should follow https://fedoraproject.org/wiki/Packaging/SysVInitScript ; I can do that easily enough.

The package 

The principal issue is that there is no reasonable "default stunnel service".
For example, a system HTTP server should listen on port 80, which also implies there should be only only one instance of the server.

In the case of stunnel it is quite reasonable to provide many tunnels on a single system, and it is quite reasonable to run several instances of stunnel, each under its own user to make sure compromising one instance doesn't give access to private keys for other services.

I think the most reasonable way to handle several instances of stunnel (namely, a way that avoids the risk of an overengineered, yet very inflexible "general solution") is to let the system administrator set up the instances manually, something similar to http://cvs.fedoraproject.org/viewvc/devel/clamav/clamd-README?revision=1.3&view=markup .

If the system administrator is expected to set up instances manually, I'm not sure providing a single system-wide init script makes much sense; but perhaps we can provide a half-configured default setup that can be also used as a template for manually-created additional instances.  (Such a setup should definitely use a separate user, not "root".)
Comment 4 Thomas M Steenholdt 2008-12-03 12:19:11 EST
I think it makes perfect sense to provide an stunnel initscript (perhaps not configured to start by default after installation), a working chroot configuration and a basic /etc/stunnel/stunnel.conf file.

The default stunnel.conf could contain basic stuff like setuid = nobody, setgid = nobody, chroot, pid, logging setup and such, matching the layout of the package. The default conf, however, should not provide any actual tunnel configs (of course), but perhaps a few examples.
Comment 5 Chris Weyl 2008-12-03 15:30:12 EST
Exactly. Unfortunately, it doesn't look possible to have a /etc/stunnel/stunnel.conf.d (along the lines of what dnsmasq does), but even having a "null" default setup in there would save a lot of pain.
Comment 6 Bug Zapper 2009-06-09 22:07:11 EDT
This message is a reminder that Fedora 9 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 9.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '9'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 9's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 9 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping
Comment 7 Bug Zapper 2010-04-27 08:08:56 EDT
This message is a reminder that Fedora 11 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 11.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '11'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 11's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 11 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping
Comment 8 Bug Zapper 2010-07-30 06:32:26 EDT
This bug appears to have been reported against 'rawhide' during the Fedora 14 development cycle.
Changing version to '14'.

More information and reason for this action is here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping
Comment 9 Stefan Lasiewski 2010-11-01 18:20:30 EDT
The Stunnel RPM should include a startup script at /etc/init.d/stunnel . The script included with  stunnel-4.34.tar.gz seems to work fine, with a few minor modifications.

Here's what I did:

I am running stunnel-4.15-2.el5.1 on CentOS5. My experience should apply to Fedora as well.

See the source for stunnel-4.34.tar.gz at http://www.stunnel.org/download/source.html . The source will build an example init script at /usr/local/share/doc/stunnel/examples/stunnel.init .

I installed this to /etc/init.d/stunnel, set the 'DAEMON=' to point to /usr/sbin/stunnel , and modified the two following lines. 

# chkconfig: 2345 54 26
# description:          stunnel 

This init script is very generic, and seems to work fine with different stunnel styles at /etc/stunnel/ .
Comment 10 Fedora End Of Life 2012-08-16 12:44:20 EDT
This message is a notice that Fedora 14 is now at end of life. Fedora 
has stopped maintaining and issuing updates for Fedora 14. It is 
Fedora's policy to close all bug reports from releases that are no 
longer maintained.  At this time, all open bugs with a Fedora 'version'
of '14' have been closed as WONTFIX.

(Please note: Our normal process is to give advanced warning of this 
occurring, but we forgot to do that. A thousand apologies.)

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, feel free to reopen 
this bug and simply change the 'version' to a later Fedora version.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we were unable to fix it before Fedora 14 reached end of life. If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora, you are encouraged to click on 
"Clone This Bug" (top right of this page) and open it against that 
version of Fedora.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping
Comment 11 Lars Kellogg-Stedman 2012-09-26 15:26:07 EDT
Can we reopen this?  With Systemd now the standard in F17 and beyond, there's no reason that stunnel can't have a multi-instance systemd service configuration (like getty@.service).
Comment 12 Nicolas Mailhot 2013-05-11 09:13:02 EDT
The lack of automated init is annoying, I need stunnel to get postfix talking to smtps servers (that don't do tls)

Proposed implementation:

1. rename /etc/stunnel to /etc/stunnel.d (for consistency)

2. add to preinstall
/usr/sbin/groupadd -f -r stunnel || :
/usr/bin/id stunnel >/dev/null 2>&1 || \
/usr/sbin/useradd -r -c 'Stunnel daemon' -s /sbin/nologin -d /var/run/stunnel -g stunnel stunnel || :

(the homedir won't be used and is not created like for pulseaudio)

3. add a /usr/lib/systemd/system/stunnel@.service file containing

[Unit]
Description = stunnel (%i) instance
After = syslog.target nss-lookup.target network.target 
# stunnel is commonly used by postfix
# http://www.postfix.org/TLS_README.html#client_smtps
Before = postfix.service

[Service]
Type = simple
ExecStart = /usr/bin/stunnel /etc/stunnel.d/%i.conf
User=stunnel
Restart = on-failure
PrivateTmp = true

[Install]
WantedBy=multi-user.target

4. Add an readme.fedora file in /etc/stunnel.d/ containing

# This is an example file - do not modify it, create new foo.conf files in
# /etc/stunnel.d/ and then use stunnel@foo.service

CApath = /etc/pki/ca-trust/extracted/pem
CAfile = /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem
foreground = yes
syslog = yes
pid =

#Disable FIPS mode to allow non-approved protocols and algorithms
fips = no
#debug = 7

[smtp-tls-wrapper]
  accept = 127.0.0.1:11125
  client = yes
  connect = smtp.example.com:smtps
  verify = 2

5. get upstream to fix foreground = yes syslog = yes so syslog is actually used in this mode
Comment 13 Avesh Agarwal 2014-04-28 23:30:09 EDT
stunnel has been integrated with systemd, and the stunnel service file has been packaged in rawhide. If the issue persists, please reopen this bz.

Note You need to log in before you can comment on or make changes to this bug.