Skip to content
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

Built-in SSH Server: Log IP on failure #5765

Closed
2 of 7 tasks
Whisprin opened this issue Jan 18, 2019 · 0 comments
Closed
2 of 7 tasks

Built-in SSH Server: Log IP on failure #5765

Whisprin opened this issue Jan 18, 2019 · 0 comments

Comments

@Whisprin
Copy link
Contributor

  • Gitea version (or commit ref): 1.6.4
  • Git version: 2.20.1
  • Operating system: Linux
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant
  • Log gist:

Description

For the built-in ssh server: In case of an authentication / handshake error, can you please add the IP address to the log output of the error message? (similar to web interface authentication failures)
Currently the IP is logged with the authentication attempt only, but not with the auth failure.

Background: I'd like to configure fail2ban for the built-in ssh server similar to what's mentioned in the docs: https://docs.gitea.io/en-us/fail2ban-setup/

Currently a failed ssh connection logs like this:

Log

wrong public key

2019/01/19 00:30:21 [T] SSH: Handshaking for <remote_ip>:<port>
...
2019/01/19 00:31:04 [...a/modules/ssh/ssh.go:164 func1()] [E] SearchPublicKeyByContent: public key does not exist [id: 0]
2019/01/19 00:31:04 [...a/modules/ssh/ssh.go:140 func1()] [E] SSH: Error on handshaking: [ssh: no auth passed yet, public key does not exist [id: 0]]

no matching cipher

2019/01/19 00:28:18 [T] SSH: Handshaking for <remote_ip>:<port>
...
2019/01/19 00:28:18 [...a/modules/ssh/ssh.go:140 func1()] [E] SSH: Error on handshaking: ssh: no common algorithm for key exchange; client offered: [diffie-hellman-group14-sha1 diffie-hellman-group-exchange-sha1 diffie-hellman-group1-sha1], server offered: [[email protected]]

Ideally the "[E] SSH: Error on handshaking: ..." would be something like:

[E] SSH: Error on handshaking with <remote_ip>:<port>: ...
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant