Skip to content

SSH access logging omits username and IP information in access logs #21213

Closed
@szsahin

Description

@szsahin

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.

[log]
MODE              = console,file
LEVEL             = debug
ROOT_PATH         = /opt/git/server/log
ROUTER            = console,file
ENABLE_ACCESS_LOG = true
ACCESS            = file
ENABLE_SSH_LOG    = true

[log.file.access]
LEVEL             = debug

[log.file.router]
LEVEL             = debug

Gitea Version

1.17.2

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

HTTP access logs

10.100.7.45:0 - - [19/Sep/2022:16:56:32 +0300] "GET /MYORGANISATION/myapp-bundle-docker.git/info/refs?service=git-upload-pack HTTP/1.0" 401 13 "\" \"git/2.27.0"
10.100.7.45:0 - - [19/Sep/2022:16:56:32 +0300] "GET /MYORGANISATION/myapp-bundle-docker.git/info/refs?service=git-upload-pack HTTP/1.0" 401 13 "\" \"git/2.27.0"
10.100.7.45:0 - myuser [19/Sep/2022:16:56:40 +0300] "GET /MYORGANISATION/myapp-bundle-docker.git/info/refs?service=git-upload-pack HTTP/1.0" 200 935 "\" \"git/2.27.0"
10.100.7.45:0 - myuser [19/Sep/2022:16:56:40 +0300] "POST /MYORGANISATION/myapp-bundle-docker.git/git-upload-pack HTTP/1.0" 200 106889739 "\" \"git/2.27.0"

SSH access logs

127.0.0.1:59694 - - [19/Sep/2022:16:58:33 +0300] "GET /api/internal/serv/command/5/myorganisation/myapp-bundle-docker?mode=1&verb=git-upload-pack HTTP/1.1" 200 217 "\" \"GiteaServer"
127.0.0.1:59730 - - [19/Sep/2022:16:58:53 +0300] "POST /api/internal/ssh/5/update/5 HTTP/1.1" 200 7 "\" \"GiteaServer"

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions