use base qw(PVE::SectionConfig);
+PVE::JSONSchema::register_format('ldap-simple-attr', \&verify_ldap_simple_attr);
+sub verify_ldap_simple_attr {
+ my ($attr, $noerr) = @_;
+
+ if ($attr =~ m/^[a-zA-Z0-9]+$/) {
+ return $attr;
+ }
+
+ die "value '$attr' does not look like a simple ldap attribute name\n" if !$noerr;
+
+ return undef;
+}
+
my $inotify_file_id = 'pmg-ldap.conf';
my $config_filename = '/etc/pmg/ldap.conf';
},
};
+
sub properties {
return {
disable => {
maxLength => 4096,
},
mode => {
- description => "LDAP protocol mode ('ldap' or 'ldaps').",
+ description => "LDAP protocol mode ('ldap', 'ldaps' or 'ldap+starttls').",
type => 'string',
- enum => ['ldap', 'ldaps'],
+ enum => ['ldap', 'ldaps', 'ldap+starttls'],
default => 'ldap',
},
+ verify => {
+ description => "Verify server certificate. Only useful with ldaps or ldap+starttls.",
+ type => 'boolean',
+ default => 0,
+ optional => 1,
+ },
+ cafile => {
+ description => "Path to CA file. Only useful with option 'verify'",
+ type => 'string',
+ optional => 1,
+ },
server1 => {
description => "Server address.",
type => 'string', format => 'address',
},
accountattr => {
description => "Account attribute name name.",
- type => 'string', format => 'string-list',
- pattern => '[a-zA-Z0-9]+',
+ type => 'string', format => 'ldap-simple-attr-list',
default => 'sAMAccountName, uid',
},
mailattr => {
description => "List of mail attribute names.",
- type => 'string', format => 'string-list',
- pattern => '[a-zA-Z0-9]+',
- default => "mail, userPrincipalName, proxyAddresses, othermailbox",
+ type => 'string', format => 'ldap-simple-attr-list',
+ default => "mail, userPrincipalName, proxyAddresses, othermailbox, mailAlternativeAddress",
},
groupclass => {
description => "List of objectclasses for groups.",
- type => 'string', format => 'string-list',
+ type => 'string', format => 'ldap-simple-attr-list',
default => "group, univentionGroup, ipausergroup",
},
};
accountattr => { optional => 1 },
mailattr => { optional => 1 },
groupclass => { optional => 1 },
+ verify => { optional => 1 },
+ cafile => { optional => 1 },
};
}