前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >gitlab-ce白名单设置杜绝并发数过大引起的封ip故障

gitlab-ce白名单设置杜绝并发数过大引起的封ip故障

作者头像
小小科
修改2019-10-08 18:33:20
1.5K0
修改2019-10-08 18:33:20
举报

gitlab-ce 7.9安装手札以及上篇文章的问题解决

鸣谢

感谢ruby大神===》章鱼的一路指点,才能拨开迷雾见云天!

章鱼大人:

国内Ansible部落原创翻译之一!

资深运维!

ROR大神!

熟读各种源码,精通十八般运维技能!

章鱼大人微博:http://weibo.com/u/2009151365?wvr=5&lf=reg

感谢官方文档!这才是最好的教材

问题描述

每天定时403服务一小时

解决方案

1、修改nginx配置文件,proxy_pass不进行前端访问ip进行后转 【临时解决方案】

2、修改/opt/gitlab/embedded/service/gitlab-rails/config/initializers/1_settings.rb添加白名单 【修改源码的方案】

3、在/etc/gitlab/gitlab.rb中添加白名单 【本文采取方案】

下载

归档页面

https://about.gitlab.com/downloads/archives/

下载7.9版本

wget https://downloads-packages.s3.amazonaws.com/ubuntu-14.04/gitlab_7.9.0-omnibus.2-1_amd64.deb

安装指北

参考官网安装:

https://about.gitlab.com/downloads/#ubuntu1404

http://doc.gitlab.com/ce/install/installation.html

配置文件

修改配置项

打开/etc/gitlab/gitlab.rb,将external_url = 'http://hostname'修改为自己的IP地址:http://xxx.xx.xxx.xx,,然后执行下面的命令,对GitLab进行编译。

sudo gitlab-ctl reconfigure

登录系统

Username: root

Password: 5iveL!fe

关于rack_attack的变迁

https://gitlab.com/gitlab-org/omnibus-gitlab/issues/480

如何设置白名单

参考

https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/files/gitlab-config-template/gitlab.rb.template

查看设置白名单的配置文件

"gitlab-rails": {

"rack_attack_git_basic_auth": {

"enabled": true,

"ip_whitelist": [

"127.0.0.1"

],

"maxretry": 300,

"findtime": 5,

"bantime": 60

},

详细配置过程

root@zhuima:/tmp# grep -C 5 'ip_whitelist' /etc/gitlab/gitlab.rb

# gitlab_rails['rate_limit_requests_per_period'] = 10

# gitlab_rails['rate_limit_period'] = 60

gitlab_rails['rack_attack_git_basic_auth'] = {

'enabled' => true,

'ip_whitelist' => ["127.0.0.1","192.168.101.219"],

'maxretry' => 300,

'findtime' => 5,

'bantime' => 60

}

root@zhuima:/tmp# gitlab-ctl show-config | grep -C 5 ip

the ffi-yajl and yajl-ruby gems have incompatible C libyajl libs and should not be loaded in the same Ruby VM

falling back to ffi which might work (or might not, no promises)

"ci-redis": {

},

"gitlab-rails": {

"rack_attack_git_basic_auth": {

"enabled": true,

"ip_whitelist": [

"127.0.0.1",

"192.168.101.219"

],

"maxretry": 300,

"findtime": 5,

root@zhuima:/tmp#

我想说的

很多时候需要看官方文档才行,要不然会吃亏

另外就是官方文档的配置模板一定要详细查看

gitlab-ce更新相关

https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG

后记

来源链接:http://www.178linux.com/7988

本文系转载,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文系转载前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档