feat(auth): add token authentication with SHA-256 hashed storage
This commit is contained in:
@@ -23,6 +23,25 @@ python3 share.py -p 3001 -d ~/Downloads/shared --ttl 7
|
||||
| `-p`, `--port` | `8888` | Port |
|
||||
| `-d`, `--dir` | `~/Downloads/shared` | Upload directory |
|
||||
| `--ttl` | `7` | File lifetime in days (0 = keep forever) |
|
||||
| `--token` | | Auth token (empty = open access) |
|
||||
| `--cert` | | Path to SSL certificate |
|
||||
| `--key` | | Path to SSL key |
|
||||
|
||||
## Authentication
|
||||
|
||||
Set `token` in `share.config` or pass `--token`. All endpoints require a valid token.
|
||||
|
||||
The token can be stored as plain text or as a SHA-256 hash:
|
||||
|
||||
```
|
||||
# generate hash
|
||||
python3 share.py hash mytoken
|
||||
|
||||
# store in share.config
|
||||
token = 9c56cc51b374c3ba189210d5b6d0d04...
|
||||
```
|
||||
|
||||
If the value is a 64-character hex string, it is treated as a hash. Otherwise it is hashed automatically at startup.
|
||||
|
||||
## systemd (Arch)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user