Commit Graph

41 Commits

Author SHA1 Message Date
Wolfgang Bumiller
01f191c8c4 fix #1670: change PAM service name to project specific name
Instead of 'common-auth' use 'proxmox-ve-auth', this way
users can override PAM authentication settings via
`/etc/pam.d/proxmox-ve-auth`.

If the file does not exist, pam will use `/etc/pam.d/other`
which by default behaves like `common-auth`.

Note that this *can* be different from directly using
`common-auth` *if* a user has actually modified
`/etc/pam.d/other` for some reason.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-11-20 14:51:29 +01: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
Dominik Csapak
de8c5e6ceb LDAP: skip anonymous bind when clientcert/key is given
It seems that servers associate the client-cert/key with an account, so
doing an explicit anonymous bind then 'logs out' the already verified
user, limiting the search results in some cases

before refactoring to PVE::LDAP, we did not do '$ldap->bind' at all when
there was no bind_dn, but it is not really clear if Net::LDAP does this
automatically when searching (other libraries do this), so leave the
anonymous bind (for compatibility with PMG) but skip it when a client
certificate and key is given.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2020-05-08 13:35:18 +02:00
Thomas Lamprecht
eeabad5a13 ldap_delete_credentials: don't complain if already deleted
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-05-08 09:38:34 +02:00
Dominik Csapak
72a9742b94 auth ldap/ad: introduce connection 'mode'
instead of having only a 'secure' flag which switches between
ldap/ldaps we now have a mode which also contains 'ldap+starttls'

our connection code in PVE::LDAP can handle this already (used in pmg)
so that is no problem

if we want to really remove the 'secure' flag, e.g. in 7.0
we'd either have to rewrite the config or have it as an error
in a pve6to7 script

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2020-04-25 18:31:35 +02:00
Dominik Csapak
782b702dbb auth ldap/ad: make password a parameter for the api
Allows us to add it in the gui, until now the admin needed to create
the file themself.

Mirrored after credential handling from CIFS and PBS in their
pve-storage plugins

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
[Thomas: don't differ from storage one unnecessarily, keep comments
 and behavior]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-04-18 18:48:28 +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
Dominik Csapak
0ae051a4d6 auth ad: add sync-defaults-options
this was missing for AD realms

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2020-04-06 13:52:55 +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
Dominik Csapak
e65b53c6a9 Auth/AD: make PVE::Auth::AD a subclass of PVE::Auth::LDAP
this makes it much easier to reuse the sync code from LDAP in AD.
The 'authenticate_user' sub is still the same, but we now
can still use the get_users and get_groups functionality of LDAP

in the case of AD, the user_attr is optional in the config
(would have been a breaking change) but we set it
to default to 'sAMAccountName'

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2020-03-21 15:44:46 +01:00
Dominik Csapak
2c6e956e0a Auth/LDAP: add get_{users, groups} subs for syncing
this adds the subs which actually query the LDAP for users/groups
and returns the value in format which makes it easy to insert
in our parsed user.cfg

when we find a user/groupname which cannot be in our config,
we warn the verification error

for groups, we append "-$realm" to the groupname, to lower the chance of
accidental overwriting of existing groups (this will be documented
in the api call since it technically does not prevent overwriting, just
makes it more unlikely)

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2020-03-21 15:44:46 +01:00
Dominik Csapak
eba326d2df Auth/LDAP: add necessary options for syncing
for syncing users/groups from ldap, we need some more options
so that the users can adapt it to their LDAP setup, which are very
different accross systems.

sensible defaults are documented

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-03-21 15:44:22 +01:00
Dominik Csapak
30aad01788 Auth/LDAP: refactor out 'connect_and_bind'
we will use this not only for authentication but also for
getting users/groups from LDAP

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2020-03-07 19:50:22 +01:00
Dominik Csapak
d9e93d2eca use PVE::LDAP module instead of useing Net::LDAP directly
for things like connecting/binding/etc.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2020-03-07 19:50:22 +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
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
Wolfgang Bumiller
9401be39cb use a property string for tfa config
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-04-03 08:04:00 +02: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
Dominik Csapak
f4e7fc7bab fix #1612: give authenticate_user_ldap the realm on second server
this was missing and lead to 'use of unitialized value $realm...'
and a not working second server if a bindpw was defined

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Reviewed-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2018-01-11 11:39:08 +01:00
Philip Abernethy
0a6e09fd47 Whitespace fixes
Reviewed-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2017-09-22 08:38:50 +02:00
Philip Abernethy
5654af83fa Remove unused Dumper uses
Reviewed-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2017-09-22 08:38:48 +02:00
Dominik Csapak
8bdbfd4ddf fix trailing whitespace
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2017-08-08 11:46:10 +02:00
Dominik Csapak
23e0cf85fd fix #1470: ad: server and client certificate support
as with ldap we now accept
the verify, capath, cert and certkey parameters for active directory

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2017-08-08 11:46:10 +02:00
Wolfgang Bumiller
e03c2aef17 ldap: server and client certificate support
This adds 4 more options to the ldap authentication method:

verify: boolean
  If enabled, the server certificate must be valid

capath: path to a file or directory
  The CA to use to verify the server certificate. Used only
  if 'verify' is true.

cert: path to a certificate
  Used as client certificate when connecting to a server,
  provided 'secure' is true. Requires 'certkey' to be set.

certkey: path to the certificate's key
  Required only used when 'cert' is used.
2017-08-08 11:46:10 +02:00
Dietmar Maurer
3641833bc0 PVE/Auth/PVE.pm: encode uft8 password before calling crypt 2017-05-02 10:37:20 +02:00
Dietmar Maurer
63358f40b3 use new PVE::Tools::encrypt_pw, bump version to 5.0-3 2017-03-30 17:54:38 +02:00
Dietmar Maurer
54028297ea encrypt_pw: avoid '+' for crypt salt
And make salt less predictable.
2017-03-30 08:53:12 +02:00
Wolfgang Bumiller
b5040b42f1 Close #833: ldap: non-anonymous bind support
The password will be read from /etc/pve/priv/ldap/$realm.pw
2016-08-05 10:59:14 +02:00
Fabian Grünbichler
8978ab373c Fix uninitialized warning
when shadow.cfg does not exist, parsing should return an
empty hash instead of displaying a warning
2016-04-01 07:10:23 +02:00
Wolfgang Bumiller
8b600c4d27 Auth::LDAP, Auth::AD: ipv6 support
Also had to change server1/server2 schema from a pattern to
the 'address' format.
2015-12-03 12:08:56 +01:00
Wolfgang Bumiller
62af314a96 improve parse_user_config, parse_shadow_config
same as in pve-common: replace substituting line parsing
with /gm modified match regexps.
2015-07-22 08:10:49 +02:00
Dietmar Maurer
86cd805b63 add step/digits option to oath configuration 2014-07-23 06:59:01 +02:00
Dietmar Maurer
30be0de97a allow to write builtin auth domains
So that we can set tfa, comment, default with the GUI.
2014-07-18 11:30:19 +02:00
Dietmar Maurer
1abc2c0aee add oath two factor auth, bump version to 3.0-14 2014-07-17 14:04:13 +02:00
Dietmar Maurer
96f8ebd625 add basic support for two factor auth 2014-06-23 11:42:44 +02:00
Dietmar Maurer
11a9043610 use correct connection string for AD auth (use encryption and port info). 2014-05-22 07:12:25 +02:00
Dietmar Maurer
7c410d6301 use warnings instead of global -w flag 2013-10-01 13:04:53 +02:00
Dietmar Maurer
5bb4e06a64 new plugin architecture for Auth modules 2012-05-22 10:43:30 +02:00