我已经根据评论中的建议重新格式化以提高可读性。
我有一个使用 google 身份验证器的 RADIUS 服务器,SELinux 阻止 RADIUS 访问用户主目录中的 .google_authenticator 文件(这些也是 winbind 用户,主目录在/home/API)。我尝试通过构建以下策略文件来授予它访问权限:
$ cat ./google-authenticator.fc
/home/API(/.*)?/\.google_authenticator gen_context(system_u:object_r:radiusd_google_authenticator_t,s0)
$ cat ./google-authenticator.te
policy_module(radiusd_google_authenticator, 0.0.10)
require {
type radiusd_t;
type user_home_dir_t;
type admin_home_t;
}
type radiusd_google_authenticator_t;
role object_r types radiusd_google_authenticator_t;
allow radiusd_t radiusd_google_authenticator_t:file { rename create unlink rw_file_perms };
files_type(radiusd_google_authenticator_t)
filetrans_pattern(radiusd_t, user_home_dir_t, radiusd_google_authenticator_t, file, ".google_authenticator")
filetrans_pattern(radiusd_t, admin_home_t, radiusd_google_authenticator_t, file, ".google_authenticator")
Run Code Online (Sandbox Code Playgroud)
安装这些会显示 中的路径semanage fcontext -l,但它不起作用:
$ sudo semanage fcontext -l | grep google_authenticator
/home/API(/.*)?/\.google_authenticator all files system_u:object_r:radiusd_google_authenticator_t:s0
$ matchpathcon …Run Code Online (Sandbox Code Playgroud)