您的位置:首页 > 运维架构

[Gitlab运维系列]Gitlab 403 forbidden 并发引起IP被封

2018-05-07 19:38 696 查看

问题

我们公司使用git是自建的,有一天开发人员pull push ,报403问题



原因

Gitlab使用
rack_attack
做了并发访问的限制。

解决方案

将Gitlab的IP设置为白名单即可。
步骤如下:

打开vim
/etc/gitlab/gitlab.rb
文件。

查找
gitlab_rails['rack_attack_git_basic_auth']
关键词。

取消注释

修改
ip_whitelist
白名单属性,加入Gitlab部署的IP地址。
gitlab_rails['rack_attack_git_basic_auth'] = {
'enabled' => true,
'ip_whitelist' => ["192.168.11.157","Gitlab部署的IP地址"],
'maxretry' => 300,
'findtime' => 5,
'bantime' => 60
}


配置好后,执行
gitlab-ctl reconfigure
即可。

git 创建后想要项目地址是域名,那么修改如下配置

vim /opt/gitlab/embedded/service/gitlab-rails/config/gitlab.yml

## GitLab settings
gitlab:
## Web server settings (note: host is the FQDN, do not include http://) host: localhost         >> 这里改为主机的IP 或域名即可
port: 80
https: false

# Uncommment this line below if your ssh host is different from HTTP/HTTPS one
# (you'd obviously need to replace ssh.host_example.com with your own host).
# Otherwise, ssh host will be set to the `host:` value above
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: