Skip to content

Commit 2e6b641

Browse files
committed
Refactor secrets manager approach for easier generalisability
This change has a potentially negative impact on the use of AWS Secrets Manager, in that it is no-longer possible to specify a different ARN or secret ID per account in the proxy's configuration file; instead, a command-line parameter (`--cache-store`) is introduced to specify a cache location (either an existing ARN or a new secret name (that must start with `aws_emailproxy@`)). However, there are several benefits to the new approach, including its generally simpler structure, and the fact that the cache location can now be redirected more easily to, for example, a local temporary file, or (with further development) any other secret management platform that can accept a JSON object.
1 parent e11338d commit 2e6b641

File tree

4 files changed

+142
-146
lines changed

4 files changed

+142
-146
lines changed

‎README.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,10 @@ Please note also that while authentication links can be processed from anywhere,
9292
- `--config-file` allows you to specify the location of a [configuration file](emailproxy.config) that the proxy should load.
9393
If this argument is not provided, the proxy will look for `emailproxy.config` in the same directory as the script itself.
9494

95+
- `--cache-store` is used to provide a separate location in which to cache authorised OAuth 2.0 tokens.
96+
The value of this argument can either be the full path to a local file or, if the extra requirements are installed (via `python -m pip install -r requirements-aws-secrets.txt`), an [AWS Secrets Manager](https://aws.amazon.com/secrets-manager/) name that begins with `aws_emailproxy@` or a full ARN.
97+
If this argument is not provided, credentials will be cached in the proxy's configuration file.
98+
9599
- `--log-file` allows you to specify the location of a file to send log output to.
96100
Log files are rotated at 32MB and 10 older log files are kept.
97101
This option overrides the proxy's default behaviour, which varies by platform (see [below](#troubleshooting) for details).

‎emailproxy.config‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,8 @@ documentation = The parameters below control advanced options for the proxy. In
196196
may gain access to the proxy's configuration file, set `encrypt_client_secret_on_first_use` to True and the proxy
197197
will replace the `client_secret` value with a new property `client_secret_encrypted` at the next token refresh. Note
198198
that this option is not compatible with `allow_catch_all_accounts` unless all accounts use the same login password.
199+
In addition, if you are using the proxy's `--cache-store` parameter you will need to manually remove unencrypted
200+
secrets from this configuration file after the encrypted secret has been created (i.e., it will not be automatic).
199201

200202
- allow_catch_all_accounts (default = False): The default behaviour of the proxy is to require a full separate
201203
configuration file entry for each account. However, when proxying multiple accounts from the same domain it can be

0 commit comments

Comments
 (0)