unix 域套接字 - 保护接收器
unix domain socket - securing receiver
我正在研究一个关于 unix 域套接字的 tutorial。我对接收器部分有疑问。
如果进程正在使用 listen() 并等待传入请求:
它有哪些选项可以确保自身安全?它有办法识别谁发送了请求吗?它可以对谁可以向它发送请求施加一些限制吗?
是否没有安全选项,如果一个进程使用 listen() 它完全开放给任何请求?
关于 Linux 的一般想法是,安全性是由文件系统中 UNIX 套接字 "file" 上的文件权限强制执行的。进程必须 read/write 访问套接字特殊文件。
In the Linux implementation, sockets which are visible in the
filesystem honor the permissions of the directory they are in. Their
owner, group, and permissions can be changed. Creation of a new
socket will fail if the process does not have write and search
(execute) permission on the directory the socket is created in.
Connecting to the socket object requires read/write permission. This
behavior differs from many BSD-derived systems which ignore
permissions for UNIX domain sockets. Portable programs should not
rely on this feature for security.
不过,似乎目录搜索权限 无处不在。因此,您的套接字只能由对套接字专用文件的整个路径具有执行权限的用户 connect()
编辑 - 这在所有操作系统上都是如此。
相关:
我正在研究一个关于 unix 域套接字的 tutorial。我对接收器部分有疑问。
如果进程正在使用 listen() 并等待传入请求:
它有哪些选项可以确保自身安全?它有办法识别谁发送了请求吗?它可以对谁可以向它发送请求施加一些限制吗?
是否没有安全选项,如果一个进程使用 listen() 它完全开放给任何请求?
关于 Linux 的一般想法是,安全性是由文件系统中 UNIX 套接字 "file" 上的文件权限强制执行的。进程必须 read/write 访问套接字特殊文件。
In the Linux implementation, sockets which are visible in the filesystem honor the permissions of the directory they are in. Their owner, group, and permissions can be changed. Creation of a new socket will fail if the process does not have write and search (execute) permission on the directory the socket is created in. Connecting to the socket object requires read/write permission. This behavior differs from many BSD-derived systems which ignore permissions for UNIX domain sockets. Portable programs should not rely on this feature for security.
不过,似乎目录搜索权限 无处不在。因此,您的套接字只能由对套接字专用文件的整个路径具有执行权限的用户 connect()
编辑 - 这在所有操作系统上都是如此。
相关: