LDAP
(Lightweight Directory Access Protocol):輕量級目錄訪問協議。跟數據庫同樣均可以存放數據,可是跟數據庫中存儲形式不一樣,LDAP中的數據是以樹形結構
組織的。以下圖:html
DIT ----------------- |dc=grouk,dc=com| ----------------- |可多個ou ---------- |ou=users| ... ---------- | ----------------------------- | | | ----------- ----------- ----------- |uid=user1| |uid=user2| |uid=user3| ----------- ----------- -----------
Entry: DIT中最小的組織單元,相似關係數據表的一條記錄。每一個entry的具體信息都以多個鍵值對的形式存儲在entry中。這個鍵值對至關於關係數據表的字段與值。數據庫
每一個entry有個惟一標示屬性:dn。例如uid=user1
節點的dn=uid=user1,ou=users,dc=grouk,dc=com
。apache
每一個entry必須至少包含一個objectClass屬性
,每種objectClass都規定了此objectClass必須包含
哪些屬性以及能夠包含
哪些屬性。以下圖:dom
例如 objectClass=person:工具
查詢entry爲uid=user2的詳細信息:ui
ldapsearch -h localhost -p 10389 -D "uid=user2,ou=users,dc=groukTest,dc=com" -w "user2" -b "dc=groukTest,dc=com" -s sub "(cn=user1)" + # extended LDIF # # LDAPv3 # base <dc=groukTest,dc=com> with scope subtree # filter: (cn=user1) # requesting: + # # user1, testUser, groukTest.com dn: uid=user1,ou=testUser,dc=groukTest,dc=com entryCSN: 20151207101413.644000Z#000000#001#000000 creatorsName: 0.9.2342.19200300.100.1.1=admin,2.5.4.11=system modifyTimestamp: 20151203081101.820Z entryDN: uid=user1,ou=testUser,dc=groukTest,dc=com modifiersName: 0.9.2342.19200300.100.1.1=admin,2.5.4.11=system entryUUID: c62b65ef-52fc-444b-be2d-2d3b7d04acdf createTimestamp: 20151203044532.269Z pwdFailureTime: 20151207101351.817Z pwdFailureTime: 20151207101413.644Z entryParentId: 8012db2c-73cd-4c8f-830b-7229e948dd28 # search result search: 2 result: 0 Success # numResponses: 2 # numEntries: 1
ApacheDS默認啓用密碼策略,建議修改DN: ads-pwdid=default,ou=passwordPolicies,ads-interceptorId=authenticationInterceptor,ou=interceptors,ads-directoryserviceid=default,ou=config
的ads-pwdlockoutduration屬性值爲非0。默認爲0,即用戶連續輸錯指定次數密碼後,此用戶被永久禁用。this
pwdLockoutDuration
: this attribute holds the number of seconds that the password cannot be used to authenticate due to too many failed bind attempts. If this attribute is not present, or if the value is 0 the password cannot be used to authenticate until reset by a password administrator.命令行
用戶輸錯必定次數的密碼後,用戶被永久禁用。在網上搜了下沒有找到解決辦法,後來看到了這個文檔:Password Policy for LDAP Directories draft-behera-ldap-password-policy-10.txt 中pwdAccountLockedTime
和pwdLockoutDuration
兩個屬性的說明得以解決。code
解決方法:server
DN: ads-pwdid=default,ou=passwordPolicies,ads-interceptorId=authenticationInterceptor,ou=interceptors,ads-directoryserviceid=default,ou=config
的ads-pwdlockoutduration屬性值爲非0,防止連續輸錯指定次數密碼後被永久禁用