Skip to content

log real ip of requests from ssh #21216

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

Merged
merged 6 commits into from
Oct 11, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add comment
  • Loading branch information
lunny committed Sep 20, 2022
commit fd9f2b0de2dbfbeb37632d95bdaa567020d011f9
4 changes: 3 additions & 1 deletion routers/private/internal.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,11 @@ func bind(obj interface{}) http.HandlerFunc {
// These APIs will be invoked by internal commands for example `gitea serv` and etc.
func Routes() *web.Route {
r := web.NewRoute()
r.Use(chi_middleware.RealIP)
r.Use(context.PrivateContexter())
r.Use(CheckInternalToken)
// Log the real ip address of the request from SSH is really helpful for diagnosing sometimes.
// Since internal API will be sent only from Gitea sub commands and it's under controll, we can trust the headers.
r.Use(chi_middleware.RealIP)

r.Post("/ssh/authorized_keys", AuthorizedPublicKeyByContent)
r.Post("/ssh/{id}/update/{repoid}", UpdatePublicKeyInRepo)
Expand Down