Commit Graph

342 Commits

Author SHA1 Message Date
Fabian Grünbichler
c3fa8a3634 API: add 'permissions' API endpoint
and related helper, to dump permissions + propagate info for
- a specific, given path
- generic top-level + user.cfg-referenced paths, including pools

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2020-01-29 21:21:58 +01:00
Fabian Grünbichler
7e8bcaa754 roles()/permissions(): also return propagate flag
this information is already available, but not exposed. we need it for
dumping an effective permission tree of a given user/token.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2020-01-29 21:21:58 +01:00
Fabian Grünbichler
4937239091 api: disallow some paths for API tokens
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2020-01-29 21:21:58 +01:00
Fabian Grünbichler
e915e9e454 API token: implement permission checks
non-privsep tokens will always return the roles/permissions of their
associated users. privsep tokens will return unfiltered roles, but
filtered permissions.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2020-01-29 21:21:58 +01:00
Fabian Grünbichler
6b5736d572 API: include API tokens in ACL API endpoints
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2020-01-29 21:21:58 +01:00
Thomas Lamprecht
72c4589c33 api/users: mark tokens and groups as optional in return schema
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-01-29 21:21:58 +01:00
Fabian Grünbichler
3a4ed52781 API: add group and token info to user index
otherwise we need 1+N API calls to retrieve the full user+token picture

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2020-01-29 10:05:15 +01:00
Thomas Lamprecht
b974bdc09e api: document default of token expiration date
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-01-29 10:02:52 +01:00
Fabian Grünbichler
4e4c8d4069 API: add API token API endpoints
and integration for user API endpoints.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2020-01-29 09:35:44 +01:00
Thomas Lamprecht
77eaf7c6c8 d/control: bump versioned dependencies on pve-cluster
to ensure we've got the verify_token method available and the
token.cfg observed.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-01-28 21:10:45 +01:00
Fabian Grünbichler
35c3ca0fc8 API token: add verification method
which checks that the user and token exist and are not expired, and then
generates the string to be matched with the pmxcfs-stored token shadow
config file.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2020-01-28 20:59:49 +01:00
Fabian Grünbichler
3a540a697f API token: add (shadow) TokenConfig
with the format:

<full token ID> <token value/UUID>

it is just used for token value generation/deletion via the User API,
token value verification will happen over pmxcfs/ipcc.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2020-01-28 20:59:45 +01:00
Fabian Grünbichler
571e9d062e API token: add check_token_exist API helper
the helper is modeled after the corresponding user method.

the 'tokenid' option goes into PVE::AccessControl, since we need it in
multiple API modules.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2020-01-28 20:59:40 +01:00
Fabian Grünbichler
28e3dc05e2 API token: add REs, helpers, parsing + writing
token definitions/references in user.cfg always use the full form of the
token id, consisting of:

USER@REALM!TOKENID

token definitions are represented by their own lines prefixed with
'token', which need to come after the corresponding user definition, but
before any ACLs referencing them.

parsed representation in a user config hash is inside a new 'tokens'
element of the corresponding user object, using the unique-per-user
token id as key.

only token metadata is stored inside user.cfg / accessible via the
parsed user config hash. the actual token values will be stored
root-readable only in a separate (shadow) file.

'comment' and 'expire' have the same semantics as for users.

'privsep' determines whether an API token gets the full privileges of
the corresponding user, or just the intersection of privileges of the
corresponding user and those of the API token itself.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2020-01-28 20:59:36 +01:00
Fabian Grünbichler
4833388177 API: add group members to group index
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2020-01-28 20:56:55 +01:00
Fabian Grünbichler
7d1739ad60 test: add parser/writer tests
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2020-01-27 18:34:01 +01:00
Fabian Grünbichler
1516bfa0a6 fix typo
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2020-01-27 18:33:50 +01:00
Fabian Grünbichler
964e7e865f test: run at build time
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2020-01-27 18:33:38 +01:00
Fabian Grünbichler
9a12a08ce9 refactor acl transformation code
pull it into helper sub, since we need this one more time for token ACL
members.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2020-01-14 12:28:46 +01:00
Fabian Grünbichler
8e23f97156 auth: pull username REs into variables
for reusage in API token ID format/verification

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2020-01-14 12:28:13 +01:00
Fabian Grünbichler
a31f1d85f9 rpcenv: drop unused roles()
it was useful for test-cases to verify the behaviour when pools where
introduced, but it is not used anywhere else in the code base and those
tests can also just check on permission-level.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2020-01-14 12:24:04 +01:00
Thomas Lamprecht
3443faca75 grammar fix: s/does not exists/does not exist/g
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-12-13 12:01:22 +01:00
Thomas Lamprecht
3dd692e9cb bump version to 6.0-5
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-11-26 17:56:42 +01:00
Alexandre Derumier
406726718e add SDN.Allocate && SDN.Audit privileges
Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
2019-11-26 16:49:47 +01:00
Fabian Grünbichler
9efcb56129 access-control: remove check_permissions/permission
they have been handled by PVE::RPCEnvironment for quite some time
already, and the versions there are the complete ones that should be
actually used.

manager switched over their last use not long ago, in 6.0-9, so
record a Breaks to that version.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2019-11-23 18:12:50 +01:00
Fabian Grünbichler
369851ac6d pveum: add list commands
we already have the API paths, and they make sense to get an overview
over user.cfg contents.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2019-11-23 17:42:51 +01:00
Fabian Grünbichler
a5ec58ea9a user.cfg: sort group and pool members, role privs
makes no functional difference, but keeps the output/written config more
stable.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2019-11-23 17:41:04 +01:00
Fabian Grünbichler
733371da86 user.cfg: ensure propagate flag is 1/0 when parsing
otherwise this might end up as (arbitrary) string somewhere..

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2019-11-23 17:33:37 +01:00
Fabian Grünbichler
4ef92d0dab bump version to 6.0-4
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-11-18 11:55:36 +01:00
Fabian Grünbichler
ff6b10be58 d/control: (build-)depend on libpve-cluster-perl
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2019-11-18 11:17:50 +01:00
Fabian Grünbichler
cbe9d6ef92 use already parsed u2f property string
since libpve-cluster-perl 6.0-8 this happens automatically when parsing
the datacenter.cfg, just like the other property strings stored there.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2019-11-18 11:17:50 +01:00
Fabian Grünbichler
158514a836 use PVE::DataCenterConfig
since we read datacenter.cfg, and parse the u2f property string using a
format defined in PVE::DataCenterConfig.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2019-11-18 11:17:50 +01:00
Fabian Grünbichler
e240695bd9 API: fix calls to raise_param_exc
the parameter needs to be a hash reference, not a hash.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2019-11-14 11:59:13 +01:00
Fabian Grünbichler
3196962023 d/control: correctly set Architecture field
this packge only contains perl modules and scripts, shell completions
and documentation - no architecture-specific stuff whatsoever.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2019-11-08 12:19:23 +01:00
Fabian Grünbichler
0fb0c62d74 ticket: use clinfo to get cluster name
instead of parsing corosync.conf, and avoid coupling the access-control
API with PVE::Corosync. if corosync.conf and pmxcfs don't agree on how
the cluster is called, there is a bigger issue anyway..

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2019-11-08 12:19:23 +01:00
Fabian Grünbichler
6bc6a78ac0 pveum: don't unconditionally create auth key
anything that uses it should already generate it anyway.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2019-11-08 12:19:23 +01:00
Fabian Grünbichler
042eaa3dbd pveum: cleanup outdated use statements
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2019-11-08 12:19:23 +01:00
Fabian Grünbichler
f773e2991c d/control: remove outdated dependencies
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2019-11-08 12:19:23 +01:00
Fabian Grünbichler
ec0a8d7d99 build: leave man page compression to dh_docs
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2019-11-08 12:19:23 +01:00
Fabian Grünbichler
5db309a2b1 build: use dh_missing
to fail the build if files are installed, but not shipped in any
package.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2019-11-08 12:19:23 +01:00
Fabian Grünbichler
82519f0ccb build: bump compat to 10
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2019-11-08 12:19:23 +01:00
Thomas Lamprecht
3b7eaef10f ldaps: support TLS 1.3 as SSL version
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-11-06 20:24:00 +01:00
Alexandre Derumier
07dd90d731 ldap auth: add sslversion option
default to tls1.2

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
2019-11-06 20:05:06 +01:00
Thomas Lamprecht
6e5bbca424 bump version to 6.0-3
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-10-29 08:55:09 +01:00
Thomas Lamprecht
c3925aed42 d/control: bump versioned dependency on pve-common
to ensure the new 'pve-tfa-secret' format is available

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-10-29 08:25:33 +01:00
Wolfgang Bumiller
0bf114df6d api: tfa: use the new 'pve-tfa-secret' format
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-10-29 07:42:41 +01:00
Fabian Grünbichler
9b3ae1efe3 user.cfg: sort ACL members
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2019-10-17 16:19:59 +02:00
Fabian Grünbichler
93c7e9c3d0 user.cfg: sort entries alphabetically in each section
it's not required for dependencies (since those are only ever between
sections, and not within), but makes for easier diffing.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2019-10-17 16:19:59 +02:00
Fabian Grünbichler
8967f86f6f add missing 'use PVE::Auth::Plugin'
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2019-10-17 16:19:59 +02:00
Fabian Grünbichler
508e11f184 parse_user_cfg: correctly parse group names in ACLs
usernames are allowed to start with '@', so adding a user '@test@pve'
and adding it to an ACL should work, instead of ignoring that part of
the ACL entry.

So use verify_groupname to additionally enforce that the group name we
extracted does not include an additional @, as then it cannot be a
group.

note: there is no potential for user and group to be confused, since a
username must end with '@REALM', and a group reference in an ACL can
only contain one '@' (as first character).

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2019-10-03 10:47:44 +02:00