技術討論區 > Windows 討論版
Git 如何與AD整合?
(1/1)
b7307024:
我參考這篇文章,初步將Git Server架設起來
http://wernbin.pixnet.net/blog/post/45716002-windows%E6%9E%B6git-server%E7%9A%84%E5%AE%89%E8%A3%9D%E6%B5%81%E7%A8%8B%E7%B4%80%E9%8C%84
其中 "為目錄http://ip_addr/git增加權限"
htpasswd -cmb /C/Kelvin/GitRepos/htpasswd root calvin
不管怎麼試,就是會跳出 htpasswd: command not found
最後用命令提示字元,再次嘗試才產生出htpasswd檔案,
測試可以正常Clone、Sync及Commit,所以算是成功架設完成。
現在要嘗試將認證整合AD,參考了這篇
https://beginor.github.io/2013/03/01/config-apache-git-server-on-windows.html
但不管怎麼試都不能成功認證,上網找apache ldap設定也搞不出來,我的設定內容如下:
--- 代碼: ---<Location /git/>
AuthType Basic
AuthName "Git Repository"
AuthBasicProvider ldap
AuthLDAPURL "ldap://xxx.com:389/OU=yahoo,DC=yahoo,DC=com?cn?sub?(objectClass=*)"
AuthzLDAPAuthoritative on
AuthLDAPBindDN "xxx@yahoo.com"
AuthLDAPBindPassword 123456
AuthLDAPGroupAttributeIsDN on
AuthLDAPGroupAttribute member
Require valid-user
</Location>
--- 程式碼結尾 ---
請問是哪裡有錯誤嗎?感激不盡。
twu2:
你確定你的 DN 是對的? 正常來說 DN 不會是 email 那個格式.
我們用的是類似這樣的設定.
--- 代碼: --- <Location />
AuthName "GIT: Enter AD Username/Password"
AuthType Basic
AuthBasicProvider ldap
AuthLDAPBindDN "CN=git,CN=Users,DC=domain,DC=xxx,DC=org,DC=tw"
AuthLDAPBindPassword "password"
AuthLDAPURL "ldap://ad.domain.xxx.org.tw:3268/DC=domain,DC=xxx,DC=org,DC=tw?sAMAccountName?sub?(objectClass=*)"
#AuthLDAPMaxSubGroupDepth 10
#AuthLDAPSubgroupAttribute member
AuthLDAPSubGroupClass group
#AuthLDAPGroupAttribute member
AuthLDAPGroupAttributeIsDN on
require ldap-group CN=DEPT_xxx,DC=domain,DC=xxx,DC=org,DC=tw
ErrorDocument 401 "Please use AD username and password to login GIT."
</Location>
--- 程式碼結尾 ---
b7307024:
回報twu2大,我參考了你的代碼後修改我的代碼,測試還是不能正常啟動apache.
--- 代碼: ---<Location /git/>
AuthName "Git Repository"
AuthType Basic
AuthBasicProvider ldap
AuthLDAPBindDN "CN=Administrator,DC=xxxxxx,DC=com"
AuthLDAPBindPassword "123456"
AuthLDAPURL "ldap://xxxx.xxxxx.com:389/DC=xxxxx,DC=com?sAMAccountName?sub?(objectClass=*)"
AuthzLDAPAuthoritative on
AuthLDAPSubGroupClass group
AuthLDAPGroupAttributeIsDN on
Require valid-group CN=mis_group,DC=xxxxxx,DC=com
ErrorDocument 401 "Please use AD username and password to login GIT."
</Location>
--- 程式碼結尾 ---
DC=xxxxxx是打網域名稱,如:yahoo
AuthLDAPBindDN "CN=Administrator,DC=xxxxxx,DC=com" 此處CN我是使用網域管理帳號Administrator
AuthLDAPURL "ldap://xxxx.xxxxx.com:389/DC=xxxxx,DC=com?sAMAccountName?sub?(objectClass=*)" xxxx.xxxxx.com:389 是主機名稱.網域名稱,如:test.yahoo.com
啟動apache的錯誤訊息如下:
twu2:
那個 port 3268 不是隨便一個 port... 改成 ldap 的標準 port 389 是不能用在 Windows AD 上頭的.
https://httpd.apache.org/docs/trunk/mod/mod_authnz_ldap.html#activedirectory
netman:
有沒有考慮用 GitLab 呢?
https://www.caseylabs.com/setup-gitlab-ce-with-active-directory-authentication/
https://blog.yowko.com/2017/05/jenkins-2-ssh-ad-ldap-git-server.html?m=1
導覽
[0] 文章列表
前往完整版本