我想对 992 端口进行身份验证,
在阅读文档时,有人说,
端口 512-1023
Authorising binding to ports from 512 to 1023 inclusive is not recommended. Some protocols (including some versions of NFS) authorise clients by seeing that they are using a port number in this range. So by authorising a program to be a server for such a port, you are also authorising it to impersonate the whole host for those protocols. To make sure that this isn't done by accident, if the port number requested is in the range 512-1023, authbind will expect the permission files to have an additional ! at the start of their leafname.
参考:授权绑定
我不明白叶名这里没有指定,所以我无法对端口 992 进行身份验证,我该怎么办?
答案1
据我了解叶名是程序名称的最后一部分(不包括/
)
例如,如果你想/usr/local/bin/myproc
执行叶名是myproc
。
为了在端口保留区域中执行程序 - 应该将 leafname 更改为!
例如/usr/local/bin/myproc
应该重命名为/usr/local/bin/!myproc
注意:如果没有真实的使用原因端口 < 1024对于非系统应用,最好使用端口 > 1024 对于此类应用。
一些代码来自authbind 源代码
117 if (hport >= IPPORT_RESERVED/2) tophalfchar= "!";
137 snprintf(fnbuf,sizeof(fnbuf)-1,"byport/%s%u",tophalfchar,hport);
138 if (!access(fnbuf,X_OK)) authorised();
145 if (af == AF_INET) {
146 snprintf(fnbuf,sizeof(fnbuf)-1,"byaddr/%s%s:%u",tophalfchar,np,hport);
147 checkexecflagfile(fnbuf);
148 }
149
150 snprintf(fnbuf,sizeof(fnbuf)-1,"byaddr/%s%s,%u",tophalfchar,np,hport);
tophalfchar 设置为!如果hport is >= 1024/2
(1024/2 = 512)
代码正在检查以下类型的字符串:
- 拜港/!港口
- 通过地址/!np:hport
- ETC
关于的详细信息authbind 安装/设置/测试