有同事反馈有个项目因为有人调整过底层镜像,导致服务无法启动,容器报错信息如下
2022-07-04 15:21:03,883 CRIT Server 'unix_http_server' running without any HTTP authentication checking
到网上搜这个报错信息,虽然没有帖子很明确的指出报错原因,但是基本上可以确定是和 supervisor 相关,
于是将 supervisor 源码下载下来后,用错误中的关键字进行搜索
git clone git@github.com:Supervisor/supervisor.git
cd supervisor
grep "authentication checking" -rn *
// 结果如下
docs/logging.rst:32: 2007-09-08 14:43:22,961 CRIT Running without any HTTP authentication checking
supervisor/http.py:855: 'authentication checking' % config['section'])
vim supervisor/http.py +855 查看代码如下
if username:
# wrap the xmlrpc handler and tailhandler in an authentication
# handler
users = {username:password}
xmlrpchandler = supervisor_auth_handler(users, xmlrpchandler)
tailhandler = supervisor_auth_handler(users, tailhandler)
maintailhandler = supervisor_auth_handler(users, maintailhandler)
uihandler = supervisor_auth_handler(users, uihandler)
defaulthandler = supervisor_auth_handler(users, defaulthandler)
else:
options.logger.critical(
'Server %r running without any HTTP '
'authentication checking' % config['section'])
可以发现如果没有用户名,就会报这里遇到的critical错误。
接下来 排查镜像dockerfile,找到supervisord.conf 配置文件,其中 unix_http_server 配置如下,
[unix_http_server]
file=/mnt/supervisor.sock ; the path to the socket file
;chmod=0700 ; socket file mode (default 0700)
;chown=nobody:nogroup ; socket file uid:gid owner
;username=user ; default is no username (open server)
;password=123 ; default is no password (open server)
发现用户名和密码都被注释掉了,于是让业务同学设定新的用户名和密码,通过挂载的方式覆盖老的配置,经测试服务可以正常启动。
查看 supervisor版本命令
supervisord -v
4.2.2