-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SSH access logging omits username and IP information in access logs #21213
Comments
Router logs also suffering from similar problem, IP information is seen as 127.0.0.1 HTTP router logs
SSH router logs
|
You are looking at internal API calls, which are made from the Gitea process itself hence the 127.0.0.1 showing up. SSH has a non-router logger you can refer to if you wish to use fail2ban or some such, although I suspect you are using opensshd which 100% doesn't have an x-forwarded-for http header (as it isn't http but triggers a local binary), if that is indeed the case you would need to refer to opensshd for IP information as it is not passed to Gitea so we would be unable to log it. |
Partially fix #21213. This PR will get client IP address from SSH_CONNECTION env which should be the first field of that. And deliver it to the internal API so Gitea routers could record the real IP from SSH requests. Co-authored-by: wxiaoguang <[email protected]> Co-authored-by: 6543 <[email protected]> Co-authored-by: zeripath <[email protected]>
Description
When gitea access log is enabled (ENABLE_ACCESS_LOG=true) and you access the server via HTTP, it provides username and IP information in access logs. But when you access the server via SSH and enable SSH acces log (ENABLE_SSH_LOG=true), we can not see these information in access.log.
When we look at the users "Settings -> SSH/GPG keys" page, we can see that gitea understands and processes the relevant user information(date and SSH key), and so it can show us when the SSH key is last used.. But not seeing that information details in the access.log file, makes very hard to determine SSH access problems.
And as I mentioned above, it is clear that Gitea has the means to process the information, but simply it does not show the information in the SSH access logs.
Gitea Version
1.17.2
Can you reproduce the bug on the Gitea demo site?
No
Log Gist
HTTP access logs
SSH access logs
Screenshots
No response
Git Version
2.27.0
Operating System
RHEL 8
How are you running Gitea?
We are running " gitea-1.17.2-linux-amd64 " as a systemd service.
Database
SQLite
The text was updated successfully, but these errors were encountered: