Name | snitun JSON |
Version |
0.40.0
JSON |
| download |
home_page | None |
Summary | SNI proxy with TCP multiplexer |
upload_time | 2024-12-18 12:43:16 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.10 |
license | GPL v3 |
keywords |
sni
proxy
multiplexer
tls
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# 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.
```json
{
"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`: DATA
- `0x04`: Close
- `0x05`: Ping | The extra data is a `ping` or `pong` response to a ping.
Raw data
{
"_id": null,
"home_page": null,
"name": "snitun",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": "sni, proxy, multiplexer, tls",
"author": null,
"author_email": "\"Nabu Casa, Inc.\" <opensource@nabucasa.com>",
"download_url": "https://files.pythonhosted.org/packages/9a/5d/c39d5dee7119017efa571e7ce09fcb4f098734cb367adab59bed497ae0e9/snitun-0.40.0.tar.gz",
"platform": "any",
"description": "# SniTun\n\nEnd-to-End encryption with SNI proxy on top of a TCP multiplexer\n\n## Connection flow\n\n```\n [ CLIENT ] --AUTH/CONFIG--> [ SESSION MASTER ] (Trusted connection)\n [ CLIENT ] <--FERNET-TOKEN- [ SESSION MASTER ]\n [ CLIENT ] --------FERNET-TOKEN---------------------> [ SNITUN ] (Unsecure connection)\n [ CLIENT ] <-------CHALLENGE-RESPONSE-(AES/CBC)-----> [ SNITUN ]\n\n\n <---> <------------------------------>\n[ ENDPOINT ] <---> [ CLIENT ] <---------MULTIPLEXER---(AES/CBC)--------> [ SNITUN ] <------EXTERNAL-CONECTIONS-----> [ DEVICE ]\n | <---> <------------------------------> |\n | |\n | <--------------------------------------------------END-TO-END-SSL------------------------------------------------->|\n (Trusted connection)\n```\n\n## Fernet token\n\nThe 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.\n\n```json\n{\n \"valid\": 1923841,\n \"hostname\": \"myname.ui.nabu.casa\",\n \"aes_key\": \"hexstring\",\n \"aes_iv\": \"hexstring\"\n}\n```\n\nThe 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.\n\nNote: SniTun server does not perform any user authentication!\n\n### Challenge/Response\n\nThe 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.\n\n## Multiplexer Protocol\n\nThe 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.\n\nThe extra information could include the caller IP address for a new message. Otherwise, it is random bits.\n\n\n```\n|________________________________________________________|\n|-----------------HEADER---------------------------------|______________________________________________|\n|------ID-----|--FLAG--|--SIZE--|---------EXTRA ---------|--------------------DATA----------------------|\n| 16 bytes | 1 byte | 4 bytes| 11 bytes | variable |\n|--------------------------------------------------------|----------------------------------------------|\n```\n\nMessage Flags/Types:\n\n- `0x01`: New | The extra data includes the first byte as an ASCII value of 4 or 6, followed by the caller IP in bytes.\n- `0x02`: DATA\n- `0x04`: Close\n- `0x05`: Ping | The extra data is a `ping` or `pong` response to a ping.\n",
"bugtrack_url": null,
"license": "GPL v3",
"summary": "SNI proxy with TCP multiplexer",
"version": "0.40.0",
"project_urls": {
"Homepage": "https://www.nabucasa.com/",
"Repository": "https://github.com/NabuCasa/snitun.git"
},
"split_keywords": [
"sni",
" proxy",
" multiplexer",
" tls"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "a1079982bd349e7a1aef3f8077ccfcf7ee9b447bd70ccab8121ad786334a882a",
"md5": "7c6718efabcde3fc74961a0444fe3f6c",
"sha256": "dedb58d3042d13311142b55337ad6ce6ed339e43da9dca4c4c2c83df77c64ac0"
},
"downloads": -1,
"filename": "snitun-0.40.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "7c6718efabcde3fc74961a0444fe3f6c",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 39122,
"upload_time": "2024-12-18T12:43:12",
"upload_time_iso_8601": "2024-12-18T12:43:12.756109Z",
"url": "https://files.pythonhosted.org/packages/a1/07/9982bd349e7a1aef3f8077ccfcf7ee9b447bd70ccab8121ad786334a882a/snitun-0.40.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "9a5dc39d5dee7119017efa571e7ce09fcb4f098734cb367adab59bed497ae0e9",
"md5": "8843120a922d443d426455a3b7070f22",
"sha256": "f5a70b3aab07524f196d27baf7a8f8774b3b00c442e91392539dd11dbd033c9c"
},
"downloads": -1,
"filename": "snitun-0.40.0.tar.gz",
"has_sig": false,
"md5_digest": "8843120a922d443d426455a3b7070f22",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 33111,
"upload_time": "2024-12-18T12:43:16",
"upload_time_iso_8601": "2024-12-18T12:43:16.948508Z",
"url": "https://files.pythonhosted.org/packages/9a/5d/c39d5dee7119017efa571e7ce09fcb4f098734cb367adab59bed497ae0e9/snitun-0.40.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-18 12:43:16",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "NabuCasa",
"github_project": "snitun",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "snitun"
}