SNI proxy with TCP multiplexer
Project description
SniTun
End-to-End encryption with SNI proxy on top of a TCP multiplexer
Connection flow
[ CLIENT ] --AUTH/CONFIG--> [ SESSION MASTER ] (Trusted connection)
[ CLIENT ] <--FERNET-TOKEN- [ SESSION MASTER ]
[ CLIENT ] --------FERNET-TOKEN---------------------> [ SNITUN ] (Unsecure connection)
[ CLIENT ] <-------CHALLENGE-RESPONSE-(AES/CBC)-----> [ SNITUN ]
<---> <------------------------------>
[ ENDPOINT ] <---> [ CLIENT ] <---------MULTIPLEXER---(AES/CBC)--------> [ SNITUN ] <------EXTERNAL-CONECTIONS-----> [ DEVICE ]
| <---> <------------------------------> |
| |
| <--------------------------------------------------END-TO-END-SSL------------------------------------------------->|
(Trusted connection)
Fernet token
The session master creates a Fernet token from the client's configuration (AES/whitelist) and attaches the hostname and a UTC timestamp until which the token is valid.
{
"valid": 1923841,
"hostname": "myname.ui.nabu.casa",
"aes_key": "hexstring",
"aes_iv": "hexstring"
}
The SniTun server must be able to decrypt this token to validate the client's authenticity. SniTun then initiates a challenge-response handling to validate the AES key and ensure that it is the same client that requested the Fernet token from the session master.
Note: SniTun server does not perform any user authentication!
Challenge/Response
The SniTun server creates a SHA256 hash from a random 40-bit value. This value is encrypted and sent to the client, who then decrypts the value and performs another SHA256 hash with the value and sends it encrypted back to SniTun. If it is valid, the client enters the Multiplexer mode.
Multiplexer Protocol
The header is encrypted using AES/CBC. The payload should be SSL. The ID changes for every TCP connection and is unique for each connection. The size is for the data payload.
The extra information could include the caller IP address for a new message. Otherwise, it is random bits.
|________________________________________________________|
|-----------------HEADER---------------------------------|______________________________________________|
|------ID-----|--FLAG--|--SIZE--|---------EXTRA ---------|--------------------DATA----------------------|
| 16 bytes | 1 byte | 4 bytes| 11 bytes | variable |
|--------------------------------------------------------|----------------------------------------------|
Message Flags/Types:
0x01
: New | The extra data includes the first byte as an ASCII value of 4 or 6, followed by the caller IP in bytes.0x02
: DATA0x04
: Close0x05
: Ping | The extra data is aping
orpong
response to a ping.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file snitun-0.38.0.tar.gz
.
File metadata
- Download URL: snitun-0.38.0.tar.gz
- Upload date:
- Size: 32.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a465db5a3e3dd4d07da112f8b3d9a35e8c73eec5179a040349e88488a9da62f2 |
|
MD5 | 4bcd4fcdf495d855dd7e3e2926e1d01c |
|
BLAKE2b-256 | edcb7694b6ef52918b7bf1247ea9d42d3047bdcc34f17f805f6640c6bba3b46f |
Provenance
File details
Details for the file snitun-0.38.0-py3-none-any.whl
.
File metadata
- Download URL: snitun-0.38.0-py3-none-any.whl
- Upload date:
- Size: 38.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | eef7597897897bec597c92ad9d9fb1a25efc93733caa61b32af3ae88876e2314 |
|
MD5 | b7a92377989950b77a2e39206b545d95 |
|
BLAKE2b-256 | 3a13ae518adc74ce74d4c0c1d08148524ff885f776564b7eee39a9c2a9439d7c |