AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 809378
Accepted
Dravigon
Dravigon
Asked: 2016-10-17 10:03:31 +0800 CST2016-10-17 10:03:31 +0800 CST 2016-10-17 10:03:31 +0800 CST

如何使用 libvirt 的 polkit?

  • 772

我刚刚看到 libvirt 的 polkit 参考页面并创建了以下规则

//content of /etc/polkit-1/rules.d/50-libvirt.rules
polkit.addRule(function(action, subject) {
if (action.id == "org.libvirt.api.domain.getattr" &&
    subject.user == "dravigon") {
      if (action.lookup("connect_driver") == 'QEMU' &&
          action.lookup("domain_name") == 'debian8') {
        return polkit.Result.YES;
      } else {
        return polkit.Result.NO;
      }
}

});

希望限制用户 dravigon 只能从 qemu/kvm 驱动程序访问域 debian8
但它根本不起作用 谁能说出我哪里出错了

virtualization linux kvm-virtualization libvirt
  • 1 1 个回答
  • 1438 Views

1 个回答

  • Voted
  1. Best Answer
    Dravigon
    2016-10-19T09:54:13+08:002016-10-19T09:54:13+08:00

    只是按照fedora polkit页面中的说明发现他回答
    我必须添加另一个块似乎只有第二个块没有第一个块是无用的

    // Allow passwordless connection to qemu:///system
    polkit.addRule(function(action, subject) {
      if (action.id == "org.libvirt.unix.manage" &&
          subject.user == "MY-USER") {
          return polkit.Result.YES;
      }
    });
    // Give full access to 'test-day-vm'
    polkit.addRule(function(action, subject) {
        if (action.id.indexOf("org.libvirt.api.domain.") == 0 &&
            subject.user == "MY_USER") {
              if (action.lookup("connect_driver") == 'QEMU' &&
                  action.lookup("domain_name") == 'test-day-vm') {
                return polkit.Result.YES;
              } else {
                return polkit.Result.NO;
              }
        }
    });
    

    参考:https ://fedoraproject.org/wiki/QA:Testcase_Virt_ACLs

    • 0

相关问题

  • 更改 PHP 的默认配置设置?

  • 有什么软件可以模拟局域网?

  • 保护新的 Ubuntu 服务器 [关闭]

  • 为什么 Virtual PC 与 Windows 7 捆绑在一起很重要?[关闭]

  • (软)Ubuntu 7.10 上的 RAID 6,我应该迁移到 8.10 吗?

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve