Repository navigation
Description
Goal
Allow operators to disable UDP connection ID validation for a specific UDP tracker listener when compatibility with non-compliant clients is more important than the anti-spoofing and replay protection provided by BEP 15 connection IDs. Strict validation remains the secure default.
Background
Some BitTorrent clients reuse expired connection IDs or otherwise do not follow BEP 15 connection ID semantics. Torrust already provides the per-listener cookie_lifetime setting to widen the valid time window, but it cannot support clients that reuse IDs indefinitely.
The original reports that motivated this issue remain relevant:
- chihaya issue #417
- torrust-demo issue #14
- Ban socket addresses not sending a valid connection ID #1096
- Original traffic screenshot
Security Constraint
An expiration-only bypass is not a safe middle ground with the current cookie design. Connection IDs use non-authenticated encryption, and the client fingerprint is mixed through wrapping arithmetic rather than a MAC. The narrow timestamp window therefore contributes to the probabilistic forgery resistance. A random or wrong-fingerprint ID can decode to a normal timestamp classified as expired, so accepting every expired result would accept more than known, previously valid cookies.
Design
- Add a per-listener
connection_id_validationenum to configuration schema v3. - Support
strictanddisabledvalues; omitted values default tostrict. - Apply the policy consistently to announce and scrape requests through a shared UDP core authentication boundary.
- Keep connect behavior unchanged: both policies continue issuing connection IDs.
- In
disabledmode, skip only connection ID validation. All other request validation, authorization, and tracker policy checks remain active. - In
disabledmode, do not emit connection-cookie errors or increment connection-ID error metrics or IP-ban counters for the bypassed check. - Emit a startup warning identifying each listener with validation disabled and the reduced anti-spoofing/replay protection.
- Do not add an expiration-only mode.
- Add the option only to schema v3; schema v2 and consumer migration remain unchanged until final cleanup issue Configuration overhaul final cleanup: remove global re-exports, migrate consumers to explicit versioned imports #1980.
EPIC Placement
This is subissue 7 of 11 in #1978, immediately after #1453. It is not functionally dependent on #1453, but that issue establishes the related global UDP ban-cleanup boundary before this issue adds a per-listener validation policy.
Acceptance Criteria
- Schema v3 exposes exactly
strictanddisabledserialized policy values. - Omitting the setting defaults to strict behavior.
- Strict mode preserves existing announce, scrape, error metric, and banning behavior.
- Disabled mode bypasses only connection ID validation for announce and scrape.
- Connect requests continue issuing connection IDs in both modes.
- Disabled mode produces no connection-cookie errors, connection-ID metric increments, or IP-ban increments for the bypassed check.
- Strict and disabled listeners can run simultaneously and independently.
- Startup logs warn for every listener with disabled validation.
- Schema v2 behavior and public types remain unchanged.
- Automated and manual verification evidence is recorded.
Specification
The full implementation and verification specification is maintained in docs/issues/open/1136-1978-configurable-udp-connection-id-validation-policy.md.
cc @da2ce7
Activity
josecelano commentedon Dec 19, 2024
I did not remember (because it was added by @da2ce7) there is already a configuration option to increase the lifetime of the cookie:
@da2ce7 suggested to add a flag to ignore connection ID on the weekly meeting.
[-]Consider config option to increase connection ID expiration in UDP tracker[/-][+]Consider config option to ignore connection ID expiration in UDP tracker[/+][-]Consider config option to ignore connection ID expiration in UDP tracker[/-][+]Add configurable UDP connection ID validation policy[/+]Merge #2002: Document UDP connection ID validation policy
docs(udp-server): update spec for torrust#1136 connection ID validati…
feat(udp-server): implement configurable connection ID validation pol…
test(udp-server): add disabled-policy scenario group tests (T8) (torr…
docs: align table formatting in issue specs (torrust#1136)
feat(udp-server): add configurable connection ID validation policy (t…
docs: fix doc comments and test assertions per Copilot review (torrus…
test(review): add banning semantics test for disabled-policy mode (to…
Merge torrust#2032: feat(udp-server): add configurable connection ID …
docs(configuration): convert epic to folder type and add migration guide
Merge #2058: chore(issues): archive eight completed issue specs