在禁用通过authconfig重新启用tls后,openldap tls身份验证工作正常工作

在禁用通过authconfig重新启用tls后,openldap tls身份验证工作正常工作

问题描述:

在我的docker openldap服务器和客户端容器上工作时遇到一个奇怪的问题。要使用tls启用ldap身份验证,我必须先通过authconfig禁用它,然后重新启用。我也禁用了缓存登录。如果我不先禁用TLS和只执行第二个命令,然后登录为SSH不成功在禁用通过authconfig重新启用tls后,openldap tls身份验证工作正常工作

$ docker exec -t datanode1 bash -c 'authconfig --enableldap --enableldapauth --ldapserver="kerbldap.dkdocker.com" \ 
--ldapbasedn="dc=dkdocker,dc=com" --enablesssd --enablesssdauth --enableldaptls --enablemkhomedir --update' 

$ ssh [email protected] -p 2224 
[email protected]'s password: 
Permission denied, please try again. 
[email protected]'s password: 

$ docker exec -t datanode1 bash -c 'authconfig --disableldaptls --update' 

$ docker exec -t datanode1 bash -c 'authconfig --enableldap --enableldapauth --ldapserver="kerbldap.dkdocker.com" \ 
--ldapbasedn="dc=dkdocker,dc=com" --enablesssd --enablesssdauth --enableldaptls --enablemkhomedir --update' 

$ ssh [email protected] -p 2224 
[email protected]'s password: 
Creating home directory for dhiren. 
Last failed login: Thu Sep 21 19:31:42 IST 2017 from gateway on ssh:notty 
There were 4 failed login attempts since the last successful login. 
[[email protected] ~]$ 
docker exec -t clientcontainer1 bash -c 'authconfig --disableldaptls --update' 

下面是我的authconfig --test结果

[[email protected] ~]# authconfig --test 
caching is disabled 
nss_files is always enabled 
nss_compat is disabled 
nss_db is disabled 
nss_hesiod is disabled 
hesiod LHS = "" 
hesiod RHS = "" 
nss_ldap is enabled 
LDAP+TLS is enabled 
LDAP server = "ldap://kerbldap.dkdocker.com/" 
LDAP base DN = "dc=dkdocker,dc=com" 
nss_nis is disabled 
NIS server = "" 
NIS domain = "" 
nss_nisplus is disabled 
nss_winbind is disabled 
SMB workgroup = "SAMBA" 
SMB servers = "" 
SMB security = "user" 
SMB realm = "" 
Winbind template shell = "/bin/false" 
SMB idmap range = "16777216-33554431" 
nss_sss is enabled by default 
nss_wins is disabled 
nss_mdns4_minimal is disabled 
myhostname is enabled 
DNS preference over NSS or WINS is disabled 
pam_unix is always enabled 
shadow passwords are enabled 
password hashing algorithm is sha512 
pam_krb5 is disabled 
krb5 realm = "DKDOCKER.COM" 
krb5 realm via dns is disabled 
krb5 kdc = "kerbldap.dkdocker.com" 
krb5 kdc via dns is disabled 
krb5 admin server = "kerbldap.dkdocker.com" 
pam_ldap is enabled 
LDAP+TLS is enabled 
LDAP server = "ldap://kerbldap.dkdocker.com/" 
LDAP base DN = "dc=dkdocker,dc=com" 
LDAP schema = "rfc2307" 
pam_pkcs11 is disabled 
SSSD smartcard support is disabled 
use only smartcard for login is disabled 
smartcard module = "" 
smartcard removal action = "" 
pam_fprintd is disabled 
pam_ecryptfs is disabled 
pam_winbind is disabled 
SMB workgroup = "SAMBA" 
SMB servers = "" 
SMB security = "user" 
SMB realm = "" 
pam_sss is enabled by default 
credential caching in SSSD is enabled 
SSSD use instead of legacy services if possible is enabled 
IPAv2 is disabled 
IPAv2 domain was not joined 
IPAv2 server = "" 
IPAv2 realm = "" 
IPAv2 domain = "" 
pam_pwquality is enabled (try_first_pass local_users_only retry=3 authtok_type=) 
pam_passwdqc is disabled() 
pam_access is disabled() 
pam_faillock is disabled (deny=4 unlock_time=1200) 
pam_mkhomedir or pam_oddjob_mkhomedir is enabled (umask=0077) 
Always authorize local users is enabled() 
    --ldapbasedn="dc=dkdocker,dc=com" --enablesssd --enablesssdauth --enableldaptls --enablemkhomedir --update' 

的问题是由缺少符号链接到我的CA引起的/ etc/openldap/cacert目录下的.cert。

LDAP Authentication Requirements