如何在 Gitlab 中找出给定推送事件的 IP 地址 [英] How to find out IP address of a given push event in Gitlab

查看:80
本文介绍了如何在 Gitlab 中找出给定推送事件的 IP 地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Gitlab 中模拟其他用户非常容易.请参阅这个主题了解更多详情.

It's quite easy to impersonate another user in Gitlab. See this topic for more details.

可以通过检查存储库的活动"日志来找出哪个用户执行了推送.但出于审计目的,我还想知道完成推送的 IP 地址.在 Gitlab CE/EE 中可以吗?

It's possible to find out which user performed a push by examining "Activity" log of a repository. But for audit purposes I'd also like to know the IP address from which the push was done. Is it possible in Gitlab CE/EE?

推荐答案

通过 HTTP(S) 完成的推送

可以查看nginx的访问日志(nginx/gitlab_access.log):

You can examine access logs of nginx (nginx/gitlab_access.log):

192.168.21.150 - johndoe [19/Dec/2016:08:05:58 +0100] "POST/TEST/test.git/git-receive-pack HTTP/1.1" 200 52 "-" "git/2.9.2.windows.1

192.168.21.150 - johndoe [19/Dec/2016:08:05:58 +0100] "POST /TEST/test.git/git-receive-pack HTTP/1.1" 200 52 "-" "git/2.9.2.windows.1

通过 SSH 完成的推送

您可以检查 gitlab-shell 日志 (gitlab-shell/gitlab-shell.log).这样你就可以找到推送的时间:

You can examine gitlab-shell logs (gitlab-shell/gitlab-shell.log). That way you can find the time of a push:

I, [2016-12-19T07:34:08.173561 #3560] INFO -- : gitlab-shell: 使用 key-417 为用户执行 git 命令.

I, [2016-12-19T07:34:08.173561 #3560] INFO -- : gitlab-shell: executing git command for user with key key-417.

然后您可以检查标准 SSH 日志以查找 IP 地址:/var/log/auth.log/var/log/secure:

Then you can examine standard SSH logs to find the IP address: /var/log/auth.log or /var/log/secure:

12 月 19 日 07:34:08 gitlab-hostname sshd[3563]:接受来自 192.168.21.151 端口 40864 ssh2 的 git 公钥:RSA 32:ea:2d:e2:47:ac:fc:560:84:11:e2:16:57:b0:5c:2d

Dec 19 07:34:08 gitlab-hostname sshd[3563]: Accepted publickey for git from 192.168.21.151 port 40864 ssh2: RSA 32:ea:2d:e2:47:ac:fc:50:84:16:e2:16:57:b0:5c:2d

这篇关于如何在 Gitlab 中找出给定推送事件的 IP 地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆