LDAP Rake tasks

原文:https://docs.gitlab.com/ee/administration/raketasks/ldap.html

LDAP Rake tasks

以下是与 LDAP 相关的 Rake 任务.

Check

LDAP 检查 Rake 任务将测试bind_dnpassword凭据(如果已配置),并将列出 LDAP 用户的样本. 此任务也作为gitlab:check任务的一部分执行,但可以使用以下命令独立运行.

全部安装

sudo gitlab-rake gitlab:ldap:check 

源安装

sudo -u git -H bundle exec rake gitlab:ldap:check RAILS_ENV=production 

默认情况下,该任务将返回 100 个 LDAP 用户的样本. 通过将数字传递给检查任务来更改此限制:

rake gitlab:ldap:check[50] 

Run a group sync

Introduced in GitLab Starter 12.2.

The following task will run a group sync immediately. This is valuable when you’d like to update all configured group memberships against LDAP without waiting for the next scheduled group sync to be run.

注意:如果您想更改执行群组同步的频率,请改为调整 Cron 时间表 .

全部安装

sudo gitlab-rake gitlab:ldap:group_sync 

源安装

bundle exec rake gitlab:ldap:group_sync 

Rename a provider

如果您在gitlab.ymlgitlab.rb更改 LDAP 服务器 ID,则将需要更新所有用户身份,否则用户将无法登录.输入新旧提供者,此任务将更新数据库中所有匹配的身份.

old_providernew_provider是从前缀ldap加上配置文件中的 LDAP 服务器 ID 派生的. 例如,在gitlab.ymlgitlab.rb您可能会看到 LDAP 配置,如下所示:

main:
  label: 'LDAP'
  host: '_your_ldap_server'
  port: 389
  uid: 'sAMAccountName'
  ... 

main是 LDAP 服务器 ID. 唯一的提供者在一起就是ldapmain .

警告 :如果输入了错误的新提供程序,用户将无法登录.如果发生这种情况,请使用错误的提供程序作为old_provider并使用正确的提供程序作为new_provider再次运行任务.

全部安装

sudo gitlab-rake gitlab:ldap:rename_provider[old_provider,new_provider] 

源安装

bundle exec rake gitlab:ldap:rename_provider[old_provider,new_provider] RAILS_ENV=production 

Example

考虑从默认服务器 ID main (完整提供程序ldapmain )开始. 如果将main更改为mycompany ,则new_providerldapmycompany . 要重命名所有用户身份,请运行以下命令:

sudo gitlab-rake gitlab:ldap:rename_provider[ldapmain,ldapmycompany] 

输出示例:

100 users with provider 'ldapmain' will be updated to 'ldapmycompany'.
If the new provider is incorrect, users will be unable to sign in.
Do you want to continue (yes/no)? yes

User identities were successfully updated 

Other options

如果您未指定old_providernew_provider ,则会提示您输入它们:

全部安装

sudo gitlab-rake gitlab:ldap:rename_provider 

源安装

bundle exec rake gitlab:ldap:rename_provider RAILS_ENV=production 

输出示例:

What is the old provider? Ex. 'ldapmain': ldapmain
What is the new provider? Ex. 'ldapcustom': ldapmycompany 

此任务还接受force环境变量,该变量将跳过确认对话框:

sudo gitlab-rake gitlab:ldap:rename_provider[old_provider,new_provider] force=yes 
Copyright © 温玉 2021 | 浙ICP备2020032454号 all right reserved,powered by Gitbook该文件修订时间: 2021-03-27 13:48:25

results matching ""

    No results matching ""