Gitolite: how to get user IP address who clone or push to git

£可爱£侵袭症+ 提交于 2021-02-19 08:40:54

问题


Let's say I'm administrating a gitolite server. Is it possible to see the IP address of a user who cloned or pushed to my hosted repository? I have a custom POST_GIT trigger installed that reads in .gitolite/logs but logs don't contain IP addresses.

Any advice is much appreciated.


回答1:


It might depend on your Gitolite version.

In my .gitolite/logs (gitolite 3.5+) , I do see the IP:

2014-09-29.07:38:59 19273   ssh ARGV=aUserName   SOC=git-upload-pack 'aRepoName1' FROM=128.20x.xxx.xxx
2014-09-29.07:38:59 19274   ssh ARGV=aUserName   SOC=git-upload-pack 'aRepoName2'   FROM=128.20x.xxx.xxx

(also valid for http connections, not just ssh ones)

The src/gitolite-shell does include the IP:

gl_log( 'ssh', "ARGV=" . join( ",", @ARGV ), "SOC=" . ( $ENV{SSH_ORIGINAL_COMMAND} || '' ), "FROM=$ip" );

Introduced/updated in commit 906ed4c (for gitolite 3.04+, June 2012)



来源:https://stackoverflow.com/questions/26093734/gitolite-how-to-get-user-ip-address-who-clone-or-push-to-git

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!