From 6b627517b367a9a0b6f78ba93271bdcc30bcd92e Mon Sep 17 00:00:00 2001 From: Vignesh Rao Date: Thu, 19 Sep 2024 00:05:51 -0500 Subject: [PATCH] Add a new feature to enable transit protection --- .gitignore | 2 +- README.md | 18 +++-- doc_gen/index.rst | 5 ++ docs/README.html | 24 +++++-- docs/README.md | 18 +++-- docs/_sources/README.md.txt | 18 +++-- docs/_sources/index.rst.txt | 5 ++ docs/genindex.html | 51 ++++++++++----- docs/index.html | 127 +++++++++++++++++++++++++++++++++--- docs/objects.inv | Bin 902 -> 959 bytes docs/py-modindex.html | 5 ++ docs/searchindex.js | 2 +- vaultapi/main.py | 5 +- vaultapi/models.py | 16 +++-- vaultapi/routes.py | 14 ++-- vaultapi/transit.py | 80 +++++++++++++++++++++++ vaultapi/util.py | 27 ++++++++ 17 files changed, 360 insertions(+), 57 deletions(-) create mode 100644 vaultapi/transit.py diff --git a/.gitignore b/.gitignore index 72d5c48..b5119a4 100644 --- a/.gitignore +++ b/.gitignore @@ -6,7 +6,7 @@ venv/ __pycache__/ build/ -PyNinja.egg-info/ +VaultAPI.egg-info/ doc_gen/_* diff --git a/README.md b/README.md index 5052163..ae3559e 100644 --- a/README.md +++ b/README.md @@ -57,13 +57,23 @@ vaultapi start > _By default, `VaultAPI` will look for a `.env` file in the current working directory._ -- **HOST** - Hostname for the API server. -- **PORT** - Port number for the API server. -- **WORKERS** - Number of workers for the uvicorn server. +**Mandatory** - **APIKEY** - API Key for authentication. - **SECRET** - Secret access key to encode/decode the secrets in Datastore. -- **DATABASE** - FilePath to store the secrets' database. + +**Optional (with defaults)** +- **TRANSIT_KEY_LENGTH** - AES key length for transit encryption. Defaults to `32` +- **DATABASE** - FilePath to store the secrets' database. Defaults to `secrets.db` +- **HOST** - Hostname for the API server. Defaults to `0.0.0.0` [OR] `localhost` +- **PORT** - Port number for the API server. Defaults to `9010` +- **WORKERS** - Number of workers for the uvicorn server. Defaults to `1` - **RATE_LIMIT** - List of dictionaries with `max_requests` and `seconds` to apply as rate limit. +Defaults to 5req/2s [AND] 10req/30s + +**Optional (without defaults)** +- **LOG_CONFIG** - FilePath or dictionary of key-value pairs for log config. +- **ALLOWED_ORIGINS** - Origins that are allowed to retrieve secrets. +- **ALLOWED_IP_RANGE** - IP range that is allowed to retrieve secrets. _(eg: `10.112.8.10-210`)_
Auto generate a SECRET value diff --git a/doc_gen/index.rst b/doc_gen/index.rst index bf91e65..36ad598 100644 --- a/doc_gen/index.rst +++ b/doc_gen/index.rst @@ -76,6 +76,11 @@ Squire .. automodule:: vaultapi.squire +Transmitter +=========== + +.. automodule:: vaultapi.transit + Util ==== diff --git a/docs/README.html b/docs/README.html index 19b4b00..b8da763 100644 --- a/docs/README.html +++ b/docs/README.html @@ -92,14 +92,26 @@

Environment VariablesSourcing environment variables from an env file

By default, VaultAPI will look for a .env file in the current working directory.

-