GitLab 內鍵是有帳號密碼作管理,不過也可以使用 AD 裡的帳號使用

整合 LDAP

編輯 /etc/gitlab/gitlab.rb

 gitlab_rails['ldap_enabled'] = true
 gitlab_rails['ldap_servers'] = YAML.load <<-'EOS' # remember to close this block with 'EOS' below
   main: # 'main' is the GitLab 'provider ID' of this LDAP server
     label: 'LDAP'
     host: 'ad.ssorc.local'
     port: 389
     uid: 'sAMAccountName'
     method: 'tls' # "tls" or "ssl" or "plain"
     bind_dn: 'ssorc_user'                    # AD 管理者帳戶
     password: 'ssorc_pass                    # AD 管理者密碼
     active_directory: true
     allow_username_or_email_login: true      # 可以讓使用者使用 名稱 或 email 帳號登入

     block_auto_created_users: false          # 如果 true ,就會讓第一次登入的
                                              # 使用者看到 Your account is blocked. 
                                              # Retry when an admin has unblocked it.
                                              # 它需要管理者解除才行
     base: 'DC=SSORC,DC=LOCAL'
     user_filter: ''
EOS

reload

gitlab-ctl reconfigure

驗證,如果成功就會看到一堆帳號訊息 (AD 帳號的)

gitlab-rake gitlab:ldap:check RAILS_ENV=production

成功訊息

Checking LDAP ...

Server: ldapmain
LDAP authentication... Success
LDAP users with access to your GitLab server (only showing the first 100 results)
	(省略)
	DN: cn=cross,ou=wos,ou=ssorc,dc=ssorc,dc=local	 sAMAccountName: cross
	(省略)

Checking LDAP ... Finished
Related posts 相關文章
GitLab 17.7 使用 openssl 3 與 tls 1.2
More...
記得把網站下的 .git 目錄封鎖,不然會被看到
More...
gitlab-ce 升級到 17.0.0 後續
More...
gitlab-ce 升級到 17.0.0 就壞掉了
More...

作者

留言

Allen.Liu 

Hi 版大您好! 我的 gitlab ee 版本 11.2.3 ldap server: Open LDAP ldap 設定完之後進行檢查動作,沒有顯示我 ldap 的 account 但檢查結果是成功的,貌似沒有撈到 ldap 資料。 檢查結果如下: $ gitlab-rake gitlab:ldap:check RAILS_ENV=production ========================================================================== Checking LDAP … Server: ldapmain not verifying SSL hostname of LDAPS server ‘10.6.75.10:636’ LDAP authentication… Success LDAP users with access to your GitLab server (only showing the first 100 results) Checking LDAP … Finished ========================================================================== LDAP gitlab.rb 設定: ========================================================================== gitlab_rails[‘ldap_enabled’] = true gitlab_rails[‘ldap_servers’] = YAML.load <<

    作者

    我沒測過 openldap,我是用 windows AD,上面我也貼上成功的訊息, 或許你可以朝先決解是否可以成功取得帳號的資訊出來,參考類似 https://ssorc.tw/198 裡的測試連線。 也要留意 bind_dn 跟 password 是給 gitlab 可以跟 ldap (AD) 溝通的帳密 (建在 ldap 上的)。

撰寫回覆或留言

發佈留言必須填寫的電子郵件地址不會公開。