将Stunnel Error pop3s绑定到0.0.0.0:110

我正在设置stunnel,因此不支持SSL的应用程序可以访问Gmail / Google Apps帐户。 这里是我使用的configuration:

CLIENT=YES [pop3s] accept = 110 connect = pop.gmail.com:995 [imaps] accept = 143 connect = imap.gmail.com:993 [ssmtp] accept = 25 connect = smtp.gmail.com:465 

我已经生成了.pem文件,好的。 但它失败并logging下列错误:

 Clients allowed=125 stunnel 4.50 on x86_64-apple-darwin11.2.0 platform Compiled/running with OpenSSL 0.9.8r 8 Feb 2011 Threading:PTHREAD SSL:ENGINE Auth:none Sockets:SELECT,IPv6 Reading configuration from file ./tools/stunnel.conf Snagged 64 random bytes from /Users/synergist/.rnd Wrote 1024 new random bytes to /Users/synergist/.rnd PRNG seeded successfully Initializing SSL context for service pop3s Insecure file permissions on stunnel.pem Certificate: stunnel.pem Certificate loaded Key file: stunnel.pem Private key loaded SSL options set: 0x01000004 SSL context initialized Initializing SSL context for service imaps Insecure file permissions on stunnel.pem Certificate: stunnel.pem Certificate loaded Key file: stunnel.pem Private key loaded SSL options set: 0x01000004 SSL context initialized Initializing SSL context for service ssmtp Insecure file permissions on stunnel.pem Certificate: stunnel.pem Certificate loaded Key file: stunnel.pem Private key loaded SSL options set: 0x01000004 SSL context initialized Configuration successful Option SO_REUSEADDR set on accept socket Error binding pop3s to 0.0.0.0:110 bind: Permission denied (13) Service pop3s closed FD=5 str_stats: 168 block(s), 8340 data byte(s), 8400 control byte(s) 

为什么不能stunnel绑定到110? 有没有东西已经绑定到110,如果是的话,我怎么能找出这是什么?

更新:我有通过使用sudo运行stunnel,有没有办法使其运行没有?

正如您在更新中已经指出的那样,以下输出将告诉您:

 Error binding pop3s to 0.0.0.0:110 bind: Permission denied (13) 

您需要提升权限才能将服务绑定到端口。 从我的头开始,我认为非超级用户只能将服务绑定到1024以上的端口,0-1024被保留为超级用户。

至于你的问题,找出哪些服务正在监听一个端口的问题,你可以使用lsof来检查: lsof -i tcp:110 。 如果您的服务器上没有安装lsof,netstat也可以使用,但是效率netstat -an|grep -i listen (例如, netstat -an|grep -i listen显示所有“监听”进程,另外添加另一个grep ':110'来过滤。

你不能绑定到没有root权限的端口<= 1024,这是一个安全的事情。 如果你设置你的端口> 1024,你应该没问题。