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

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

鸣谢

感谢ruby大神===》章鱼的一路指点,才能拨开迷雾见云天!
章鱼大人:
    国内Ansible部落原创翻译之一!
    资深运维!
    ROR大神!
    熟读各种源码,精通十八般运维技能!
    章鱼大人微博:http://weibo.com/u/2009151365?wvr=5&lf=reg
感谢官方文档!这才是最好的教材

下载

归档页面

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

后记

2015年9月5日追马于北京上地

原创文章,作者:追马,如若转载,请注明出处:http://www.178linux.com/7988

(1)
追马追马
上一篇 2015-09-06 20:00
下一篇 2015-09-09 11:06

相关推荐

  • 脚本

    1、写一个脚本,判断当前系统上所有用户的shell是否为可登录shell(即用户的shell不是/sbin/nologin);分别这两类用户的个数;通过字符串比较来实现;     #!/bin/bash     #     sum=0 &n…

    Linux干货 2016-12-23
  • N_28包管理器(rpm)及前端管理工具(yum)

    1、简述rpm与yum命令的常见选项,并举例 rpm–>RPM package manager 是一种用于redhat发行版的打包及安装管理工具,现在成为linux领域包管理器的行业标准,包名以.rpm为后缀。 用法: rpm [options] PACKAGE_FILE 常用选项: -i:安装rmp包 -v:显示安装过程 -vv:更加详细…

    Linux干货 2018-01-01
  • DHCP使用帮助

    bootp 想要通过tcp/ip模型进行网络通信需要有一个ip地址,IP地址是属于操作系统的,所以没有操作系统就没有ip 为了解决这种问题,有一种网卡可以不需要操作系统就能获取到ip bootp:只有第一次是动态获得,以后ip地址就是和mac地址绑定的,不能分配给其他主机 DHCP:DHCP是bootp的改进版,主要引入了租约的定义 DHCP也可以根据mac…

    Linux干货 2016-11-11
  • 网络班第27期第二周作业

    1、 Linux上的文件管理类命令都有哪些,其常用的使用方法及其相关的实例演示。 cp命令:copy 文件à>目录 文件à>文件 目录->文件(报错)           目录->目录 常用选项:     &nbsp…

    2017-07-31
  • linux中数组的定义与使用

            我们常说,程序=指令+数据,往细一点的方向说,指令具体指的有哪些?数据又有哪些? 总结一下: 指令大概包括,编程语言中的语法关键字(如bash编程中的关键字有for,while,case,if,until,continue,break),还包括系统中的命令,和一些自己编写的函数,这些…

    2017-05-23