Skip to content

Add CLI random padding support for SPA packets (fixed value + random range) #390

Description

@N0TScrooge

Hello, and thank you for maintaining fwknop.

I’d like to propose a new client feature: add padding to SPA packets from the command line, so packet length can be controlled/varied and become less predictable on the wire.
Proposed functionality

Please add two CLI options (names are examples):

--pad-bytes <N>
Add a fixed number of padding bytes to the SPA payload.

--pad-random <MIN:MAX>
For each SPA packet, choose a random padding length in the [MIN, MAX] range.

Example usage

fwknop ... --pad-bytes 64
fwknop ... --pad-random 16:128

Expected behavior

Padding must be part of the encrypted/authenticated SPA content (not appended after ciphertext).
Default behavior remains unchanged (padding disabled unless requested).
Input validation:
    MIN <= MAX
    enforce a sane upper bound (e.g., do not exceed MAX_SPA_ENCRYPTED_SIZE/MTU constraints).
With --pad-random, a new random length is chosen per packet.
Works consistently across UDP/TCP/HTTP SPA transport modes.

Why this is useful

Reduces SPA traffic correlation based on packet length.
Makes signature/heuristic traffic analysis harder.
Gives users a controlled way to vary packet length without changing access semantics.

Optional follow-ups

Add corresponding settings to ~/.fwknoprc (e.g., PAD_BYTES / PAD_RANDOM).
Add unit/integration tests for:
    CLI parsing,
    random range validation,
    successful server-side processing of padded packets.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions