qubes-policy.rst 3.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. :py:mod:`qubes.policy` -- Qubes RPC policy
  2. ==========================================
  3. Every Qubes domain can trigger various RPC services, but if such call would be
  4. allowed depends on Qubes RPC policy (qrexec policy in short).
  5. Qrexec policy format
  6. --------------------
  7. Policy consists of a file, which is parsed line-by-line. First matching line
  8. is used as an action.
  9. Each line consist of three values separated by white characters (space(s), tab(s)):
  10. 1. Source specification, which is one of:
  11. - domain name
  12. - `$anyvm` - any domain
  13. - `$tag:some-tag` - VM having tag `some-tag`
  14. - `$type:vm-type` - VM of `vm-type` type, available types:
  15. AppVM, TemplateVM, StandaloneVM, DispVM
  16. 2. Target specification, one of:
  17. - domain name
  18. - `$anyvm` - any domain, excluding dom0
  19. - `$tag:some-tag` - domain having tag `some-tag`
  20. - `$type:vm-type` - domain of `vm-type` type, available types:
  21. AppVM, TemplateVM, StandaloneVM, DispVM
  22. - `$default` - used when caller did not specified any VM
  23. - `$dispvm:vm-name` - _new_ Disposable VM created from AppVM `vm-name`
  24. - `$dispvm:$tag:some-tag` - _new_ Disposable VM created from AppVM tagged with `some-tag`
  25. - `$dispvm` - _new_ Disposable VM created from AppVM pointed by caller
  26. property `default_dispvm`, which defaults to global property `default_dispvm`
  27. - `$adminvm` - Admin VM aka dom0
  28. Dom0 can only be matched explicitly - either as `dom0` or `$adminvm` keyword.
  29. None of `$anyvm`, `$tag:some-tag`, `$type:AdminVM` will match.
  30. 3. Action and optional action parameters, one of:
  31. - `allow` - allow the call, without further questions; optional parameters:
  32. - `target=` - override caller provided call target -
  33. possible values are: domain name, `$dispvm` or `$dispvm:vm-name`
  34. - `user=` - call the service using this user, instead of the user
  35. pointed by target VM's `default_user` property
  36. - `deny` - deny the call, without further questions; no optional
  37. parameters are supported
  38. - `ask` - ask the user for confirmation; optional parameters:
  39. - `target=` - override user provided call target
  40. - `user=` - call the service using this user, instead of the user
  41. pointed by target VM's `default_user` property
  42. - `default_target=` - suggest this target when prompting the user for
  43. confirmation
  44. Alternatively, a line may consist of a single keyword `$include:` followed by a
  45. path. This will load a given file as its content would be in place of
  46. `$include` line. Relative paths are resolved relative to
  47. `/etc/qubes-rpc/policy` directory.
  48. Evaluating `ask` action
  49. -----------------------
  50. When qrexec policy specify `ask` action, the user is asked whether the call
  51. should be allowed or denied. In addition to that, user also need to choose
  52. target domain. User have to choose from a set of targets specified by the
  53. policy. Such set is calculated using the algorithm below:
  54. 1. If `ask` action have `target=` option specified, only that target is
  55. considered. A prompt window will allow to choose only this value and it will
  56. also be pre-filled value.
  57. 2. If no `target=` option is specified, all rules are evaluated to see what
  58. target domains (for a given source domain) would result in `ask` or `allow`
  59. action. If any of them have `target=` option set, that value is used instead of
  60. the one specified in "target" column (for this particular line). Then the user
  61. is presented with a confirmation dialog and an option to choose from those
  62. domains.
  63. 3. If `default_target=` option is set, it is used as
  64. suggested value, otherwise no suggestion is made (regardless of calling domain
  65. specified any target or not).
  66. Module contents
  67. ---------------
  68. .. automodule:: qubespolicy
  69. :members:
  70. :show-inheritance:
  71. .. vim: ts=3 sw=3 et