qubes-policy.rst 3.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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` - _new_ Disposable VM created from AppVM pointed by caller
  25. property `default_dispvm`, which defaults to global property `default_dispvm`
  26. - `$adminvm` - Admin VM aka dom0
  27. Dom0 can only be matched explicitly - either as `dom0` or `$adminvm` keyword.
  28. None of `$anyvm`, `$tag:some-tag`, `$type:AdminVM` will match.
  29. 3. Action and optional action parameters, one of:
  30. - `allow` - allow the call, without further questions; optional parameters:
  31. - `target=` - override caller provided call target -
  32. possible values are: domain name, `$dispvm` or `$dispvm:vm-name`
  33. - `user=` - call the service using this user, instead of the user
  34. pointed by target VM's `default_user` property
  35. - `deny` - deny the call, without further questions; no optional
  36. parameters are supported
  37. - `ask` - ask the user for confirmation; optional parameters:
  38. - `target=` - override user provided call target
  39. - `user=` - call the service using this user, instead of the user
  40. pointed by target VM's `default_user` property
  41. - `default_target=` - suggest this target when prompting the user for
  42. confirmation
  43. Alternatively, a line may consist of a single keyword `$include:` followed by a
  44. path. This will load a given file as its content would be in place of
  45. `$include` line. Relative paths are resolved relative to
  46. `/etc/qubes-rpc/policy` directory.
  47. Evaluating `ask` action
  48. -----------------------
  49. When qrexec policy specify `ask` action, the user is asked whether the call
  50. should be allowed or denied. In addition to that, user also need to choose
  51. target domain. User have to choose from a set of targets specified by the
  52. policy. Such set is calculated using the algorithm below:
  53. 1. If `ask` action have `target=` option specified, only that target is
  54. considered. A prompt window will allow to choose only this value and it will
  55. also be pre-filled value.
  56. 2. If no `target=` option is specified, all rules are evaluated to see what
  57. target domains (for a given source domain) would result in `ask` or `allow`
  58. action. If any of them have `target=` option set, that value is used instead of
  59. the one specified in "target" column (for this particular line). Then the user
  60. is presented with a confirmation dialog and an option to choose from those
  61. domains.
  62. 3. If `default_target=` option is set, it is used as
  63. suggested value, otherwise no suggestion is made (regardless of calling domain
  64. specified any target or not).
  65. Module contents
  66. ---------------
  67. .. automodule:: qubespolicy
  68. :members:
  69. :show-inheritance:
  70. .. vim: ts=3 sw=3 et