Commit Graph

103 Commits

Author SHA1 Message Date
Lorenz Stechauner
20c60513b2 fix #1500: permission path syntax check for access control
Syntax for permission paths is now checked on API calls for
creation or update on permissions.

Signed-off-by: Lorenz Stechauner <l.stechauner@proxmox.com>
2021-04-19 10:13:45 +02:00
Thomas Lamprecht
f335d265b8 api/users: catch existing user also on case insensitive realm
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-09-29 08:51:36 +02:00
Thomas Lamprecht
2dd1e1d41e api/users: indentation cleanup
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-09-29 06:19:07 +02:00
Wolfgang Link
eb41d20051 fix #2947 login name for the LDAP/AD realm can be case-insensitive
This is an optional for LDAP and AD realm.
The default behavior is case-sensitive.

Signed-off-by: Wolfgang Link <w.link@proxmox.com>
2020-09-29 06:14:53 +02:00
Alexandre Derumier
b920d59c7a api2: AccessControl: add sdn permissions.modify
Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
2020-06-15 15:35:03 +02:00
Thomas Lamprecht
a1281512d0 comput coarse UI permissions: also check SDN ones
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-06-09 11:43:51 +02:00
Tim Marx
30dd4869b5 whitespace cleanup
Signed-off-by: Tim Marx <t.marx@proxmox.com>
2020-05-06 16:41:43 +02:00
Thomas Lamprecht
417309d71c domains: dry-run: adapt log messages and improve variable name
keep variable names aligned with the params the relate to, "write"
was quite ambiguous too (write what?)

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-04-25 19:06:24 +02:00
Thomas Lamprecht
6c42a1034b parse_sync_opts: code cleanup
avoid confusion between fmt default and cfg default

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-04-25 18:54:46 +02:00
Dominik Csapak
38691d98c8 domain sync: add 'dry-run' parameter
this can be used to test the resulting config before actually changing
anything

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2020-04-25 18:31:35 +02:00
Dominik Csapak
055c54b5a2 domain sync: make options actually required
we want the api options to be optional, but only as long as there are
default values set in the realm config

since they are all marked as optional (else they would be required in
the api) this check did not work as intended

instead, set the result to the value of:
* the parameter
* the set default in the config
* the api default
in this order

if it is undef after this, raise a parameter exception

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2020-04-25 18:31:35 +02:00
Thomas Lamprecht
89338e4d9c api/domain: add on add/update/delete hooks
Almost 1:1 taken from pve-storage ones

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-04-18 18:48:05 +02:00
Thomas Lamprecht
77bfb48e0d token create: return also full token id for convenience
makes creating a client for this slightly nicer, as it doesn't needs
to be as state full.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-04-15 20:41:39 +02:00
Thomas Lamprecht
b49abe2d25 split and sort some module use
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-03-21 16:21:57 +01:00
Thomas Lamprecht
d29d2d4a11 realm: add default-sync-options to config
This allows us to have a convenient way to set the desired default
sync options, and thus not forcing users to pass always all options
when they want to trigger a sync.

We still die when an option is neither specified in the domains
(realm) config nor as API/CLI parameter.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-03-21 16:21:57 +01:00
Thomas Lamprecht
415179b03a api: realm sync: move out group and user update to separate methods
keep the api call way smaller and clearer

On moving out some minor adaptions where made, e.g., we do not print
"remove user X" if we know that we'd add it again, but just print a
single "update user X" for that. Same for groups.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-03-21 16:21:57 +01:00
Thomas Lamprecht
6a2138e4d6 api: realm sync: use auth-realm-sync as worker id
we may potentially also sync something else over this in the future,
for example PAM users from a specific group, so use a more general
	name.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-03-21 16:11:48 +01:00
Thomas Lamprecht
cf109814a8 api: realm sync: cleanup code and refactor
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-03-21 16:11:48 +01:00
Dominik Csapak
673d2bf267 api: domains: add user/group sync API enpoint
this api call syncs the users and groups from LDAP/AD to the
user.cfg

it also implements a 'full' mode where we first delete all
users/groups from the config and sync them again

the parameter 'enable' controls if newly synced users are 'enabled'
(if no sync parameter handles that)
the parameter 'purge' controls if ACLs get removed for users/groups
that do not exists anymore after

also add this command to pveum

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2020-03-21 16:05:15 +01:00
Dominik Csapak
f3c87f9b4e API2/Domains.pm: document 'type' return value
this way it gets printed with 'pveum realm list'

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2020-03-07 19:50:22 +01:00
Dominik Csapak
32449f358e API2/Domains.pm: fix whitespace errors
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2020-03-07 19:50:22 +01:00
Dominik Csapak
deb63acf3f fix #2575: die when trying to edit built-in roles
instead of silently ignoring the change

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2020-01-31 20:34:06 +01:00
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
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
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
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
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
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
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
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
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
Dominik Csapak
e51988b4cb add /access/user/{id}/tfa api call to get tfa types
this api call will be used to display the right kind of tfa for the gui

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-05-07 10:04:45 +00:00
Thomas Lamprecht
eb25cbafc3 u2f: new perl bindings encode public key for us
as it was binary data, which can contain everything, including '\0',
and this was cut off, making it impossible to login after
registration, as a borked publicKey got saved in tfa.cfg

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-04-09 12:44:25 +02:00
Wolfgang Bumiller
f25628d3ef verify_ticket: allow general non-challenge tfa to be run as two step call
This allows for doing OTP TFA in two steps, first login with normal
credentials and get the half-logged-in ticket, then send the OTP
verification for full login, same as with u2f was already possible.

This allows for a nicer UI, as OTP fields can be shown on demand, and
do not need to be visible by default.

The old way of sending the OTP code immediately with the initial
credentials request still works for backward compatibility and as
some API user may prefer it.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-04-08 14:48:13 +02:00
Wolfgang Bumiller
47d731c731 allow users to change their totp settings
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-04-03 08:04:00 +02:00
Wolfgang Bumiller
18f8ba1803 u2f authentication
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-04-03 08:04:00 +02:00
Wolfgang Bumiller
9536c4dcd4 delete TFA entries when deleting a user
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-04-03 08:04:00 +02:00
Wolfgang Bumiller
2b4c98ab01 u2f api endpoints
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-04-03 08:04:00 +02:00
Thomas Lamprecht
b27ae8aa44 api/ticket: move getting cluster name into an eval
to avoid a failed login if a broken corosync config is setup

Reviewed-by: Dominik Csapak <d.csapak@proxmox.com>
Tested-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2018-11-26 15:49:53 +01:00
Dominik Csapak
0fea3f1677 fix #1998: correct return properties for read_role
we have each privilege as property of the return object,
so we generate it from $valid_privs

this has the advantage that all privileges are well documented
with that api call

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2018-11-23 14:21:03 +01:00
Thomas Lamprecht
e842fec5e0 fix #233: return cluster name on successful login
If a cluster is configured then return the cluster name on successful
login - if the user has Sys.Audit privileges on the '/' path (same
as for returning cluster info, like the join info path uses)

This is more for the reason that some admins do not want to expose
this to lesser privileged (API) users. While yes, you can
theoretically launch a (DDOS resembling) attack which stresses the
corosync network if you know the cluster_name (it's still encrypted
but you can back-calculate the multicast group membership info) you
need to be able to send multicast traffic on the corosync LAN -
which can be seen as a pretty big privilege anyway.

But, for now reduce permissions - we can more easily loosen them than
tighten without causing issues anyway.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2018-11-13 11:58:05 +01:00
Dietmar Maurer
af5d7da7f1 Revert "Add title and print_width fields to properties"
This reverts commit bcf4eb3d49.
I think those titles does not add any value.
2018-08-03 10:45:13 +02:00
Stoiko Ivanov
bcf4eb3d49 Add title and print_width fields to properties
Used for printing in pveum

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2018-06-27 16:40:55 +02:00
Stoiko Ivanov
3a5ae7a0e6 refactor API using get/register_standard_option
Pull out duplicated property definitions in the API into
register_standard_option/get_standard_option calls.
(All parameters, which are thus added to the API calls were optional).

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2018-06-27 16:40:55 +02:00