Skip to content

Commit

Permalink
AWS KMS implementation (kroxylicious#1155)
Browse files Browse the repository at this point in the history
* AWS KMS implementation and supporting unit and integration tests.

Signed-off-by: kwall <[email protected]>
  • Loading branch information
k-wall authored May 21, 2024
1 parent 2114370 commit 97975d3
Show file tree
Hide file tree
Showing 50 changed files with 3,059 additions and 20 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Format `<github issue/pr number>: <short description>`.

## SNAPSHOT

* [#1076](https://github.com/kroxylicious/kroxylicious/issues/1076): AWS KMS implementation for Record Encryption
* [#1201](https://github.com/kroxylicious/kroxylicious/pull/1201): Bump com.fasterxml.jackson:jackson-bom from 2.17.0 to 2.17.1
* [#1158](https://github.com/kroxylicious/kroxylicious/pull/1158): Bump io.netty:netty-bom from 4.1.108.Final to 4.1.109.Final
* [#1162](https://github.com/kroxylicious/kroxylicious/issues/1162): Fix #1162: allow tenant / resource name prefix separator to be controlled from configuration
Expand Down
5 changes: 5 additions & 0 deletions kroxylicious-app/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,11 @@
<artifactId>kroxylicious-kms-provider-hashicorp-vault</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>io.kroxylicious</groupId>
<artifactId>kroxylicious-kms-provider-aws-kms</artifactId>
<scope>runtime</scope>
</dependency>
</dependencies>
</profile>
</profiles>
Expand Down
12 changes: 12 additions & 0 deletions kroxylicious-bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,12 @@
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>io.kroxylicious</groupId>
<artifactId>kroxylicious-kms-provider-aws-kms</artifactId>
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>io.kroxylicious</groupId>
<artifactId>kroxylicious-record-encryption</artifactId>
Expand Down Expand Up @@ -185,6 +191,12 @@
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>io.kroxylicious</groupId>
<artifactId>kroxylicious-kms-provider-aws-kms-test-support</artifactId>
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>io.kroxylicious</groupId>
<artifactId>kroxylicious-filter-test-support</artifactId>
Expand Down
11 changes: 11 additions & 0 deletions kroxylicious-integration-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,17 @@
<artifactId>kroxylicious-kms-provider-kroxylicious-inmemory-test-support</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>io.kroxylicious</groupId>
<artifactId>kroxylicious-kms-provider-aws-kms-test-support</artifactId>
<scope>runtime</scope>
<exclusions>
<exclusion>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.kroxylicious</groupId>
<artifactId>kroxylicious-kms-provider-hashicorp-vault-test-support</artifactId>
Expand Down
88 changes: 88 additions & 0 deletions kroxylicious-kms-provider-aws-kms-test-support/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright Kroxylicious Authors.
Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
-->

<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>io.kroxylicious</groupId>
<artifactId>kroxylicious-parent</artifactId>
<version>0.6.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

<artifactId>kroxylicious-kms-provider-aws-kms-test-support</artifactId>

<name>AWS KMS test support</name>
<description>Test support code for modules testing the AWS KMS</description>

<dependencies>
<!-- project dependencies - runtime and compile -->
<dependency>
<groupId>io.kroxylicious</groupId>
<artifactId>kroxylicious-kms</artifactId>
</dependency>
<dependency>
<groupId>io.kroxylicious</groupId>
<artifactId>kroxylicious-kms-provider-aws-kms</artifactId>
</dependency>
<dependency>
<groupId>io.kroxylicious</groupId>
<artifactId>kroxylicious-kms-test-support</artifactId>
</dependency>
<dependency>
<groupId>io.kroxylicious</groupId>
<artifactId>kroxylicious-api</artifactId>
</dependency>

<!-- third party dependencies - runtime and compile -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers</artifactId>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>localstack</artifactId>
</dependency>
<!-- third party dependencies - test -->
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-annotations</artifactId>
<scope>compile</scope>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
* Copyright Kroxylicious Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/

package io.kroxylicious.kms.provider.aws.kms;

import java.net.URI;

import io.kroxylicious.kms.provider.aws.kms.config.Config;
import io.kroxylicious.kms.service.TestKmsFacade;
import io.kroxylicious.proxy.config.secret.InlinePassword;

import edu.umd.cs.findbugs.annotations.NonNull;

public abstract class AbstractAwsKmsTestKmsFacade implements TestKmsFacade<Config, String, AwsKmsEdek> {

protected AbstractAwsKmsTestKmsFacade() {
}

protected abstract void startKms();

protected abstract void stopKms();

@Override
public final void start() {
startKms();
}

@NonNull
protected abstract URI getAwsUrl();

@Override
public final Config getKmsServiceConfig() {
return new Config(getAwsUrl(), new InlinePassword(getAccessKey()), new InlinePassword(getSecretKey()), getRegion(), null);
}

protected abstract String getRegion();

protected abstract String getSecretKey();

protected abstract String getAccessKey();

@Override
public final Class<AwsKmsService> getKmsServiceClass() {
return AwsKmsService.class;
}

@Override
public final void stop() {
stopKms();
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* Copyright Kroxylicious Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/

package io.kroxylicious.kms.provider.aws.kms;

import io.kroxylicious.kms.provider.aws.kms.config.Config;
import io.kroxylicious.kms.service.TestKmsFacadeFactory;

public abstract class AbstractAwsKmsTestKmsFacadeFactory implements TestKmsFacadeFactory<Config, String, AwsKmsEdek> {
@Override
public abstract AbstractAwsKmsTestKmsFacade build();
}
Loading

0 comments on commit 97975d3

Please sign in to comment.