gitlab同步AD中的组

gitlab同步AD中的组,第1张

网上的gitlab集成ad域控的教程基本上陆橡都是只集成了ad中的用户,而依然需要把用户拉到对应群组,查看了gitlab官网的说明是支持group sync的,即把ad的安全组同步旁饥到gitlab的群组,本文在同步用户的基础上进一步同步了组。

前提:已搭建 gitlab-ee (必须是Premium或Ultimate计划)和内部AD域

该实例中把用户创建在Coding组织目录下,用户组创建在Groups组织目录下。

将权限分成guest和developer两种,每个Gitlab中的xx群组所对应的AD用户组名称为xx_guest和xx_developer两个组。(实际使用中根据需求创建早启旁)

配置文件/etc/gitlab/gitlab.rb,在集成LDAP登录的基础上再加上group_base和gitlab_rails['ldap_group_sync_worker_cron']两项。

[root@mq01 ~]# gitlab-ctl reconfigure

[root@mq01 ~]# gitlab-ctl restart

本例子将AD域中的java_guest和java_developer组同步到Java群组中。

新建一个用户Developer01,将其加入到Java_Developer组中。

该新建用户登录到gitlab中,查看“你的群组“中是否自动加入了指定的群组。

如需修改用户权限,如guest修改为developer,直接在AD域中将用户从xx_guest组中删除,加入到xx_developer中即可。

参考文章: https://docs.gitlab.com/ee/administration/auth/ldap/

https://about.gitlab.com/blog/2014/07/10/feature-highlight-ldap-sync/

1,安装gitlab,参考:[ https://www.jianshu.com/p/d3686bc94ac9]

安装完毕配置external_url时把原来的域名改成自己实际的ip地址加上端口号,端口号默认是80,配置最好大于4G内存。

2,可以修改gitlab配置文件,修改默认数据目录和备份文件目录。

3,安让缓袭装配置gitlab-mirrros,参考:[ https://www.jianshu.com/p/70b138f88514]

安装python setup.py install这一步时如果报如下错误:

“error: Setup script exited with error in urllib3 setup command: 'extras_require' must be a dictionary whose values are strings or lists of strings containing valid project/version requirement specifiers.”

那么就需要更新setuptools的版本,首先yum install python-pip,然后pip install --upgrade setuptools,再执行python setup.py install即可正常安装。

4,添加仓库同步配置,这一步如果报如下错误

“Traceback (most recent call last):

File "lib/manage_gitlab_project.py", line 12, in <module>

raise ImportError("python-gitlab module is not installed. You probably didn't read the install instructions closely enough. See docs/prerequisites.md.")

ImportError: python-gitlab module is not installed. You probably didn't read the install instructions closely enough. See docs/prerequisites.md.

There was an unknown issue with manage_gitlab_project.py

那么则按提示安装模块:sudo yum install python-gitlab,然后在添加仓库同步配置即可。

5,同步和备份

编辑vim /etc/crontab

systemctl restart crond

每天夜晚23:50同步所有项目(gitmirror为执行命令的用户名,即为哪稿gitlab-mirrors项目中config.sh中配置的system_user)

50 23 * * * gitmirror sh /home/gitmirror/坦兄gitlab-mirrors/git-mirrors.sh

每天凌晨4:10备份所有项目

10 4 * * * root /opt/gitlab/bin/gitlab-rake gitlab:backup:create CRON=1


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/tougao/12326819.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-24
下一篇 2023-05-24

发表评论

登录后才能评论

评论列表(0条)

保存