polkit.Result.AUTH_ADMIN_KEEP 不适用于 fprintd

polkit.Result.AUTH_ADMIN_KEEP 不适用于 fprintd

我目前正在配置打印输出在我的电脑上。它是一个强大的工具,可以在类 Unix 系统上进行指纹授权。但用户无需密码授权,只需使用 即可添加、修改和删除指纹fprintd-enroll。这是一个安全漏洞,因为任何人在物理访问我的计算机时都可以将自己的指纹注册到我的设备上。

为了克服这个漏洞,我注意到波尔基特可能有助于在物理用户修改我的指纹凭据之前强制执行密码升级。阅读 polkit 的手册后,我最终得到了位于以下位置的策略规则/usr/share/polkit-1/rules.d/50-net.reactivated.fprint.device.enroll.rules

polkit.addRule(function (action, subject) {
  if (action.id == "net.reactivated.fprint.device.enroll") {
    return subject.user == "root" ? polkit.Result.YES : polkit.Result.AUTH_ADMIN_KEEP;
  }
})

我相信这条规则可以帮助强制管理员用户提供密码,同时允许 root 用户拯救世界,特别是当出现问题时。另外,由于我当前的用户是wheel组的成员,因此应根据以下方式将其识别为管理员用户/usr/share/polkit-1/rules.d/50-defaule.rules

/* -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*- */

// DO NOT EDIT THIS FILE, it will be overwritten on update
//
// Default rules for polkit
//
// See the polkit(8) man page for more information
// about configuring polkit.

polkit.addAdminRule(function(action, subject) {
    return ["unix-group:wheel"];
});

一切看起来都很好,直到我尝试通过运行来测试此设置fprintd-enroll

[tjm@ArchPad ~]$ fprintd-enroll 
Using device /net/reactivated/Fprint/Device/0
Enrolling right-index-finger finger.
EnrollStart failed: Not Authorized: net.reactivated.fprint.device.enroll
[tjm@ArchPad ~]$ 

我有点惊讶事情不起作用并且发生了授权失败。我尝试更改polkit.Result.AUTH_ADMIN_KEEPpolkit.Result.AUTH_SELF_KEEP,不幸的是这没有帮助。我希望有办法解决这个问题。

相关内容