LDAP Rake tasks
LDAP Rake tasks
以下是与 LDAP 相关的 Rake 任务.
LDAP 检查 Rake 任务将测试和password
凭据(如果已配置),并将列出 LDAP 用户的样本. 此任务也作为gitlab:check
任务的一部分执行,但可以使用以下命令独立运行.
全部安装
源安装
sudo -u git -H bundle exec rake gitlab:ldap:check RAILS_ENV=production
默认情况下,该任务将返回 100 个 LDAP 用户的样本. 通过将数字传递给检查任务来更改此限制:
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.
全部安装
sudo gitlab-rake gitlab:ldap:group_sync
源安装
如果您在gitlab.yml
或gitlab.rb
更改 LDAP 服务器 ID,则将需要更新所有用户身份,否则用户将无法登录.输入新旧提供者,此任务将更新数据库中所有匹配的身份.
old_provider
和new_provider
是从前缀ldap
加上配置文件中的 LDAP 服务器 ID 派生的. 例如,在gitlab.yml
或gitlab.rb
您可能会看到 LDAP 配置,如下所示:
main:
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
考虑从默认服务器 ID main
(完整提供程序ldapmain
)开始. 如果将main
更改为 ,则new_provider
为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_provider
和new_provider
,则会提示您输入它们:
全部安装
sudo gitlab-rake gitlab:ldap:rename_provider
源安装
bundle exec rake gitlab:ldap:rename_provider RAILS_ENV=production
输出示例:
此任务还接受force
环境变量,该变量将跳过确认对话框: