将 RPC 功能添加到 Bernstein 的 Daemontools

发布于 2024-11-14 01:23:05 字数 515 浏览 0 评论 0原文

我是一名来自意大利的计算机科学专业的学生,​​我必须做一个基于 DJ Bernstein 的 Daemontools 的修改版本的项目,该项目必须在 Unix 下实现远程过程调用。

通常,要使用工具启动守护程序,我会使用以下语法:

svc -u /service/NameOfDaemon

并使用以下语法:

svc -d /service/NameOfDaemon

这样我就可以在本地控制守护程序。这个想法是添加一个代码块,以便能够控制位于远程计算机上的守护程序,这将是理想的语法:

svc -u IP/service/NameOfDaemon

其中 IP 代表用户已知的目标计算机的实际 IP。

这些天我在谷歌上搜索并了解了 RPC 和 DTools,但我有点卡住了,有人可以帮助我开始吗?

也许还有一些适合我的项目的推荐读物?

I'm a Computer Science student from Italy, I have to do a project based on a modified version of the Daemontools Of D.J. Bernstein which has to implement remote procedure calls under Unix.

Normally to get a daemon up with the tools I use this syntax:

svc -u /service/NameOfDaemon

And down with this:

svc -d /service/NameOfDaemon

So I can control a daemon locally. The idea is to add a block of code to be able to control a daemon situated on a remote machine, this will be the ideal syntax:

svc -u IP/service/NameOfDaemon

where IP stands for the actual IP of the target machine, known by the user.

In these days I googled and learned about RPC and DTools but I am a bit stuck, can anyone help me get started?

Perhaps also some recommended reading for my project?

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

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

发布评论

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

评论(2

沧桑㈠ 2024-11-21 01:23:05

Unix 的方式是说:

ssh -n root@remotehost svc -u /service/NameOfDaemon

unix 哲学 是关于创建能够很好地完成一件事并与其他工具协同工作的小工具。 svc 是一个可以控制本地机器上守护进程的工具。 ssh 可以在远程计算机上运行工具。不需要其他工具。

如果您绝对必须有一个可以控制本地和远程守护进程的命令,那么正如 Chris 建议的那样,您可以编写一个根据需要运行 svcssh 的 shell 脚本。

The unix way of doing this is to say:

ssh -n root@remotehost svc -u /service/NameOfDaemon

The unix philosophy is about creating small tools which do one thing well, and work together with other tools. svc is a tool which can control daemons on the local machine. ssh can run tools on remote machines. There is no need for another tool.

If you absolutely must have a single command which can control both local and remote daemons, then as Chris suggests, you can write a shell script which runs svc or ssh as needed.

上课铃就是安魂曲 2024-11-21 01:23:05

supervise 使用 Unix 域套接字来接收请求。使用 Unix 域套接字的优点是可以通过通常的文件系统权限来控制对它的访问——在这种情况下,它只允许 root 访问套接字,因此通常必须运行 svc< /code> 作为 root。

然而,一旦您通过网络,您就开始必须考虑网络身份验证(除非您希望任何汤姆、迪克和哈利启动和停止您的服务)。如果您能解决这个问题,那么剩下的事情就很简单:

  • 编写一个在 tcpserver 上运行的服务,它可以为您调用远程计算机上的 svc。如果 tcpserver 提供的访问控制足以满足您的需要,那么很好;否则你的服务必须处理剩下的事情。
    • 为了安全起见,请勿以 root 身份运行此服务(即始终在 tcpserver 命令行上指定 -u)。相反,只需更改supervise套接字的(组)所有权,以便运行服务的用户可以读取和写入它们。
  • 在客户端编写一个封装 svc 的 shell 脚本。它检查“远程服务器”语法,如果使用,它将连接到您的远程服务(否则只需像往常一样调用 svc)。

supervise uses Unix-domain sockets to receive requests. The advantage of using Unix-domain sockets is that access to it can be controlled via the usual filesystem permissions---in this case, it allows only root to access the socket, hence the reason why you normally must run svc as root.

However, once you go over the network, you start having to think about network authentication (unless you want any Tom, Dick, and Harry to start and stop your services). If you can solve that, the rest of it is easy:

  • Write a service that runs over tcpserver, that can invoke svc on the remote machine for you. If the access control provided by tcpserver is sufficient for you, then well and good; otherwise your service must handle what's left.
    • To be secure, don't run this service as root (i.e., always specify -u on the tcpserver command line). Instead, just change the (group) ownership of your supervise sockets so that they are readable and writeable by the user that your service runs as.
  • Write a shell script on the client side that wraps around svc. It checks for the "remote server" syntax and if used, it would connect to your remote service (and otherwise just invoke svc as usual).
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文