LDAP Rake tasks

LDAP Rake tasks

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

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

全部安装

源安装

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

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

  1. rake gitlab:ldap:check[50]

Introduced in 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.

全部安装

  1. sudo gitlab-rake gitlab:ldap:group_sync

源安装

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

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

  1. main:
  2. host: '_your_ldap_server'
  3. port: 389
  4. uid: 'sAMAccountName'

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

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

全部安装

  1. sudo gitlab-rake gitlab:ldap:rename_provider[old_provider,new_provider]
  1. bundle exec rake gitlab:ldap:rename_provider[old_provider,new_provider] RAILS_ENV=production

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

输出示例:

  1. 100 users with provider 'ldapmain' will be updated to 'ldapmycompany'.
  2. If the new provider is incorrect, users will be unable to sign in.
  3. Do you want to continue (yes/no)? yes
  4. User identities were successfully updated

Other options

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

全部安装

  1. sudo gitlab-rake gitlab:ldap:rename_provider

源安装

  1. bundle exec rake gitlab:ldap:rename_provider RAILS_ENV=production

输出示例:

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