jenkins+gitlab+ansible持续集成平台部署(二)

释放双眼,带上耳机,听听看~!

一、jenkins集成openldap认证

进入jenkins系统管理—–>插件管理,安装插件LDAP Plugin

进入系统管理—–>全局安全配置,勾选Enable security,启用安全配置

在Security Realm选择LDAP,点击Advanced Server Configuration,配置LDAP服务器

主要配置如下:


1
2
3
4
5
6
7
8
9
10
11
1#LDAP服务器地址
2Server:ldap://10.10.10.1:56389
3#root DN指搜索的根,并非LDAP服务器的root dn
4root DN:dc=test,dc=com
5#定义登陆的“用户名”对应LDAP中的哪个字段
6User search filter:cn={0}
7#LDAP管理员账号
8Manager DN:cn=root,dc=test,dc=com
9#LDAP管理员密码
10Manager Password:123456
11

 配置完成后点击Test LDAP settings,测试是否成功连接LDAP服务器                                                                                           在弹出的对话框中输入已存在的LDAP用户,然后点击Test,测试是否可以正常登录

jenkins+gitlab+ansible持续集成平台部署(二)如出现Authentication: successful及对应的用户信息,说明配置成功,后面就可以使用LDAP账户登录jenkins。

二、gitlab集成openldap认证

编辑gitlab配置文件gitlab.rb,取消如下注释,并修改配置


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
1gitlab_rails['ldap_enabled'] = true
2gitlab_rails['ldap_servers'] = YAML.load <<-'EOS'
3   main: # 'main' is the GitLab 'provider ID' of this LDAP server
4     label: 'LDAP'
5     host: '10.10.10.1'
6     port: 56389
7     uid: 'cn'
8     bind_dn: 'cn=root,dc=test,dc=com'
9     password: '123456'
10     encryption: 'plain'
11     verify_certificates: true
12     active_directory: false
13     allow_username_or_email_login: false
14     lowercase_usernames: false
15     block_auto_created_users: false
16     base: 'DC=test,DC=com'
17     user_filter: ''
18EOS
19

保存配置,运行gitlab-ctl reconfigure 重新加载配置

进入gitlab关闭用户注册功能,Admin Area—–>Settings—–>General—–>Sign-up restrictions,去掉Sign-up enabled的勾选,然后点击Save Changes保存配置

进入gitlab关闭用户普通登录功能,Admin Area—–>Settings—–>General—–>Sign-in restrictions,去掉Password authentication enabled for web interface的勾选,然后点击Save Changes保存配置 

退出重新登录,可以看到只允许使用LDAP账号登录

jenkins+gitlab+ansible持续集成平台部署(二)

给TA打赏
共{{data.count}}人
人已打赏
安全经验

职场中的那些话那些事

2021-9-24 20:41:29

安全经验

Kafka常用命令

2021-11-28 16:36:11

个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索