Skip to content
GitLab
菜单
为什么选择 GitLab
定价
联系销售
探索
为什么选择 GitLab
定价
联系销售
探索
登录
获取免费试用
主导航
搜索或转到…
项目
GitLab
管理
动态
成员
标记
计划
议题
议题看板
里程碑
迭代
需求
代码
合并请求
仓库
分支
提交
标签
仓库图
比较修订版本
代码片段
锁定的文件
构建
流水线
作业
流水线计划
测试用例
产物
部署
发布
Package registry
Container registry
模型注册表
运维
环境
Terraform 模块
监控
事件
服务台
分析
价值流分析
贡献者分析
CI/CD 分析
仓库分析
代码评审分析
议题分析
洞察
模型实验
效能分析
帮助
帮助
支持
GitLab 文档
比较 GitLab 各版本
社区论坛
为极狐GitLab 提交贡献
提交反馈
隐私声明
快捷键
?
新增功能
4
代码片段
群组
项目
显示更多面包屑
gitlab-cn
GitLab
提交
3ce36e26
提交
3ce36e26
编辑于
5 years ago
作者:
Jacob Vosmaer
提交者:
Achilleas Pipinellis
5 years ago
浏览文件
操作
下载
补丁
差异文件
Documentation for rotating gitaly tokens
上级
e8629941
No related branches found
No related tags found
无相关合并请求
变更
1
隐藏空白变更内容
行内
左右并排
显示
1 个更改的文件
doc/administration/gitaly/index.md
+103
-0
103 个添加, 0 个删除
doc/administration/gitaly/index.md
有
103 个添加
和
0 个删除
doc/administration/gitaly/index.md
+
103
−
0
浏览文件 @
3ce36e26
...
...
@@ -564,6 +564,109 @@ concurrency limiter, not a rate limiter. If a client makes 1000 requests
in a row in a very short timespan, the concurrency will not exceed 1,
and this mechanism (the concurrency limiter) will do nothing.
## Rotating a Gitaly authentication token
Rotating credentials in a production environment often either requires
downtime, or causes outages, or both. If you are careful, though, you
*can*
rotate Gitaly credentials without a service interruption.
This procedure also works if you are running GitLab on a single server.
In that case, "Gitaly servers" and "Gitaly clients" refers to the same
machine.
### 1. Monitor current authentication behavior
Use prometheus to see what the current authentication behavior of your
GitLab installation is.
```
sum(rate(gitaly_authentications_total[5m])) by (enforced, status)
```
In a system where authentication is configured correctly, and where you
have live traffic, you will see something like this:
```
{enforced="true",status="ok"} 4424.985419441742
```
There may also be other numbers with rate 0. We only care about the
non-zero numbers.
The only non-zero number should have
`enforced="true",status="ok"`
. If
you have other non-zero numbers, something is wrong in your
configuration.
The 'status="ok"' number reflects your current request rate. In the example
above, Gitaly is handling about 4000 requests per second.
Now you have established that you can monitor the Gitaly authentication
behavior of your GitLab installation.
### 2. Reconfigure all Gitaly servers to be in "auth transitioning" mode
The second step is to temporarily disable authentication on the Gitaly servers.
```
ruby
# in /etc/gitlab/gitlab.rb
gitaly
[
'auth_transitioning'
]
=
true
```
After you have applied this, your prometheus query should return
something like this:
```
{enforced="false",status="would be ok"} 4424.985419441742
```
Because
`enforced="false"`
, it will be safe to start rolling out the new
token.
### 3. Update Gitaly token on all clients and servers
```
ruby
# in /etc/gitlab/gitlab.rb
gitaly
[
'auth_token'
]
=
'my new secret token'
```
Remember to apply this on both your Gitaly clients
*and*
servers. If you
check your prometheus query while this change is being rolled out, you
will see non-zero values for the
`enforced="false",status="denied"`
counter.
### 4. Use prometheus to ensure there are no authentication failures
After you applied the Gitaly token change everywhere, and all services
involved have been restarted, you should will temporarily see a mix of
`status="would be ok"`
and
`status="denied"`
.
After the new token has been picked up by all Gitaly clients and
servers, the
**only non-zero rate**
should be
`enforced="false",status="would be ok"`
.
### 5. Disable "auth transitioning" Mode
Now we turn off the 'auth transitioning' mode. These final steps are
important: without them, you have
**no authentication**
.
Update the configuration on your Gitaly servers:
```
ruby
# in /etc/gitlab/gitlab.rb
gitaly
[
'auth_transitioning'
]
=
false
```
### 6. Verify that authentication is enforced again
Refresh your prometheus query. You should now see the same kind of
result as you did in the beginning:
```
{enforced="true",status="ok"} 4424.985419441742
```
Note that
`enforced="true"`
, meaning that authentication is being enforced.
## Troubleshooting Gitaly
### `gitaly-debug`
...
...
此差异已折叠。
点击以展开。
预览
0%
加载中
请重试
或
添加新附件
.
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
保存评论
取消
想要评论请
注册
或
登录