Commit Graph

638 Commits

Author SHA1 Message Date
Thomas Lamprecht
4a7b5956ec tfa: cope with native versions in cluster version check
Reported-by: Friedrich Weber <f.weber@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-06-09 16:10:33 +02:00
Thomas Lamprecht
6004f25eda bump version to 8.0.0
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-06-09 10:14:36 +02:00
Thomas Lamprecht
00b90e7185 api: roles: forbid creatin new roles starting with "PVE" namespace
makes our reasoning when adding new top-level privileges way easier
in the future.
We already had two major upgrades with role additions where we had to
add special checks in the upgrade script and breaking changes, so
let's reserve any role starting with PVE (case-insensitive to avoid
confusion potential) and forbid creating those via API.

We might also think about letting the config parser choke on that, as
otherwise one could still create them via editing the config
manually.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-06-08 09:31:24 +02:00
Thomas Lamprecht
d6fb84bfef api: roles: cleanup imports
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-06-08 09:30:27 +02:00
Thomas Lamprecht
43aa2489fc api: roles: whitespace and indendation clean-ups
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-06-08 09:22:00 +02:00
Thomas Lamprecht
8e8023b1e9 bump version to 8.0.0~3
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-06-07 19:12:08 +02:00
Thomas Lamprecht
bd993a4cfc tests: adapt new test for admin ACL with mapping privs
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-06-07 19:12:08 +02:00
Dominik Csapak
8b5fd2e66e add privileges and paths for cluster resource mapping
uses the privileges:

Mapping.Use
Mapping.Modify
Mapping.Audit

on /mapping/{TYPE}/{id}

so that we can assign privileges on resource level

this will generate new roles (PVEMappingUser, PVEMappingAdmin,
PVEMappingAuditor)

note that every user with Permissions.Modify on '/' and propagate can add these
new roles to themselves

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2023-06-07 18:58:33 +02:00
Alexandre Derumier
a62d78db33 add new SDN.use privilege in PVESDNUser role
Signed-off-by: Alexandre Derumier <aderumier@odiso.com>

FG: fix test
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2023-06-07 13:17:40 +02:00
Fabian Grünbichler
e1ea58c810 check_sdn_bridge: check bridge first
it's cheap, so let's use it for early returning

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2023-06-07 13:17:23 +02:00
Fabian Grünbichler
3c97bee53c check_sdn_bridge: correctly handle noerr
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2023-06-07 13:17:23 +02:00
Alexandre Derumier
a5616d5c6e rpcenvironnment: add check_sdn_bridge
check if user have access to 1 vlan of the bridge
or the bridge itself

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
2023-06-07 13:17:23 +02:00
Alexandre Derumier
4d5b0937a3 access control: add /sdn/zones/<zone>/<vnet>/<vlan> path
Signed-off-by: Alexandre Derumier <aderumier@odiso.com>

FG: add missing /sdn/zones path

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2023-06-07 13:17:23 +02:00
Alexandre Derumier
c27eb24526 rpcenv: api permission heuristic: query Sys.Modify for root ACL-path
Ensures that we can use this in the capabilities heuristic check in
the web UI

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
2023-06-07 12:02:24 +02:00
Thomas Lamprecht
3ef602fe95 bump version to 8.0.0~2
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-06-07 11:34:33 +02:00
Fabian Grünbichler
46bfd59dfc acls: restrict less-privileged ACL modifications
there are currently three possibilities to modify ACLs without the
'Permissions.Modify' privilege in PVE::RPCEnvironment::check_perm_modify:

    if ($path =~ m|^/storage/.+$|) {
	push @$testperms, 'Datastore.Allocate';
    } elsif ($path =~ m|^/vms/.+$|) {
	push @$testperms, 'VM.Allocate';
    } elsif ($path =~ m|^/pool/.+$|) {
	push @$testperms, 'Pool.Allocate';
    }

lock those down by only allowing the currently authenticated user to hand out a
subset of their own privileges, never more.

for example, this still allows a PVEVMAdmin to create ACLs for other
users/tokens with PVEVMUser (on '/vm/XXX'), but not with Administrator or
PVEPermAdmin.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2023-06-07 11:13:16 +02:00
Fabian Grünbichler
df619a8dc2 roles: restrict Permissions.Modify to Administrator
to reduce the chances of accidentally handing out privilege modification
privileges. the old default setup of having Permissions.Modify in PVESysAdmin
and PVEAdmin weakened the distinction between those roles and Administrator.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2023-06-07 11:13:16 +02:00
Thomas Lamprecht
27014b5908 fix module namespace of realm sync API
it isn't mounted in PVE::API2::AccessControl and it doesn't lives
anywhere in /access, so using that is just confusing.

Both, API and backend could simply move to manager, but as we already
got an api package here and it does somewhat fits into the topic lets
keep it here for now.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-06-07 09:37:47 +02:00
Thomas Lamprecht
37976acc6d api: realm sync: die early if no job options
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-06-07 09:33:16 +02:00
Thomas Lamprecht
c0210e3cf1 api: realm sync: code cleanups
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-06-07 09:32:59 +02:00
Thomas Lamprecht
51ae7bbb69 realm sync: cleanup imports
with: perlimports -i --no-padding

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-06-07 09:31:40 +02:00
Dominik Csapak
dc982c4b76 add realm-sync plugin for jobs and CRUD api for realm-sync-jobs
to be able to define automated jobs that sync ldap/ad

The jobs plugin contains special handling when no node is given, since
we only want it to run on a single node when that triggers. For that,
we save a statefile in /etc/pve/priv/jobs/ which contains the
node/time/upid of the node that runs the job. The first node that
is able to lock the realm (via cfs_lock_domain) "wins" and may
sync from the ldap.

in case a specific node was selected, this is omitted and the Jobs
handling will not let it run on other nodes anyway

the API part is our usual sectionconfig CRUD api, but specialized
for the specific type of job.

the api will be at /cluster/jobs/realm-sync
(this must be done in pve-manager)

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
 [ T: resolve merge conflict due to packaging/source split ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-06-07 08:01:07 +02:00
Wolfgang Bumiller
53a2b71563 api: user index: only include existing tfa lock flags
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2023-06-06 11:19:00 +02:00
Wolfgang Bumiller
f63364a755 bump version to 8.0.0~1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2023-06-05 14:52:39 +02:00
Wolfgang Bumiller
3c4cebc9b7 api: include tfa lock status in user list
this means /access/users is now a 'protected' call to get
access to 'priv/tfa.cfg'

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2023-06-05 12:59:32 +02:00
Wolfgang Bumiller
32893f1308 tfa: update list_tfa return schema
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2023-06-05 12:59:32 +02:00
Wolfgang Bumiller
ddf78dfbf3 cli: add 'tfa unlock' command
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2023-06-05 12:59:32 +02:00
Wolfgang Bumiller
330b8dbbe1 api: add /access/users/<userid>/unlock-tfa api call
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2023-06-05 12:59:32 +02:00
Wolfgang Bumiller
9036621e28 tfa: enable lockout of users via tfa.cfg
This will be accompanied by a change in pve-rs to finally
enable this.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2023-06-05 12:59:32 +02:00
Wolfgang Bumiller
209e9ab340 bump pve-rs dep to 0.8.3
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2023-06-05 12:59:32 +02:00
Wolfgang Bumiller
6c512352ae pam: set PAM_RHOST
This allows pam modules to restrict users by host. For
instance, you could restrict root@pam to only 127.0.0.1.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2023-06-05 08:53:42 +02:00
Wolfgang Bumiller
9d2996034d cli: add 'tfa list' command
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2023-06-05 08:53:31 +02:00
Wolfgang Bumiller
cfd8636b5e drop support for old login API
The new-format parameter for the ticket call is now ignored
and assumed 1.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2023-06-05 08:53:24 +02:00
Wolfgang Bumiller
cb64967379 api: drop old verify_tfa api call
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2023-06-05 08:53:18 +02:00
Wolfgang Bumiller
6b190c646e depend on pve-rs 0.8.0
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2023-05-22 10:27:15 +02:00
Wolfgang Bumiller
4a0d424f30 add anyevent to build deps
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2023-05-22 08:12:31 +02:00
Thomas Lamprecht
a3dc6ff488 bump version to 7.99.0
use a pre-release like version as we got some breaking changes
planned for access control, so might be nice to get (most of) them in
a 8.0.0 for simpler versioned  dependencies (>= 8~), but it's also
just a bit of an experiment to see how doing such things plays out,
in the end we can cope with whatever versioning for dependency as bug
fixes might make it necessary to have a more specific version
boundary anyway.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-05-21 12:44:21 +02:00
Thomas Lamprecht
e6911a0845 d/control: raise standards version compliance to 4.6.2
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-05-21 12:38:08 +02:00
Thomas Lamprecht
7426bae5c6 d/control: define compat level via build-depends and raise to 13
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-05-21 12:37:11 +02:00
Thomas Lamprecht
b08d939725 oathkeygen: modernize and improve error handling slightly
Note that this could also just be documented doing:

 dd if=/dev/urandom bs=1 count=10 2>/dev/null | base32

And using TOTP apps that can scan QR codes is much better UX anyway,
but its to trivial to bother deprecating it now and we'd still depend
on libmime-base32-perl, so really nothing gained in removing or
rewriting in shell..

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-05-21 12:37:11 +02:00
Thomas Lamprecht
52910795a9 buildsys: add sbuild convenience target
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-05-21 12:37:11 +02:00
Thomas Lamprecht
474b2ce0f8 buildsys: cleanup and expand clean target
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-05-21 12:37:11 +02:00
Thomas Lamprecht
f71246d8c4 src makefiles: convert to use simple parenthesis
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-05-21 12:37:11 +02:00
Thomas Lamprecht
06d9a97f5b buildsys: drop useless packaging variable/includes in src
and allow overriding the PACKAGE variable, making it actually useful

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-05-21 12:37:11 +02:00
Thomas Lamprecht
2d3766be89 buildsys: rework clean target, avoid doc-gen one
1. this really doesn't change often
2. the synopsis and opts should be in the owner repo anyway
3. the original one simply deleted all *.adoc files, far to
   aggressive

Avoids pve-docs dependency for building the DSC (without having to
pass the ugly no-pre-clean option).

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-05-21 12:37:11 +02:00
Thomas Lamprecht
e0b959c968 buildsys: derive upload dist automatically
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-05-21 12:37:11 +02:00
Thomas Lamprecht
6a003c5a14 buildsys: don't pass arch for an arch: all package
it was wrong too anyway, if, one would need to use the
$(DEB_HOST_ARCH), as that's the one package is built for.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-05-21 11:22:02 +02:00
Thomas Lamprecht
e4d6ad4d93 use combined dpkg packaging variable makefile fragment
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-05-21 11:17:45 +02:00
Thomas Lamprecht
a3744c5e8f makefile: convert to use simple parenthesis
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-05-21 10:52:58 +02:00
Wolfgang Bumiller
f2762a0359 bump version to 7.4-3
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2023-05-16 13:33:54 +02:00