public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pbs-devel] [PATCH proxmox/proxmox-backup/pwt v2 0/15] add Active Directory realm support
@ 2023-08-16 14:47 Christoph Heiss
  2023-08-16 14:47 ` [pbs-devel] [PATCH proxmox v2 01/15] ldap: avoid superfluous allocation when calling .search() Christoph Heiss
                   ` (14 more replies)
  0 siblings, 15 replies; 22+ messages in thread
From: Christoph Heiss @ 2023-08-16 14:47 UTC (permalink / raw)
  To: pbs-devel

This series adds Active Directory realm support to PBS, much like it
already exists in PVE. The logic matches it as closely as possible.

Patches #1 through #6 are purely preparatory.

The API, authenticator and realm sync job implementations are partly
simply copied from LDAP, replacing structs and changing some things as
needed. The realm sync job simply reuses the existing LDAP
implementation for the most part, other than setting up some things
differently.

As for the UI, the existing panel for LDAP realms was generic enough
such that it only needed a few conditionals as what input boxes to show.

One thing to note is that - unlike PVE - you don't have to specify a
domain name when creating an AD realm. This is due to `proxmox-ldap`
already figuring out the correct, full DN of bind and login users
itself. That is the only use of the domain name in PVE anyway, thus it
is not present here.

The base DN is automatically determined from the `defaultNamingContext`
attribute of the root DSE object. It can be set manually in the config
if the need should arise. So that should be treated more like an
implementation detail.

RFC parts (case-insensitivity/patch #13-#15)
--------------------------------------------
The last three patches implement case-insensitive support for AD
realms, as is also implemented in PVE.

I have separated these out from the rest and marked them as RFC, since
the implementation is unfortunately not all that trivial. It needs some
support in the `proxmox-section-config` crate to support
case-insensitive lookups, and some more support in the `pbs-config`
crate to use the former, depending whether the (AD) realm supports
case-insensitive usernames. I actually forgot the implement/test it
fully in v1, thus lots more code now.

This was implemented in PVE in eb41d20 ("fix #2947 login name for the
LDAP/AD realm can be case-insensitive"), see also the accompanying
ticket [0] and forum report [1].

Testing
-------
I have tested this series using:

 * slapd 2.5.13+dfsg-5 as LDAP server to ensure no regressions
 * Samba 4.18.5 as an Linux-based AD server and
 * AD on Windows Server 2022 to make sure that works as well

For slapd and MS AD, I tested both anonymous binds and authenticated
binds, with Samba only authenticated binds (since there seems to way to
turn on anonymous binds in Samba, at least that I could find ..) as well
as dry-running and actual syncing of users. Further, then also logging
into PBS with a sync'd user. With an case-insensitive AD realm, I also
tried logging in with a non-case-matching variant of the username.

History
-------
v1: https://lists.proxmox.com/pipermail/pbs-devel/2023-August/006410.html

Notable changes v1 -> v2:
  * Applied various review comments pointed out by Lukas & Wolfgang
  * Fully implemented case-insensitive support (as separate patches)

[0] https://bugzilla.proxmox.com/show_bug.cgi?id=2947
[1] https://forum.proxmox.com/threads/ad-sync-authentication.74547/

proxmox:

Christoph Heiss (4):
  ldap: avoid superfluous allocation when calling .search()
  ldap: add method for retrieving root DSE attributes
  auth-api: implement `Display` for `Realm{,Ref}`
  section-config: add method to retrieve case-insensitive entries

 proxmox-auth-api/src/types.rs        |  12 +++
 proxmox-ldap/src/lib.rs              |  31 ++++++--
 proxmox-ldap/tests/assets/glauth.cfg |   1 +
 proxmox-ldap/tests/glauth.rs         |  16 ++++
 proxmox-section-config/Cargo.toml    |   3 +
 proxmox-section-config/src/lib.rs    | 115 ++++++++++++++++++++++++++-
 6 files changed, 170 insertions(+), 8 deletions(-)

proxmox-backup:

Christoph Heiss (9):
  api-types: factor out `LdapMode` -> `ConnectionMode` conversion into
    own fn
  auth: factor out CA store and cert lookup into own fn
  realm sync: generic-ify `LdapSyncSettings` and `GeneralSyncSettings`
  api: access: add routes for managing AD realms
  config: domains: add new "ad" section type for AD realms
  realm sync: add sync job for AD realms
  manager: add subcommand for managing AD realms
  docs: user-management: add section about AD realm support
  api: add case-insensitive support for Active Directory realms

 docs/user-management.rst               |  41 ++-
 pbs-api-types/src/ad.rs                | 101 +++++++
 pbs-api-types/src/lib.rs               |   8 +
 pbs-config/src/cached_user_info.rs     |  35 ++-
 pbs-config/src/domains.rs              |  80 +++++-
 src/api2/access/domain.rs              |  18 +-
 src/api2/config/access/ad.rs           | 357 +++++++++++++++++++++++++
 src/api2/config/access/mod.rs          |   2 +
 src/api2/config/sync.rs                |  18 +-
 src/auth.rs                            | 120 +++++++--
 src/bin/proxmox-backup-manager.rs      |   1 +
 src/bin/proxmox_backup_manager/ad.rs   | 105 ++++++++
 src/bin/proxmox_backup_manager/ldap.rs |   2 +-
 src/bin/proxmox_backup_manager/mod.rs  |   2 +
 src/server/realm_sync_job.rs           | 111 ++++++--
 15 files changed, 942 insertions(+), 59 deletions(-)
 create mode 100644 pbs-api-types/src/ad.rs
 create mode 100644 src/api2/config/access/ad.rs
 create mode 100644 src/bin/proxmox_backup_manager/ad.rs

proxmox-widget-toolkit:

Christoph Heiss (2):
  window: add Active Directory auth panel
  window: ldap auth edit: add case-sensitive checkbox for AD realms

 src/Makefile               |  1 +
 src/Schema.js              | 10 ++++++
 src/window/AuthEditAD.js   | 14 ++++++++
 src/window/AuthEditLDAP.js | 65 ++++++++++++++++++++++++++++++--------
 4 files changed, 77 insertions(+), 13 deletions(-)
 create mode 100644 src/window/AuthEditAD.js

--
2.41.0





^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2023-12-12 12:20 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-16 14:47 [pbs-devel] [PATCH proxmox/proxmox-backup/pwt v2 0/15] add Active Directory realm support Christoph Heiss
2023-08-16 14:47 ` [pbs-devel] [PATCH proxmox v2 01/15] ldap: avoid superfluous allocation when calling .search() Christoph Heiss
2023-08-16 14:47 ` [pbs-devel] [PATCH proxmox v2 02/15] ldap: add method for retrieving root DSE attributes Christoph Heiss
2023-08-16 14:47 ` [pbs-devel] [PATCH proxmox v2 03/15] auth-api: implement `Display` for `Realm{, Ref}` Christoph Heiss
2023-08-16 14:47 ` [pbs-devel] [PATCH proxmox-backup v2 04/15] api-types: factor out `LdapMode` -> `ConnectionMode` conversion into own fn Christoph Heiss
2023-08-16 14:47 ` [pbs-devel] [PATCH proxmox-backup v2 05/15] auth: factor out CA store and cert lookup " Christoph Heiss
2023-08-16 14:47 ` [pbs-devel] [PATCH proxmox-backup v2 06/15] realm sync: generic-ify `LdapSyncSettings` and `GeneralSyncSettings` Christoph Heiss
2023-08-16 14:47 ` [pbs-devel] [PATCH proxmox-backup v2 07/15] api: access: add routes for managing AD realms Christoph Heiss
2023-11-28  8:23   ` Fabian Grünbichler
2023-12-12 12:19     ` Christoph Heiss
2023-08-16 14:47 ` [pbs-devel] [PATCH proxmox-backup v2 08/15] config: domains: add new "ad" section type for " Christoph Heiss
2023-08-16 14:47 ` [pbs-devel] [PATCH proxmox-backup v2 09/15] realm sync: add sync job " Christoph Heiss
2023-08-16 14:47 ` [pbs-devel] [PATCH proxmox-backup v2 10/15] manager: add subcommand for managing " Christoph Heiss
2023-08-16 14:47 ` [pbs-devel] [PATCH proxmox-backup v2 11/15] docs: user-management: add section about AD realm support Christoph Heiss
2023-11-28  8:33   ` Fabian Grünbichler
2023-12-12 12:20     ` Christoph Heiss
2023-08-16 14:47 ` [pbs-devel] [PATCH proxmox-widget-toolkit v2 12/15] window: add Active Directory auth panel Christoph Heiss
2023-08-16 14:47 ` [pbs-devel] [RFC PATCH proxmox v2 13/15] section-config: add method to retrieve case-insensitive entries Christoph Heiss
2023-08-16 14:47 ` [pbs-devel] [RFC PATCH proxmox-backup v2 14/15] api: add case-insensitive support for Active Directory realms Christoph Heiss
2023-11-27  9:57   ` Lukas Wagner
2023-12-12 12:19     ` Christoph Heiss
2023-08-16 14:47 ` [pbs-devel] [RFC PATCH proxmox-widget-toolkit v2 15/15] window: ldap auth edit: add case-sensitive checkbox for AD realms Christoph Heiss

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal