我在Red Hat Linux 6.8上安装了一个Stunnel 4.29,它不会启动并发出'No such file or directory'错误:
# /usr/bin/stunnel /etc/stunnel/agent/dynatrace-agent.conf 2017.05.03 19:04:26 LOG7[3880:140667243153344]: Snagged 64 random bytes from /root/.rnd 2017.05.03 19:04:26 LOG7[3880:140667243153344]: Wrote 1024 new random bytes to /root/.rnd 2017.05.03 19:04:26 LOG7[3880:140667243153344]: RAND_status claims sufficient entropy for the PRNG 2017.05.03 19:04:26 LOG7[3880:140667243153344]: PRNG seeded successfully 2017.05.03 19:04:26 LOG3[3880:140667243153344]: nil: No such file or directory (2)
使用strace我看到一个可疑的企图统计文件'零':
# strace -e trace=stat -f /usr/bin/stunnel /etc/stunnel/agent/dynatrace-agent.conf stat("/root/.rnd", {st_mode=S_IFREG|0600, st_size=1024, ...}) = 0 stat("/root/.rnd", {st_mode=S_IFREG|0600, st_size=1024, ...}) = 0 stat("/root/.rnd", {st_mode=S_IFREG|0600, st_size=1024, ...}) = 0 stat("nil", 0x7ffe119643d0) = -1 ENOENT (No such file or directory) 2017.05.03 19:11:30 LOG7[3916:140189915436992]: Snagged 64 random bytes from /root/.rnd 2017.05.03 19:11:30 LOG7[3916:140189915436992]: Wrote 1024 new random bytes to /root/.rnd 2017.05.03 19:11:30 LOG7[3916:140189915436992]: RAND_status claims sufficient entropy for the PRNG 2017.05.03 19:11:30 LOG7[3916:140189915436992]: PRNG seeded successfully 2017.05.03 19:11:30 LOG3[3916:140189915436992]: nil: No such file or directory (2) +++ exited with 1 +++
我也看到尝试连接到一个套接字失败:
# strace -e trace=connect -f /usr/bin/stunnel /etc/stunnel/agent/dynatrace-agent.conf connect(4, {sa_family=AF_LOCAL, sun_path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory) connect(4, {sa_family=AF_LOCAL, sun_path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory) connect(4, {sa_family=AF_LOCAL, sun_path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory) connect(4, {sa_family=AF_LOCAL, sun_path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory) connect(4, {sa_family=AF_LOCAL, sun_path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory) connect(4, {sa_family=AF_LOCAL, sun_path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory) 2017.05.03 19:12:54 LOG7[3928:139643326924736]: Snagged 64 random bytes from /root/.rnd 2017.05.03 19:12:54 LOG7[3928:139643326924736]: Wrote 1024 new random bytes to /root/.rnd 2017.05.03 19:12:54 LOG7[3928:139643326924736]: RAND_status claims sufficient entropy for the PRNG 2017.05.03 19:12:54 LOG7[3928:139643326924736]: PRNG seeded successfully 2017.05.03 19:12:54 LOG3[3928:139643326924736]: nil: No such file or directory (2) +++ exited with 1 +++
这是我的configuration文件:
# cat /etc/stunnel/agent/dynatrace-agent.conf ; This stunnel config is managed by Puppet. cert = nil key = nil CAfile = nil CRLfile = nil sslVersion = TLSv1 verify = 2 chroot = /var/lib/stunnel/dynatrace-agent setuid = dtagent setgid = dtagent pid = dynatrace-agent.pid socket = l:TCP_NODELAY=1 socket = r:TCP_NODELAY=1 debug = 7 output = /var/log/dynatrace-agent.log client = yes [dynatrace-agent] accept = localhost:9998 connect = xxxx:7443
版本信息:
# stunnel -version stunnel 4.29 on x86_64-redhat-linux-gnu with OpenSSL 1.0.1e-fips 11 Feb 2013 Threading:PTHREAD SSL:ENGINE,FIPS Sockets:POLL,IPv6 Auth:LIBWRAP Global options debug = 5 pid = /var/run/stunnel.pid RNDbytes = 64 RNDfile = /dev/urandom RNDoverwrite = yes Service-level options cert = /etc/stunnel/stunnel.pem ciphers = ALL:!aNULL:!eNULL:!SSLv2:!EXPORT:!RC2:!DES curve = prime256v1 key = /etc/stunnel/stunnel.pem session = 300 seconds stack = 65536 bytes sslVersion = all TIMEOUTbusy = 300 seconds TIMEOUTclose = 60 seconds TIMEOUTconnect = 10 seconds TIMEOUTidle = 43200 seconds verify = none
令人困惑的错误信息nil: No such file or directory (2)实际上nil: No such file or directory (2)因为我们使用的Puppet模块是将stringcert = nil等放置在configuration文件中,这不是有效的stunnelconfiguration。 我提出了一个pull请求来修复Puppet模块。