-
Notifications
You must be signed in to change notification settings - Fork 0
Add MinIO storage profile command #317
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
Closed
daniel-marthaler
wants to merge
1
commit into
shift7-ch:issues/83-vaultprovider
from
daniel-marthaler:fix/minio-sts-role-chaining
Closed
Changes from all commits
Commits
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
15 changes: 15 additions & 0 deletions
15
admin-cli/src/main/java/cloud/katta/cli/commands/hub/storageprofile/minio/MinIO.java
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,15 @@ | ||
| /* | ||
| * Copyright (c) 2026 shift7 GmbH. All rights reserved. | ||
| */ | ||
|
|
||
| package cloud.katta.cli.commands.hub.storageprofile.minio; | ||
|
|
||
| import picocli.CommandLine; | ||
|
|
||
| @CommandLine.Command(name = "minio", subcommands = { | ||
| MinioSTSStorageProfile.class, | ||
| CommandLine.HelpCommand.class | ||
| }, | ||
| description = "Setup MinIO Storage Provider Integration", mixinStandardHelpOptions = true) | ||
| public class MinIO { | ||
| } |
101 changes: 101 additions & 0 deletions
101
...c/main/java/cloud/katta/cli/commands/hub/storageprofile/minio/MinioSTSStorageProfile.java
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,101 @@ | ||
| /* | ||
| * Copyright (c) 2026 shift7 GmbH. All rights reserved. | ||
| */ | ||
|
|
||
| package cloud.katta.cli.commands.hub.storageprofile.minio; | ||
|
|
||
| import java.util.List; | ||
| import java.util.UUID; | ||
|
|
||
| import cloud.katta.cli.commands.hub.storageprofile.AbstractStorageProfile; | ||
| import cloud.katta.client.ApiException; | ||
| import cloud.katta.client.api.StorageProfileResourceApi; | ||
| import cloud.katta.client.model.Protocol; | ||
| import cloud.katta.client.model.S3SERVERSIDEENCRYPTION; | ||
| import cloud.katta.client.model.S3STORAGECLASSES; | ||
| import cloud.katta.client.model.StorageProfileS3STSDto; | ||
| import picocli.CommandLine; | ||
|
|
||
| /** | ||
| * Uploads a storage profile to Katta Server for use with MinIO STS. Requires MinIO STS setup. | ||
| * <p> | ||
| * Unlike AWS, MinIO does not support role chaining (AssumeRole with tagged session). | ||
| * Therefore {@code stsRoleAccessBucketAssumeRoleTaggedSession} and {@code stsSessionTag} | ||
| * are intentionally left {@code null}. | ||
| * <p> | ||
| * MinIO uses the {@code ${jwt:client_id}} policy variable to scope bucket access per vault. | ||
| * <p> | ||
| * See also: <a href="https://github.com/shift7-ch/katta-docs/blob/main/SETUP_KATTA_SERVER.md#minio">katta docs</a>. | ||
| */ | ||
| @CommandLine.Command(name = "sts", | ||
| description = "Upload storage profile for MinIO STS.", | ||
| showDefaultValues = true, | ||
| mixinStandardHelpOptions = true) | ||
| public class MinioSTSStorageProfile extends AbstractStorageProfile { | ||
|
|
||
| @CommandLine.Option(names = {"--endpointUrl"}, description = "MinIO endpoint URL (S3 API). Example: \"https://minio.example.com\"", required = true) | ||
| String endpointUrl; | ||
|
|
||
| @CommandLine.Option(names = {"--port"}, description = "MinIO endpoint port.", defaultValue = "443") | ||
| Integer port; | ||
|
|
||
| @CommandLine.Option(names = {"--scheme"}, description = "URL scheme (https or http).", defaultValue = "https") | ||
| String scheme; | ||
|
|
||
| @CommandLine.Option(names = {"--bucketPrefix"}, description = "Bucket prefix for STS vaults.", defaultValue = "katta-") | ||
| String bucketPrefix; | ||
|
|
||
| @CommandLine.Option(names = {"--stsRoleCreateBucket"}, description = "MinIO role ARN for bucket creation (from 'mc idp openid ls' for the cryptomator client).", required = true) | ||
| String stsRoleCreateBucket; | ||
|
|
||
| @CommandLine.Option(names = {"--stsRoleAccessBucket"}, description = "MinIO role ARN for bucket access (from 'mc idp openid ls' for the cryptomatorvaults client).", required = true) | ||
| String stsRoleAccessBucket; | ||
|
|
||
| public MinioSTSStorageProfile() { | ||
| } | ||
|
|
||
| @Override | ||
| protected void call(final StorageProfileResourceApi storageProfileResourceApi) throws ApiException { | ||
| final UUID uuid = UUID.fromString(null == this.uuid ? UUID.randomUUID().toString() : this.uuid); | ||
| final String hostname = endpointUrl.replaceFirst("^https?://", ""); | ||
| storageProfileResourceApi.apiStorageprofileS3stsPost(new StorageProfileS3STSDto() | ||
| .id(uuid) | ||
| .name(null == name ? this.toString() : name) | ||
| .protocol(Protocol.S3_STS) | ||
| .archived(false) | ||
|
|
||
| // -- (1) S3 endpoint configuration for MinIO | ||
| .scheme(scheme) | ||
| .hostname(hostname) | ||
| .port(port) | ||
| .storageClass(S3STORAGECLASSES.STANDARD) | ||
| .withPathStyleAccessEnabled(true) // Required for MinIO | ||
|
|
||
| // -- (2) bucket creation | ||
| .bucketPrefix(bucketPrefix) | ||
| .region(region) | ||
| .regions(null == regions ? List.of(region) : regions) | ||
| .bucketEncryption(S3SERVERSIDEENCRYPTION.NONE) | ||
| .bucketVersioning(false) // MinIO versioning is optional | ||
| .bucketAcceleration(null) // Not supported by MinIO | ||
|
|
||
| // -- (3) STS roles from MinIO OIDC setup | ||
| .stsRoleCreateBucketClient(stsRoleCreateBucket) | ||
| .stsRoleCreateBucketHub(stsRoleCreateBucket) | ||
| .stsRoleAccessBucketAssumeRoleWithWebIdentity(stsRoleAccessBucket) | ||
|
|
||
| // -- (4) STS endpoint override for MinIO | ||
| .stsEndpoint(endpointUrl) | ||
|
|
||
| // -- (5) No role chaining for MinIO (AWS-only feature) | ||
| .stsRoleAccessBucketAssumeRoleTaggedSession(null) | ||
| .stsSessionTag(null) | ||
| ); | ||
| System.out.println(storageProfileResourceApi.apiStorageprofileProfileIdGet(uuid)); | ||
| } | ||
|
|
||
| @Override | ||
| public String toString() { | ||
| return String.format("MinIO (STS) Storage Profile %s", endpointUrl); | ||
| } | ||
| } |
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
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.
The
stsRoleAccessBucketAssumeRoleTaggedSessionsetting in the storage profile configuration is mapped to theS3AssumeRoleProtocol.S3_ASSUMEROLE_ROLEARN_TAGsetting and should be already null as shown above in the CLI setup. Thus the additional check for the STS endpoint is redundant.