authz: add QAuthZList object type for an access control list
Add a QAuthZList object type that implements the QAuthZ interface. This
built-in implementation maintains a trivial access control list with a
sequence of match rules and a final default policy. This replicates the
functionality currently provided by the qemu_acl module.
To create an instance of this object via the QMP monitor, the syntax
used would be:
{
"execute": "object-add",
"arguments": {
"qom-type": "authz-list",
"id": "authz0",
"props": {
"rules": [
{ "match": "fred", "policy": "allow", "format": "exact" },
{ "match": "bob", "policy": "allow", "format": "exact" },
{ "match": "danb", "policy": "deny", "format": "glob" },
{ "match": "dan*", "policy": "allow", "format": "exact" },
],
"policy": "deny"
}
}
}
This sets up an authorization rule that allows 'fred', 'bob' and anyone
whose name starts with 'dan', except for 'danb'. Everyone unmatched is
denied.
It is not currently possible to create this via -object, since there is
no syntax supported to specify non-scalar properties for objects. This
is likely to be addressed by later support for using JSON with -object,
or an equivalent approach.
In any case the future "authz-listfile" object can be used from the
CLI and is likely a better choice, as it allows the ACL to be refreshed
automatically on change.
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2015-10-21 16:54:59 +03:00
|
|
|
# -*- Mode: Python -*-
|
2020-07-29 21:50:24 +03:00
|
|
|
# vim: filetype=python
|
2020-11-02 11:15:50 +03:00
|
|
|
|
|
|
|
##
|
|
|
|
# = User authorization
|
|
|
|
##
|
authz: add QAuthZList object type for an access control list
Add a QAuthZList object type that implements the QAuthZ interface. This
built-in implementation maintains a trivial access control list with a
sequence of match rules and a final default policy. This replicates the
functionality currently provided by the qemu_acl module.
To create an instance of this object via the QMP monitor, the syntax
used would be:
{
"execute": "object-add",
"arguments": {
"qom-type": "authz-list",
"id": "authz0",
"props": {
"rules": [
{ "match": "fred", "policy": "allow", "format": "exact" },
{ "match": "bob", "policy": "allow", "format": "exact" },
{ "match": "danb", "policy": "deny", "format": "glob" },
{ "match": "dan*", "policy": "allow", "format": "exact" },
],
"policy": "deny"
}
}
}
This sets up an authorization rule that allows 'fred', 'bob' and anyone
whose name starts with 'dan', except for 'danb'. Everyone unmatched is
denied.
It is not currently possible to create this via -object, since there is
no syntax supported to specify non-scalar properties for objects. This
is likely to be addressed by later support for using JSON with -object,
or an equivalent approach.
In any case the future "authz-listfile" object can be used from the
CLI and is likely a better choice, as it allows the ACL to be refreshed
automatically on change.
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2015-10-21 16:54:59 +03:00
|
|
|
|
|
|
|
##
|
|
|
|
# @QAuthZListPolicy:
|
|
|
|
#
|
|
|
|
# The authorization policy result
|
|
|
|
#
|
|
|
|
# @deny: deny access
|
2023-04-28 13:54:29 +03:00
|
|
|
#
|
authz: add QAuthZList object type for an access control list
Add a QAuthZList object type that implements the QAuthZ interface. This
built-in implementation maintains a trivial access control list with a
sequence of match rules and a final default policy. This replicates the
functionality currently provided by the qemu_acl module.
To create an instance of this object via the QMP monitor, the syntax
used would be:
{
"execute": "object-add",
"arguments": {
"qom-type": "authz-list",
"id": "authz0",
"props": {
"rules": [
{ "match": "fred", "policy": "allow", "format": "exact" },
{ "match": "bob", "policy": "allow", "format": "exact" },
{ "match": "danb", "policy": "deny", "format": "glob" },
{ "match": "dan*", "policy": "allow", "format": "exact" },
],
"policy": "deny"
}
}
}
This sets up an authorization rule that allows 'fred', 'bob' and anyone
whose name starts with 'dan', except for 'danb'. Everyone unmatched is
denied.
It is not currently possible to create this via -object, since there is
no syntax supported to specify non-scalar properties for objects. This
is likely to be addressed by later support for using JSON with -object,
or an equivalent approach.
In any case the future "authz-listfile" object can be used from the
CLI and is likely a better choice, as it allows the ACL to be refreshed
automatically on change.
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2015-10-21 16:54:59 +03:00
|
|
|
# @allow: allow access
|
|
|
|
#
|
|
|
|
# Since: 4.0
|
|
|
|
##
|
|
|
|
{ 'enum': 'QAuthZListPolicy',
|
|
|
|
'prefix': 'QAUTHZ_LIST_POLICY',
|
|
|
|
'data': ['deny', 'allow']}
|
|
|
|
|
|
|
|
##
|
|
|
|
# @QAuthZListFormat:
|
|
|
|
#
|
|
|
|
# The authorization policy match format
|
|
|
|
#
|
|
|
|
# @exact: an exact string match
|
2023-04-28 13:54:29 +03:00
|
|
|
#
|
authz: add QAuthZList object type for an access control list
Add a QAuthZList object type that implements the QAuthZ interface. This
built-in implementation maintains a trivial access control list with a
sequence of match rules and a final default policy. This replicates the
functionality currently provided by the qemu_acl module.
To create an instance of this object via the QMP monitor, the syntax
used would be:
{
"execute": "object-add",
"arguments": {
"qom-type": "authz-list",
"id": "authz0",
"props": {
"rules": [
{ "match": "fred", "policy": "allow", "format": "exact" },
{ "match": "bob", "policy": "allow", "format": "exact" },
{ "match": "danb", "policy": "deny", "format": "glob" },
{ "match": "dan*", "policy": "allow", "format": "exact" },
],
"policy": "deny"
}
}
}
This sets up an authorization rule that allows 'fred', 'bob' and anyone
whose name starts with 'dan', except for 'danb'. Everyone unmatched is
denied.
It is not currently possible to create this via -object, since there is
no syntax supported to specify non-scalar properties for objects. This
is likely to be addressed by later support for using JSON with -object,
or an equivalent approach.
In any case the future "authz-listfile" object can be used from the
CLI and is likely a better choice, as it allows the ACL to be refreshed
automatically on change.
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2015-10-21 16:54:59 +03:00
|
|
|
# @glob: string with ? and * shell wildcard support
|
|
|
|
#
|
|
|
|
# Since: 4.0
|
|
|
|
##
|
|
|
|
{ 'enum': 'QAuthZListFormat',
|
|
|
|
'prefix': 'QAUTHZ_LIST_FORMAT',
|
|
|
|
'data': ['exact', 'glob']}
|
|
|
|
|
|
|
|
##
|
|
|
|
# @QAuthZListRule:
|
|
|
|
#
|
|
|
|
# A single authorization rule.
|
|
|
|
#
|
|
|
|
# @match: a string or glob to match against a user identity
|
2023-04-28 13:54:29 +03:00
|
|
|
#
|
authz: add QAuthZList object type for an access control list
Add a QAuthZList object type that implements the QAuthZ interface. This
built-in implementation maintains a trivial access control list with a
sequence of match rules and a final default policy. This replicates the
functionality currently provided by the qemu_acl module.
To create an instance of this object via the QMP monitor, the syntax
used would be:
{
"execute": "object-add",
"arguments": {
"qom-type": "authz-list",
"id": "authz0",
"props": {
"rules": [
{ "match": "fred", "policy": "allow", "format": "exact" },
{ "match": "bob", "policy": "allow", "format": "exact" },
{ "match": "danb", "policy": "deny", "format": "glob" },
{ "match": "dan*", "policy": "allow", "format": "exact" },
],
"policy": "deny"
}
}
}
This sets up an authorization rule that allows 'fred', 'bob' and anyone
whose name starts with 'dan', except for 'danb'. Everyone unmatched is
denied.
It is not currently possible to create this via -object, since there is
no syntax supported to specify non-scalar properties for objects. This
is likely to be addressed by later support for using JSON with -object,
or an equivalent approach.
In any case the future "authz-listfile" object can be used from the
CLI and is likely a better choice, as it allows the ACL to be refreshed
automatically on change.
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2015-10-21 16:54:59 +03:00
|
|
|
# @policy: the result to return if @match evaluates to true
|
2023-04-28 13:54:29 +03:00
|
|
|
#
|
authz: add QAuthZList object type for an access control list
Add a QAuthZList object type that implements the QAuthZ interface. This
built-in implementation maintains a trivial access control list with a
sequence of match rules and a final default policy. This replicates the
functionality currently provided by the qemu_acl module.
To create an instance of this object via the QMP monitor, the syntax
used would be:
{
"execute": "object-add",
"arguments": {
"qom-type": "authz-list",
"id": "authz0",
"props": {
"rules": [
{ "match": "fred", "policy": "allow", "format": "exact" },
{ "match": "bob", "policy": "allow", "format": "exact" },
{ "match": "danb", "policy": "deny", "format": "glob" },
{ "match": "dan*", "policy": "allow", "format": "exact" },
],
"policy": "deny"
}
}
}
This sets up an authorization rule that allows 'fred', 'bob' and anyone
whose name starts with 'dan', except for 'danb'. Everyone unmatched is
denied.
It is not currently possible to create this via -object, since there is
no syntax supported to specify non-scalar properties for objects. This
is likely to be addressed by later support for using JSON with -object,
or an equivalent approach.
In any case the future "authz-listfile" object can be used from the
CLI and is likely a better choice, as it allows the ACL to be refreshed
automatically on change.
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2015-10-21 16:54:59 +03:00
|
|
|
# @format: the format of the @match rule (default 'exact')
|
|
|
|
#
|
|
|
|
# Since: 4.0
|
|
|
|
##
|
|
|
|
{ 'struct': 'QAuthZListRule',
|
|
|
|
'data': {'match': 'str',
|
|
|
|
'policy': 'QAuthZListPolicy',
|
|
|
|
'*format': 'QAuthZListFormat'}}
|
|
|
|
|
|
|
|
##
|
2020-10-20 13:47:58 +03:00
|
|
|
# @AuthZListProperties:
|
authz: add QAuthZList object type for an access control list
Add a QAuthZList object type that implements the QAuthZ interface. This
built-in implementation maintains a trivial access control list with a
sequence of match rules and a final default policy. This replicates the
functionality currently provided by the qemu_acl module.
To create an instance of this object via the QMP monitor, the syntax
used would be:
{
"execute": "object-add",
"arguments": {
"qom-type": "authz-list",
"id": "authz0",
"props": {
"rules": [
{ "match": "fred", "policy": "allow", "format": "exact" },
{ "match": "bob", "policy": "allow", "format": "exact" },
{ "match": "danb", "policy": "deny", "format": "glob" },
{ "match": "dan*", "policy": "allow", "format": "exact" },
],
"policy": "deny"
}
}
}
This sets up an authorization rule that allows 'fred', 'bob' and anyone
whose name starts with 'dan', except for 'danb'. Everyone unmatched is
denied.
It is not currently possible to create this via -object, since there is
no syntax supported to specify non-scalar properties for objects. This
is likely to be addressed by later support for using JSON with -object,
or an equivalent approach.
In any case the future "authz-listfile" object can be used from the
CLI and is likely a better choice, as it allows the ACL to be refreshed
automatically on change.
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2015-10-21 16:54:59 +03:00
|
|
|
#
|
2020-10-20 13:47:58 +03:00
|
|
|
# Properties for authz-list objects.
|
|
|
|
#
|
2023-04-28 13:54:29 +03:00
|
|
|
# @policy: Default policy to apply when no rule matches (default:
|
|
|
|
# deny)
|
2020-10-20 13:47:58 +03:00
|
|
|
#
|
|
|
|
# @rules: Authorization rules based on matching user
|
|
|
|
#
|
|
|
|
# Since: 4.0
|
|
|
|
##
|
|
|
|
{ 'struct': 'AuthZListProperties',
|
|
|
|
'data': { '*policy': 'QAuthZListPolicy',
|
|
|
|
'*rules': ['QAuthZListRule'] } }
|
|
|
|
|
|
|
|
##
|
|
|
|
# @AuthZListFileProperties:
|
|
|
|
#
|
|
|
|
# Properties for authz-listfile objects.
|
|
|
|
#
|
2023-04-28 13:54:29 +03:00
|
|
|
# @filename: File name to load the configuration from. The file must
|
|
|
|
# contain valid JSON for AuthZListProperties.
|
2020-10-20 13:47:58 +03:00
|
|
|
#
|
2023-04-28 13:54:29 +03:00
|
|
|
# @refresh: If true, inotify is used to monitor the file,
|
|
|
|
# automatically reloading changes. If an error occurs during
|
|
|
|
# reloading, all authorizations will fail until the file is next
|
|
|
|
# successfully loaded. (default: true if the binary was built
|
|
|
|
# with CONFIG_INOTIFY1, false otherwise)
|
2020-10-20 13:47:58 +03:00
|
|
|
#
|
|
|
|
# Since: 4.0
|
|
|
|
##
|
|
|
|
{ 'struct': 'AuthZListFileProperties',
|
|
|
|
'data': { 'filename': 'str',
|
|
|
|
'*refresh': 'bool' } }
|
|
|
|
|
|
|
|
##
|
|
|
|
# @AuthZPAMProperties:
|
|
|
|
#
|
|
|
|
# Properties for authz-pam objects.
|
|
|
|
#
|
|
|
|
# @service: PAM service name to use for authorization
|
|
|
|
#
|
|
|
|
# Since: 4.0
|
|
|
|
##
|
|
|
|
{ 'struct': 'AuthZPAMProperties',
|
|
|
|
'data': { 'service': 'str' } }
|
|
|
|
|
|
|
|
##
|
|
|
|
# @AuthZSimpleProperties:
|
|
|
|
#
|
|
|
|
# Properties for authz-simple objects.
|
|
|
|
#
|
2023-04-28 13:54:29 +03:00
|
|
|
# @identity: Identifies the allowed user. Its format depends on the
|
|
|
|
# network service that authorization object is associated with.
|
|
|
|
# For authorizing based on TLS x509 certificates, the identity
|
|
|
|
# must be the x509 distinguished name.
|
authz: add QAuthZList object type for an access control list
Add a QAuthZList object type that implements the QAuthZ interface. This
built-in implementation maintains a trivial access control list with a
sequence of match rules and a final default policy. This replicates the
functionality currently provided by the qemu_acl module.
To create an instance of this object via the QMP monitor, the syntax
used would be:
{
"execute": "object-add",
"arguments": {
"qom-type": "authz-list",
"id": "authz0",
"props": {
"rules": [
{ "match": "fred", "policy": "allow", "format": "exact" },
{ "match": "bob", "policy": "allow", "format": "exact" },
{ "match": "danb", "policy": "deny", "format": "glob" },
{ "match": "dan*", "policy": "allow", "format": "exact" },
],
"policy": "deny"
}
}
}
This sets up an authorization rule that allows 'fred', 'bob' and anyone
whose name starts with 'dan', except for 'danb'. Everyone unmatched is
denied.
It is not currently possible to create this via -object, since there is
no syntax supported to specify non-scalar properties for objects. This
is likely to be addressed by later support for using JSON with -object,
or an equivalent approach.
In any case the future "authz-listfile" object can be used from the
CLI and is likely a better choice, as it allows the ACL to be refreshed
automatically on change.
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2015-10-21 16:54:59 +03:00
|
|
|
#
|
|
|
|
# Since: 4.0
|
|
|
|
##
|
2020-10-20 13:47:58 +03:00
|
|
|
{ 'struct': 'AuthZSimpleProperties',
|
|
|
|
'data': { 'identity': 'str' } }
|