Skip to content

API logger should respect X-Forwarded-For header #9336

Closed

Description

@bt90

The log output is currently insufficient to diagnose which client is at fault when Syncthing is running behind a reverse proxy:

INFO: Wrong credentials supplied during API authorization from 127.0.0.1:44002
INFO: Wrong credentials supplied during API authorization from 127.0.0.1:59042
INFO: Wrong credentials supplied during API authorization from 127.0.0.1:52652
INFO: Wrong credentials supplied during API authorization from 127.0.0.1:48306
INFO: Wrong credentials supplied during API authorization from 127.0.0.1:40332
INFO: Wrong credentials supplied during API authorization from 127.0.0.1:39414
INFO: Wrong credentials supplied during API authorization from 127.0.0.1:55012
INFO: Wrong credentials supplied during API authorization from 127.0.0.1:42518
INFO: Wrong credentials supplied during API authorization from 127.0.0.1:44488
INFO: Wrong credentials supplied during API authorization from 127.0.0.1:49030
INFO: Wrong credentials supplied during API authorization from 127.0.0.1:57798
INFO: Wrong credentials supplied during API authorization from 127.0.0.1:56110

func emitLoginAttempt(success bool, username, address string, evLogger events.Logger) {
evLogger.Log(events.LoginAttempt, map[string]interface{}{
"success": success,
"username": username,
"remoteAddress": address,
})
if !success {
l.Infof("Wrong credentials supplied during API authorization from %s", address)
}
}

Activity

  1. added
    enhancement
    on Jan 8, 2024
  2. boydaihungst commented on Mar 18, 2024

    @boydaihungst

    Yes definitely need this. I also noticed this bug recently after my web UI got brute force hack. I tried to setup fail2ban, but the only IP got from syncthing's log file is 127.0.0.1. ☹️

  3. added a commit that references this issue on Apr 23, 2025
  4. added
    frozen-due-to-age
    on Jul 1, 2026
  5. locked and limited conversation to collaborators on Jul 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementfrozen-due-to-age

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions