我正在使用 CentOS 8,我想cap_dac_read_search
通过 PAM 向用户授予该功能。它似乎可以通过本地登录 和 来工作su
,但不能通过ssh
.
我遵循了这些步骤,并且只有它们:
创建了文件/etc/security/capability.conf
,并在里面写入:
cap_dac_read_search user1
Run Code Online (Sandbox Code Playgroud)
编辑/etc/pam.d/sshd
:
#%PAM-1.0
auth required pam_cap.so
auth substack password-auth
auth include postlogin
...
Run Code Online (Sandbox Code Playgroud)
重新启动 SSH 服务:
systemctl restart sshd
Run Code Online (Sandbox Code Playgroud)
user1
但是,当我使用through登录ssh
并使用capsh
命令时,我可以看到:
[user1@localhost ~]$ capsh --print
Current: =
Run Code Online (Sandbox Code Playgroud)
/etc/pam.d/login
当我用和做类似的事情时/etc/pam.d/su
,一切似乎都井然有序。
我确定并检查了sshd
配置,并将UsePam
其设置为true
.
我在 中收到以下错误audit.log
,我认为 SELinux 由于某种原因阻止了我:
type=AVC msg=audit(1621457365.510:253): avc: denied { setcap } for pid=1969 comm="sshd" scontext=system_u:system_r:sshd_t:s0-s0:c0.c1023 tcontext=system_u:system_r:sshd_t:s0-s0:c0.c1023 tclas s=process permissive=0
Run Code Online (Sandbox Code Playgroud)
您需要sshd
显式配置它才能使用 PAM
UsePAM Enables the Pluggable Authentication Module interface. If set to
yes this will enable PAM authentication using
ChallengeResponseAuthentication and PasswordAuthentication in
addition to PAM account and session module processing for all
authentication types.
Run Code Online (Sandbox Code Playgroud)
请注意,这仍然限制身份验证类型;因此,如果您通过 ssh 密钥进行身份验证,则不会为“auth”堆栈调用 PAM。
归档时间: |
|
查看次数: |
643 次 |
最近记录: |