SNI proxy with TCP multiplexer
Maintained. Last release 5 months ago, commits in 4 of the last 26 weeks. Weaker on commit activity.
pip install snitunSniTun
End-to-End encryption with SNI proxy on top of a TCP multiplexer
Connection flow
sequenceDiagram
participant E as Endpoint
participant C as Client
participant M as Session Master
participant S as SniTun
participant D as Device
Note over C,M: Trusted connection
C->>M: Auth / config
M-->>C: Fernet token
Note over C,S: Insecure connection
C->>S: Fernet token
S->>C: Challenge (AES/CBC)
C->>S: Response (AES/CBC)
Note over C,S: Client enters multiplexer mode
D->>S: External connection (TLS / SNI)
S->>C: Forward over multiplexer (AES/CBC)
C->>E: Open local connection
Note over E,D: End-to-end SSL (trusted connection)
Fernet token
The session master encrypts the client's configuration into a Fernet token. The session master and the SniTun server share the Fernet key(s), so only the SniTun server can decrypt the token; the client just relays it when it connects.
The token payload is a JSON object:
{
"valid": 1924948800.0,
"hostname": "myname.ui.nabu.casa",
"aes_key": "401933e35f9f43d18db1d1de2e5d2e9a9f4c3b2a1d0e9f8c7b6a5d4c3b2a1f0e",
"aes_iv": "9b2c4d6e8f0a1b3c5d7e9f0a1b2c3d4e",
"protocol_version": 2,
"cipher": "aes-gcm",
"alias": ["www.myname.ui.nabu.casa"]
}
| Field | Type | Description |
|---|---|---|
valid | float | Expiry as a UTC Unix timestamp in seconds. The SniTun server rejects the token once this time has passed. |
hostname | string | Primary hostname (matched against the TLS SNI) that this peer serves. |
aes_key | string | Hex-encoded 32-byte key (AES-256) used to encrypt the multiplexer header. |
aes_iv | string | Hex-encoded 16-byte initialization vector. Used by aes-cbc; ignored by aes-gcm/aes-gcm-siv (which use a random per-frame nonce). |
protocol_version | int | Multiplexer protocol version the client speaks (see Protocol versioning considerations). Optional; the server assumes 0 when omitted. |
cipher |