如何通过 xmlrpc 安全地获得对supervisord 的编程访问?

发布于 2024-12-11 09:45:22 字数 1150 浏览 0 评论 0原文

我需要能够以编程方式管理主管设置。此外,系统上的任何用户都不应能够访问 Supervisord 的配置。因此,需要以某种方式确保通信的安全。

我知道 Supervisord 以 XML-RPC 的形式提供编程访问。我阅读了文档并尝试以多种方式使用它,但我不断遇到问题。

  1. 简介页面上,文档建议为 XML- RPC接口并使用Python标准库xmlrpclib与之通信。这里有两个问题:

    • supervisord.conf 的 inet_http_server 指令仅包含用户名、密码和端口作为设置。没有加密连接的选项。
    • xmlrpclib 甚至不支持用户名和密码。当我使用语法用户名:密码@主机:端口时,我收到IOError:不支持的XML-RPC协议。正如您在文档页面的示例中看到的,没有进行身份验证。
  2. 由于 UNIX 套接字是安全的,我认为使用 xmlrpclib 连接到 [unix_http_server] 是一个好主意。不过,我不知道身份验证如何工作,而且,xmlrpclib 仅支持网络 HTTP/HTTPS 服务器。

  3. 文档中的另一页提到了一个 supervisor.rpcinterface 模块。不过,我无法在 Python 中访问这样的东西。为了收集更多关于原因的信息,我使用 Pip 重新安装了supervisord。 sudo pip install --upgradesupervisor。在 pip 输出中,我看到行正在跳过 /usr/local/lib/python2.6/dist-packages/supervisor/__init__.py (namespace package) 的安装。我不知道为什么它会跳过命名空间包的安装。

我应该如何以编程方式安全地与supervisord进行通信?

I need to be able to manage the supervisord setup programmatically. Furthermore, not any user on the system should be able to to gain access to configuration of supervisord. For this reason, communication needs to be secured somehow.

I know that supervisord offers programmatic access in the form of XML-RPC. I read the documentation and attempted to work with it in several ways, but I keep running into problems.

  1. On the Introduction page, the documentation recommends running an HTTP server for the XML-RPC interface and using the Python standard library xmlrpclib to communicate with it. There are two problems here:

    • The inet_http_server directive for supervisord.conf only includes username, password, and port as settings. There is no option to encrypt the connection.
    • xmlrpclib doesn't even support usernames and passwords. When I use the syntax username:password@host:port, I get IOError: unsupported XML-RPC protocol. As you can see in the example on the documentation page, no authentication occurs.
  2. Since UNIX sockets are secure, I figured that connecting to the [unix_http_server] with xmlrpclib would be a good idea. Still, I don't know how authentication would work, and furthermore, xmlrpclib only supports network HTTP/HTTPS servers.

  3. Another page in the documentation mentions a supervisor.rpcinterface module. I have no access to such a thing in Python, though. To glean more information as to why that is, I re-installed supervisord with Pip. sudo pip install --upgrade supervisor. In the pip output, I see the line Skipping installation of /usr/local/lib/python2.6/dist-packages/supervisor/__init__.py (namespace package). I don't know why it would skip installation of the namespace package.

How am I supposed to communicate programmatically and securely with supervisord?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

盛夏已如深秋| 2024-12-18 09:45:22

Supervisor 支持在 Unix 域套接字上设置权限的选项。

http://supervisord.org/configuration.html#unix-http-server -section-example

我不知道详细信息,但您应该能够像supervisorctl.py 一样通过UNIX 域套接字调用xmlrpc 接口。它调用 options.getServerProxy() 来获取 xmlrpclib.ServerProxy 对象。

https://github.com/Supervisor/supervisor/blob/master /supervisor/supervisorctl.py#L188

Supervisor supports options to set permissions on the Unix domain socket.

http://supervisord.org/configuration.html#unix-http-server-section-example

I don't know the details but you should be able to call the xmlrpc interface over UNIX domain socket the same way that supervisorctl.py does. It's calling options.getServerProxy() to get an xmlrpclib.ServerProxy object.

https://github.com/Supervisor/supervisor/blob/master/supervisor/supervisorctl.py#L188

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文