mirror of
https://github.com/webmin/webmin.git
synced 2026-02-03 14:13:29 +00:00
Merge pull request #1284 from ayoder770/master
LDAP Bind Credentials File Option for ldap-useradmin Webmin Module
This commit is contained in:
@@ -4,6 +4,7 @@ ldap_port=LDAP server port,3,From NSS config file or default
|
||||
ldap_tls=LDAP server uses encryption?,1,1-Yes SSL,2-Yes TLS,0-No
|
||||
login=Bind to LDAP server as,3,Bind name from NSS config file
|
||||
pass=Credentials for bind name above,12
|
||||
ldap_pass_file=Path to LDAP bind credentials file,3
|
||||
user_base=Base for users,3,From NSS config file
|
||||
group_base=Base for groups,3,From NSS config file
|
||||
other_class=Other objectClasses to add to new users,0
|
||||
|
||||
@@ -14,8 +14,8 @@ if ($config{'auth_ldap'}) {
|
||||
else {
|
||||
if ($_[0]) {
|
||||
return 1 if (!$config{'ldap_host'} || !$config{'login'} ||
|
||||
!$config{'pass'} || !$config{'user_base'} ||
|
||||
!$config{'group_base'});
|
||||
( !$config{'pass'} && !$config{'ldap_pass_file'} ) ||
|
||||
!$config{'user_base'} || !$config{'group_base'});
|
||||
}
|
||||
}
|
||||
if ($_[0]) {
|
||||
|
||||
@@ -24,6 +24,7 @@ imap_econn=Failed to connect to IMAP server $1
|
||||
imap_elogin=Failed to login to IMAP server $1 as $2 : $3
|
||||
conn_eldap_host=No LDAP client configuration file was found on your system, so the LDAP server must be set on the Module Config page
|
||||
conn_elogin=No LDAP client configuration file was found on your system, so the LDAP login must be set on the Module Config page
|
||||
conn_efile_open=Could not open the LDAP bind credentials file:
|
||||
|
||||
uedit_cap=User capabilities
|
||||
uedit_samba=Samba login?
|
||||
|
||||
@@ -65,9 +65,24 @@ if (!$cfile || !-r $cfile) {
|
||||
}
|
||||
}
|
||||
|
||||
# If a bind credentials file is defined, read the password from the file
|
||||
# Otherwise, read the password from the "pass" config option
|
||||
my $ldapPassword;
|
||||
if ( $config{'ldap_pass_file'} ){
|
||||
if (open my $fh, "<", $config{'ldap_pass_file'} ){
|
||||
local $/;
|
||||
$ldapPassword = <$fh>;
|
||||
close($fh);
|
||||
} else {
|
||||
&error($text{'conn_efile_open'} . " " . $config{'ldap_pass_file'});
|
||||
}
|
||||
} else {
|
||||
$ldapPassword = $config{'pass'};
|
||||
}
|
||||
|
||||
local $ldap = &ldap_client::generic_ldap_connect(
|
||||
$config{'ldap_host'}, $config{'ldap_port'},
|
||||
$config{'ldap_tls'}, $config{'login'}, $config{'pass'});
|
||||
$config{'ldap_tls'}, $config{'login'}, $ldapPassword);
|
||||
if (ref($ldap)) { return $ldap; }
|
||||
elsif ($_[0]) { return $ldap; }
|
||||
else { &error($ldap); }
|
||||
|
||||
Reference in New Issue
Block a user