-
Notifications
You must be signed in to change notification settings - Fork 32
Feat/azure_ekm_proxy_api_version=0.1-preview #601
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
HatemMn
wants to merge
18
commits into
develop
Choose a base branch
from
feat/ekm_proxy_api
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
3d0276f
feat: all commits squashed
HatemMn a226d27
fix: fixes
HatemMn 6419eb9
feat: ssl fix
HatemMn 2a7401f
feat: fmt fix
HatemMn fa2edb2
feat: stuff fix
HatemMn 81fc9b1
feat: add docs
HatemMn a98b99d
feat: add docs AND IMAGE
HatemMn 86a0120
feat: finish docs and fix some more todos
HatemMn ad620ed
feat: finish docs and fix some more todos3
HatemMn df5893f
feat: stop timing out
HatemMn 120bfb1
fix: still messy
HatemMn 50f3e87
feat: finish the refactor and the fix and the documentation
HatemMn be8da0c
feat: useless comment
HatemMn ce0b0c3
feat: ufix
HatemMn f339056
feat: fortmat????
HatemMn 8843491
feat: review fixes
HatemMn 2a30553
feat: review fixes even mroe
HatemMn b7ec711
feat: review fixes are never over
HatemMn File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| ### Optional: Faster compilation | ||
|
|
||
| You can add the following to your `.cargo/config.toml` to potentially speed up compilation on your local machine. | ||
|
|
||
| > **Note:** These flags are intentionally not set by default. The GitHub runners used to build the KMS Docker image have unpredictable CPU architectures, which causes error code 132 when running containers built with `target_cpu=native`. These flags are however passed explicitly in CI for macOS, Windows, Linux, and CentOS 7 builds via the `RUSTFLAGS` environment variable in `cargo_build.yml`. | ||
|
|
||
| ```toml | ||
| [build] | ||
| # Speeds up Ristretto 25519 multiplication x 2 | ||
| rustflags = [ | ||
| "--cfg", | ||
| "curve25519_dalek_backend=\"simd\"", | ||
| "-C", | ||
| "target_cpu=native", | ||
| ] | ||
|
|
||
| # Can increase link speed on systems that support mold | ||
| [target.x86_64-unknown-linux-gnu] | ||
| linker = "clang" | ||
| rustflags = ["-C", "link-arg=-fuse-ld=mold"] | ||
| ``` | ||
|
|
||
| ### Optional: VS Code / rust-analyzer | ||
|
|
||
| Add the following to your `.vscode/settings.json` to prevent rust-analyzer from interfering with regular `cargo` builds, which also reduces overall compilation time: | ||
|
|
||
| ```json | ||
| { | ||
| "rust-analyzer.cargo.extraEnv": { | ||
| "CARGO_TARGET_DIR": "target/rust-analyzer" | ||
| } | ||
| } | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| use clap::Args; | ||
| use serde::{Deserialize, Serialize}; | ||
|
|
||
| #[allow(clippy::trivially_copy_pass_by_ref)] // this is required by serde | ||
| fn is_false(b: &bool) -> bool { | ||
| !b | ||
| } | ||
| #[derive(Debug, Args, Deserialize, Serialize, Clone)] | ||
| #[serde(default)] | ||
| #[derive(Default)] | ||
| pub struct AzureEkmConfig { | ||
| /// This setting turns on/off the endpoints handling Azure EKM features | ||
| #[clap(long, env = "KMS_AZURE_EKM_ENABLE", default_value = "false")] | ||
| pub azure_ekm_enable: bool, | ||
|
|
||
| /// Optional path prefix set within Managed HSM during EKM configuration. | ||
| /// | ||
| /// Enables multi-customer use or isolation of different MHSM pools using the same proxy. | ||
| /// Must be max 64 characters: letters (a-z, A-Z), numbers (0-9), slashes (/), dashes (-). | ||
| #[clap(long, env = "KMS_AZURE_EKM_PATH_PREFIX", verbatim_doc_comment)] | ||
| #[serde(skip_serializing_if = "Option::is_none")] | ||
| pub azure_ekm_path_prefix: Option<String>, | ||
|
|
||
| /// WARNING: This bypasses mTLS authentication entirely. Only use for testing! | ||
| #[clap( | ||
| long, | ||
| env = "KMS_AZURE_EKM_DISABLE_CLIENT_AUTH", | ||
| default_value = "false" | ||
| )] | ||
| // serde does not support skipping booleans out of the box so a custom function is used | ||
| #[serde(skip_serializing_if = "is_false")] | ||
| pub azure_ekm_disable_client_auth: bool, | ||
|
|
||
| /// Proxy vendor name to report in /info endpoint. | ||
| #[clap(long, env = "KMS_AZURE_EKM_PROXY_VENDOR", default_value = "Cosmian")] | ||
| #[serde(skip_serializing_if = "String::is_empty")] | ||
| pub azure_ekm_proxy_vendor: String, | ||
|
|
||
| /// Proxy name to report in /info endpoint. | ||
| #[clap( | ||
| long, | ||
| env = "KMS_AZURE_EKM_PROXY_NAME", | ||
| default_value_t = format!("EKM Proxy Service v{}", env!("CARGO_PKG_VERSION")) | ||
| )] | ||
| #[serde(skip_serializing_if = "String::is_empty")] | ||
| pub azure_ekm_proxy_name: String, | ||
|
|
||
| /// EKMS vendor name report in the /info endpoint. | ||
| #[clap(long, env = "KMS_AZURE_EKM_VENDOR", default_value = "Cosmian")] | ||
| #[serde(skip_serializing_if = "String::is_empty")] | ||
| pub azure_ekm_ekm_vendor: String, // double "ekm" is intentional | ||
|
|
||
| /// Product Name and Version of the EKMS to report in the /info endpoint. | ||
| #[clap( | ||
| long, | ||
| env = "KMS_AZURE_EKM_PRODUCT", | ||
| default_value_t = format!("Cosmian KMS v{}", env!("CARGO_PKG_VERSION")) | ||
| )] | ||
| #[serde(skip_serializing_if = "String::is_empty")] | ||
| pub azure_ekm_ekm_product: String, // again, double "ekm" is intentional | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| ## About future versions | ||
|
|
||
| - Add future-ly supported version numbers in `SUPPORTED_API_VERSIONS` in `crate/server/src/routes/azure_ekm/mod.rs` | ||
| - Take into account that each version *might* support error status codes that were not previously supported, refer to `error.rs`. | ||
|
|
||
| ## Development guidelines | ||
|
|
||
| - Separate handlers to `handlers.rs` to ease out testing the API. |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this parameter really required?
If during testing, mTLS must be disabled, I would advise to disable this TLS configuration:
Isn't it enough?