I have kind of the same problem. I have modified the rc-script to include /etc/passwd and /etc/group on the line 242:
original:
...
for i in $STUNNEL_CONF /etc/{resolv.conf,host.conf,hosts,localtime,hosts.{allow,deny}}; do
...
changed to:
for i in $STUNNEL_CONF /etc/{passwd,group,resolv.conf,host.conf,hosts,localtime,hosts.{allow,deny}}; do
Now these files get copied to the chroot (/var/lib/stunnel/), but I still get the error message:
stunnel 4.21 on i686-pc-linux-gnu with OpenSSL 0.9.8g 19 Oct 2007
Threading:PTHREAD SSL:ENGINE Sockets:POLL,IPv6 Auth:LIBWRAP
500 clients allowed
Failed to get UID for user stunnel
warning: can't get client address: Bad file descriptor
After I have changed stunnel to 106 and nogroup to 65534 (UID and GID from passwd and group files), stunnel is running, but there are 6 instances of it, 1 running under user stunnel, 5 under the root user.
Here is some output:
home:~ # ps aux | grep stunnel
root 2474 0.0 0.0 2448 624 ? Ss Nov08 0:14 /sbin/syslog-ng -a /var/lib/named/dev/log -a /var/lib/stunnel/dev/log
root 13659 0.0 0.0 2116 668 pts/0 R+ 23:26 0:00 grep stunnel
home:~ # rcstunnel start
Starting stunnel (SSL tunnel) [chroot] done
home:~ # rcstunnel status
Checking for stunnel (SSL tunnel): unused
home:~ # ps aux | grep stunnel
root 2474 0.0 0.0 2448 624 ? Ss Nov08 0:14 /sbin/syslog-ng -a /var/lib/named/dev/log -a /var/lib/stunnel/dev/log
root 13680 0.0 0.0 3828 456 pts/0 S 23:26 0:00 /usr/sbin/stunnel
root 13681 0.0 0.0 3828 456 pts/0 S 23:26 0:00 /usr/sbin/stunnel
root 13682 0.0 0.0 3828 456 pts/0 S 23:26 0:00 /usr/sbin/stunnel
root 13683 0.0 0.0 3828 456 pts/0 S 23:26 0:00 /usr/sbin/stunnel
root 13684 0.0 0.0 3828 456 pts/0 S 23:26 0:00 /usr/sbin/stunnel
stunnel 13685 0.0 0.0 3828 888 ? Ss 23:26 0:00 /usr/sbin/stunnel
root 13697 0.0 0.0 2116 672 pts/0 S+ 23:26 0:00 grep stunnel
home:~ # rcstunnel stop
Shutting down stunnel (SSL tunnel) done
home:~ # ps aux | grep stunnel
root 2474 0.0 0.0 2448 624 ? Ss Nov08 0:14 /sbin/syslog-ng -a /var/lib/named/dev/log -a /var/lib/stunnel/dev/log
root 13680 0.0 0.0 3828 456 pts/0 S 23:26 0:00 /usr/sbin/stunnel
root 13681 0.0 0.0 3828 456 pts/0 S 23:26 0:00 /usr/sbin/stunnel
root 13682 0.0 0.0 3828 456 pts/0 S 23:26 0:00 /usr/sbin/stunnel
root 13683 0.0 0.0 3828 456 pts/0 S 23:26 0:00 /usr/sbin/stunnel
root 13684 0.0 0.0 3828 456 pts/0 S 23:26 0:00 /usr/sbin/stunnel
stunnel 13685 0.0 0.0 3828 888 ? Ss 23:26 0:00 /usr/sbin/stunnel
root 13709 0.0 0.0 2116 668 pts/0 S+ 23:26 0:00 grep stunnel
The PID-file is created in the chroot and has the PID of the process running under the user stunnel. When trying to stop the process (rcstunnel stop), none of the processes is stopped (as you can see above).
Odd is, that I have the same configuration and rc-script on two machines, the difference is in the stunnel version and openSUSE release:
stunnel @ my voobook, openSUSE 10.3:
voobook:~ # stunnel -version
stunnel 4.16 on x86_64-suse-linux-gnu with OpenSSL 0.9.8e 23 Feb 2007
Threading:PTHREAD SSL:ENGINE Sockets:POLL,IPv4 Auth:LIBWRAP
Global options
debug = 5
pid = /usr/var/run/stunnel/stunnel.pid
RNDbytes = 64
RNDfile = /dev/urandom
RNDoverwrite = yes
Service-level options
cert = /etc/stunnel/stunnel.pem
ciphers = AES:CAMELLIA:ALL:!ADH:+RC4:@STRENGTH
key = /etc/stunnel/stunnel.pem
session = 300 seconds
sslVersion = SSLv3 for client, all for server
TIMEOUTbusy = 300 seconds
TIMEOUTclose = 60 seconds
TIMEOUTconnect = 10 seconds
TIMEOUTidle = 43200 seconds
verify = none
stunnel @ my home, openSUSE 11.0:
home:~ # stunnel -version
stunnel 4.21 on i686-pc-linux-gnu with OpenSSL 0.9.8g 19 Oct 2007
Threading:PTHREAD SSL:ENGINE Sockets:POLL,IPv6 Auth:LIBWRAP
Global options
debug = 5
pid = /usr/var/run/stunnel/stunnel.pid
RNDbytes = 64
RNDfile = /dev/urandom
RNDoverwrite = yes
Service-level options
cert = /etc/stunnel/stunnel.pem
ciphers = AES:ALL:!aNULL:!eNULL:+RC4:@STRENGTH
key = /etc/stunnel/stunnel.pem
session = 300 seconds
sslVersion = SSLv3 for client, all for server
TIMEOUTbusy = 300 seconds
TIMEOUTclose = 60 seconds
TIMEOUTconnect = 10 seconds
TIMEOUTidle = 43200 seconds
verify = none
Even running stunnel without the chroot spawns 6 stunnel processes (on the home/OSS11.0), all with root user. In openSUSE 10.3 I have no issues (I neither had to create /var/lib/stunnel/var/run directory, the PID is stored in /var/run, nor to modify the rc-script to include passwd and group files).
Can somebody help me to have only one instance of stunnel running as user stunnel?
Thanks