如何在zmq(本地套接字)中获取主叫方pid [英] How to get caller pid in zmq (local socket)

查看:109
本文介绍了如何在zmq(本地套接字)中获取主叫方pid的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是zmq的新手.我在基于Linux的操作系统中将其用于本地IPC(套接字为AF_UNIX类型) 但是我找不到获取调用方(客户端)进程ID的方法.有什么办法可以使用zmq找到相同的内容吗? (对于我的访问控制要求,必须找到调用者的pid,如果zmq没有提供该pid,则应该切换到dbus) 请帮助我.

Im new to zmq. Im using the same for local IPC in a Linux based OS (The socket is AF_UNIX type) But I could not find a way to get the caller's (client) process Id. Is there any way to find the same using zmq ? (Finding the pid of the caller is must for my access control requirement and if zmq does not provide the same then I should switch to dbus) Please help me.

推荐答案

省去了大多数底层套接字设计和烦恼.在天空中思考更高. ZeroMQ是一个相当高级的消息传递概念.因此,您将对大多数socket-io问题零担心.

Forget most of the low-level socket designs and worries. Think higher in the sky. ZeroMQ is a pretty higher-level messaging concept. So you will have zero-worries about most of the socket-io problems.

有关这些ZMQ原理的更多信息,请阅读Pieter Hintjens的设计格言和他的资源丰富的书"Code Connected,Vol.1".

For more on these ZMQ principles, read Pieter Hintjens' design maxims and his resources-rich book "Code Connected, Vol.1".

也就是说,解决方案完全由您控制.

创建特定于问题的multi-zmq-socket/multi-zmq-pattern(由应用程序级逻辑使用和编排的多个zmq-primitive)作为特定于问题的正式通信握手.

Create a problem-specific multi-zmq-socket / multi-zmq-pattern (multiple zmq-primitives used and orchestrated by your application level logic) as a problem-specific formal communication handshaking.

确保 <sender>将其自己的PID添加到消息中.

Ensure the <sender> adds it's own PID into message.

receiver侧通过另一个具有预先注册的sender的寄存器/auth-socket-pattern重新进行/授权,以避免在伪造/被盗的PID身份下进行欺骗攻击.

Re/authorise via another register/auth-socket-pattern with the pre-registered sender from the receiver side, so as to avoid a spoofed attack under a fake/stolen PID-identity.

根据您的ProblemDOMAIN调整访问控制策略,使用并实施任何级别的加密安全性正式握手协议进行身份验证或密钥交换,以将访问控制策略的安全性提高到足够的强度(包括MIL-性病等级).

Adapt your access-control policy according to your ProblemDOMAIN, use and implement any level of crypto-security formal handshaking protocols for identity-validation or key-exchange, to raise your access-control policy security to adequate strengths ( including MIL-STD grades ).

这篇关于如何在zmq(本地套接字)中获取主叫方pid的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆