2024-01-29 10:49:54 -05:00
|
|
|
# SPDX-FileCopyrightText: 2023 - 2024 Benjamin Grande M. S. <ben.grande.b@gmail.com>
|
2023-11-13 09:33:28 -05:00
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
|
|
|
|
## Do not modify this file, create a new policy with with a lower number in the
|
|
|
|
## file name instead. For example `30-user.policy`.
|
2024-02-28 16:22:59 -05:00
|
|
|
|
|
|
|
# Input {{{
|
2024-01-09 12:44:50 -05:00
|
|
|
{% if salt['pillar.get']('qvm:sys-usb:mouse-action', 'ask') == 'ask' -%}
|
|
|
|
{% set mouse_action = 'ask default_target=dom0' -%}
|
|
|
|
{% elif salt['pillar.get']('qvm:sys-usb:mouse-action', 'ask') == 'allow' -%}
|
|
|
|
{%- set mouse_action = 'allow' -%}
|
|
|
|
{% else -%}
|
|
|
|
{%- set mouse_action = 'deny' -%}
|
|
|
|
{% endif -%}
|
2023-11-13 09:33:28 -05:00
|
|
|
|
2024-01-09 12:44:50 -05:00
|
|
|
{% if salt['pillar.get']('qvm:sys-usb:keyboard-action', 'deny') == 'ask' -%}
|
|
|
|
{%- set keyboard_action = 'ask default_target=dom0' -%}
|
|
|
|
{% elif salt['pillar.get']('qvm:sys-usb:keyboard-action', 'deny') == 'allow' -%}
|
|
|
|
{%- set keyboard_action = 'allow' -%}
|
|
|
|
{% else -%}
|
|
|
|
{%- set keyboard_action = 'deny' -%}
|
|
|
|
{% endif -%}
|
2023-11-13 09:33:28 -05:00
|
|
|
|
2024-01-09 12:44:50 -05:00
|
|
|
{% if salt['pillar.get']('qvm:sys-usb:tablet-action', 'deny') == 'ask' -%}
|
|
|
|
{%- set tablet_action = 'ask default_target=dom0' -%}
|
|
|
|
{% elif salt['pillar.get']('qvm:sys-usb:tablet-action', 'deny') == 'allow' -%}
|
|
|
|
{%- set tablet_action = 'allow' -%}
|
|
|
|
{% else -%}
|
|
|
|
{%- set tablet_action = 'deny' -%}
|
|
|
|
{% endif -%}
|
|
|
|
|
2024-01-10 06:49:20 -05:00
|
|
|
qubes.InputMouse * @tag:usbvm @adminvm {{ mouse_action }}
|
|
|
|
qubes.InputMouse * @tag:usbvm @adminvm deny
|
2024-01-09 12:44:50 -05:00
|
|
|
|
2024-01-10 06:49:20 -05:00
|
|
|
qubes.InputKeyboard * @tag:usbvm @adminvm {{ keyboard_action }}
|
2024-01-09 12:44:50 -05:00
|
|
|
qubes.InputKeyboard * @tag:usbvm @adminvm deny
|
2024-01-10 06:49:20 -05:00
|
|
|
|
|
|
|
qubes.InputTablet * @tag:usbvm @adminvm {{ tablet_action }}
|
2024-01-09 12:44:50 -05:00
|
|
|
qubes.InputTablet * @tag:usbvm @adminvm deny
|
2024-02-28 16:22:59 -05:00
|
|
|
# }}}
|
2024-01-09 12:44:50 -05:00
|
|
|
|
2024-02-28 16:22:59 -05:00
|
|
|
# CTAP {{{
|
2024-01-12 12:21:35 -05:00
|
|
|
ctap.ClientPin * @anyvm @tag:usbvm ask user=root default_target=disp-{{ sls_path }}
|
|
|
|
ctap.ClientPin * @anyvm @default ask user=root default_target=disp-{{ sls_path }}
|
2024-01-10 06:49:20 -05:00
|
|
|
ctap.ClientPin * @anyvm @anyvm deny
|
|
|
|
|
2024-01-12 12:21:35 -05:00
|
|
|
ctap.GetInfo * @anyvm @tag:usbvm ask user=root default_target=disp-{{ sls_path }}
|
|
|
|
ctap.GetInfo * @anyvm @default ask user=root default_target=disp-{{ sls_path }}
|
2024-01-10 06:49:20 -05:00
|
|
|
ctap.GetInfo * @anyvm @anyvm deny
|
2024-01-09 12:44:50 -05:00
|
|
|
|
2024-01-12 12:21:35 -05:00
|
|
|
u2f.Authenticate * @anyvm @tag:usbvm ask user=root default_target=disp-{{ sls_path }}
|
|
|
|
u2f.Authenticate * @anyvm @default ask user=root default_target=disp-{{ sls_path }}
|
2024-01-10 06:49:20 -05:00
|
|
|
u2f.Authenticate * @anyvm @anyvm deny
|
2023-11-13 09:33:28 -05:00
|
|
|
|
2024-01-12 12:21:35 -05:00
|
|
|
u2f.Register * @anyvm @tag:usbvm ask user=root default_target=disp-{{ sls_path }}
|
|
|
|
u2f.Register * @anyvm @default ask user=root default_target=disp-{{ sls_path }}
|
2024-01-10 06:49:20 -05:00
|
|
|
u2f.Register * @anyvm @anyvm deny
|
2024-01-09 12:44:50 -05:00
|
|
|
|
|
|
|
policy.RegisterArgument +u2f.Authenticate @tag:usbvm @anyvm allow target=dom0
|
2024-01-10 06:49:20 -05:00
|
|
|
policy.RegisterArgument +u2f.Authenticate @anyvm @anyvm deny
|
2024-02-28 16:22:59 -05:00
|
|
|
# }}}
|
|
|
|
|
|
|
|
# Audio {{{
|
|
|
|
{# Keep in sync with sys-audio policy #}
|
|
|
|
{% set audiovm = 'disp-' ~ sls_path %}
|
|
|
|
admin.vm.device.usb.Available * @tag:audiovm @tag:usbvm allow target=dom0
|
|
|
|
admin.vm.device.usb.Available * @tag:audiovm @anyvm deny
|
|
|
|
|
|
|
|
admin.vm.device.mic.Available * @tag:audiovm @adminvm allow target=dom0
|
|
|
|
admin.vm.device.mic.Available * @anyvm @anyvm deny
|
|
|
|
|
|
|
|
admin.Events * {{ audiovm }} @tag:audiovm-{{ audiovm }} allow target=dom0
|
|
|
|
admin.Events * @tag:audiovm @adminvm allow target=dom0
|
|
|
|
admin.Events * @tag:audiovm @anyvm deny
|
|
|
|
|
|
|
|
admin.vm.CurrentState * {{ audiovm }} @tag:audiovm-{{ audiovm }} allow target=dom0
|
|
|
|
admin.vm.CurrentState * @tag:audiovm @adminvm allow target=dom0
|
|
|
|
admin.vm.CurrentState * @tag:audiovm @anyvm deny
|
|
|
|
|
|
|
|
admin.vm.List * {{ audiovm }} @tag:audiovm-{{ audiovm }} allow target=dom0
|
|
|
|
admin.vm.List * @tag:audiovm @adminvm allow target=dom0
|
|
|
|
admin.vm.List * @tag:audiovm @anyvm deny
|
|
|
|
|
|
|
|
admin.vm.property.Get +audiovm {{ audiovm }} @tag:audiovm-{{ audiovm }} allow target=dom0
|
|
|
|
admin.vm.property.Get +audiovm @anyvm @tag:audiovm-{{ audiovm }} deny
|
|
|
|
|
|
|
|
admin.vm.property.Get +stubdom_xid {{ audiovm }} @tag:audiovm-{{ audiovm }} allow target=dom0
|
|
|
|
admin.vm.property.Get +stubdom_xid @anyvm @tag:audiovm-{{ audiovm }} deny
|
|
|
|
|
|
|
|
admin.vm.property.Get +xid {{ audiovm }} @tag:audiovm-{{ audiovm }} allow target=dom0
|
|
|
|
admin.vm.property.Get +xid @anyvm @tag:audiovm-{{ audiovm }} deny
|
|
|
|
|
|
|
|
admin.vm.feature.CheckWithTemplate +audio {{ audiovm }} @tag:audiovm-{{ audiovm }} allow target=dom0
|
|
|
|
admin.vm.feature.CheckWithTemplate +audio @anyvm @tag:audiovm-{{ audiovm }} deny
|
|
|
|
|
|
|
|
admin.vm.feature.CheckWithTemplate +audio-low-latency {{ audiovm }} @tag:audiovm-{{ audiovm }} allow target=dom0
|
|
|
|
admin.vm.feature.CheckWithTemplate +audio-low-latency @anyvm @tag:audiovm-{{ audiovm }} deny
|
|
|
|
|
|
|
|
admin.vm.feature.CheckWithTemplate +audio-model {{ audiovm }} @tag:audiovm-{{ audiovm }} allow target=dom0
|
|
|
|
admin.vm.feature.CheckWithTemplate +audio-model @anyvm @tag:audiovm-{{ audiovm }} deny
|
|
|
|
|
|
|
|
admin.vm.feature.CheckWithTemplate +supported-service.pipewire {{ audiovm }} @tag:audiovm-{{ audiovm }} allow target=dom0
|
|
|
|
admin.vm.feature.CheckWithTemplate +supported-service.pipewire @anyvm @tag:audiovm-{{ audiovm }} deny
|
|
|
|
|
|
|
|
admin.vm.property.GetAll * {{ audiovm }} @tag:audiovm-{{ audiovm }} allow target=dom0
|
|
|
|
admin.vm.property.GetAll * @anyvm @tag:audiovm-{{ audiovm }} deny
|
|
|
|
# }}}
|
|
|
|
|
2023-11-13 09:33:28 -05:00
|
|
|
# vim:ft=qrexecpolicy
|