Skip to content
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

Add Vault Transit key administration #13165

Merged
merged 1 commit into from
Nov 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/src/main/asciidoc/vault.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -446,12 +446,13 @@ discouraged in production as it is not more secure than talking to Vault in plai
== Vault Provisioning

Beside the typical client use cases, the Quarkus extension can be used to provision Vault as well,
for instance as part of a CD pipeline. Specific CDI beans support this scenario:
for instance as part of a CD pipeline. Specific CDI beans and operations support this scenario:

* `VaultSystemBackendEngine`: create Vault Policies. See the https://www.vaultproject.io/api-docs/system/policy[Vault documentation].
* `VaultKubernetesAuthService`. See the https://www.vaultproject.io/api-docs/auth/kubernetes[Vault documentation].
** Configure the Kubernetes Auth Method (Kubernetes host, certificates, keys, ...)
** Create Kubernetes Auth Roles (association between Kubernetes service accounts, Kubernetes namespaces and Vault policies)
* `VaultTransitSecretEngine`: _CRUD_ operations on keys. See the https://www.vaultproject.io/api-docs/secret/transit[Vault documentation].

For instance:

Expand Down
4 changes: 0 additions & 4 deletions extensions/vault/deployment/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@
<groupId>io.quarkus</groupId>
<artifactId>quarkus-vault</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-vault-model</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-core-deployment</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package io.quarkus.vault.runtime.client.dto.transit;

import com.fasterxml.jackson.annotation.JsonProperty;

import io.quarkus.vault.runtime.client.dto.VaultModel;

public class VaultTransitCreateKeyBody implements VaultModel {

@JsonProperty("convergent_encryption")
public String convergentEncryption;
public Boolean derived;
public Boolean exportable;
@JsonProperty("allow_plaintext_backup")
public Boolean allowPlaintextBackup;
public String type;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package io.quarkus.vault.runtime.client.dto.transit;

import com.fasterxml.jackson.annotation.JsonProperty;

import io.quarkus.vault.runtime.client.dto.VaultModel;

public class VaultTransitKeyConfigBody implements VaultModel {

@JsonProperty("min_decryption_version")
public Integer minDecryptionVersion;
@JsonProperty("min_encryption_version")
public Integer minEncryptionVersion;
@JsonProperty("deletion_allowed")
public Boolean deletionAllowed;
public Boolean exportable;
@JsonProperty("allow_plaintext_backup")
public Boolean allowPlaintextBackup;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package io.quarkus.vault.runtime.client.dto.transit;

import io.quarkus.vault.runtime.client.dto.AbstractVaultDTO;

public class VaultTransitKeyExport extends AbstractVaultDTO<VaultTransitKeyExportData, Object> {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package io.quarkus.vault.runtime.client.dto.transit;

import java.util.Map;

import io.quarkus.vault.runtime.client.dto.VaultModel;

public class VaultTransitKeyExportData implements VaultModel {

public String name;
public Map<String, String> keys;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package io.quarkus.vault.runtime.client.dto.transit;

import java.util.List;

import io.quarkus.vault.runtime.client.dto.VaultModel;

public class VaultTransitListKeysData implements VaultModel {

public List<String> keys;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package io.quarkus.vault.runtime.client.dto.transit;

import io.quarkus.vault.runtime.client.dto.AbstractVaultDTO;

public class VaultTransitListKeysResult extends AbstractVaultDTO<VaultTransitListKeysData, Object> {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package io.quarkus.vault.runtime.client.dto.transit;

import java.util.Map;

import com.fasterxml.jackson.annotation.JsonProperty;

import io.quarkus.vault.runtime.client.dto.VaultModel;

public class VaultTransitReadKeyData implements VaultModel {

public String detail;
@JsonProperty(value = "deletion_allowed")
public boolean deletionAllowed;
public boolean derived;
public boolean exportable;
@JsonProperty(value = "allow_plaintext_backup")
public boolean allowPlaintextBackup;
public Map<String, Integer> keys;
@JsonProperty(value = "min_decryption_version")
public int minDecryptionVersion;
@JsonProperty(value = "min_encryption_version")
public int minEncryptionVersion;
public String name;
@JsonProperty(value = "supports_encryption")
public boolean supportsEncryption;
@JsonProperty(value = "supports_decryption")
public boolean supportsDecryption;
@JsonProperty(value = "supports_derivation")
public boolean supportsDerivation;
@JsonProperty(value = "supports_signing")
public boolean supportsSigning;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package io.quarkus.vault.runtime.client.dto.transit;

import io.quarkus.vault.runtime.client.dto.AbstractVaultDTO;

public class VaultTransitReadKeyResult extends AbstractVaultDTO<VaultTransitReadKeyData, Object> {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package io.quarkus.vault;

/**
* key type used in transit key export
*/
public enum VaultTransitExportKeyType {
encryption,
signing,
hmac
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
package io.quarkus.vault;

import java.util.Map;

public class VaultTransitKeyDetail {

private String name;
private String detail;
private boolean deletionAllowed;
private boolean derived;
private boolean exportable;
private boolean allowPlaintextBackup;
private Map<String, Integer> keys;
private int minDecryptionVersion;
private int minEncryptionVersion;
private boolean supportsEncryption;
private boolean supportsDecryption;
private boolean supportsDerivation;
private boolean supportsSigning;

public String getName() {
return name;
}

public VaultTransitKeyDetail setName(String name) {
this.name = name;
return this;
}

public String getDetail() {
return detail;
}

public VaultTransitKeyDetail setDetail(String detail) {
this.detail = detail;
return this;
}

public boolean isDeletionAllowed() {
return deletionAllowed;
}

public VaultTransitKeyDetail setDeletionAllowed(boolean deletionAllowed) {
this.deletionAllowed = deletionAllowed;
return this;
}

public boolean isDerived() {
return derived;
}

public VaultTransitKeyDetail setDerived(boolean derived) {
this.derived = derived;
return this;
}

public boolean isExportable() {
return exportable;
}

public VaultTransitKeyDetail setExportable(boolean exportable) {
this.exportable = exportable;
return this;
}

public boolean isAllowPlaintextBackup() {
return allowPlaintextBackup;
}

public VaultTransitKeyDetail setAllowPlaintextBackup(boolean allowPlaintextBackup) {
this.allowPlaintextBackup = allowPlaintextBackup;
return this;
}

public Map<String, Integer> getKeys() {
return keys;
}

public VaultTransitKeyDetail setKeys(Map<String, Integer> keys) {
this.keys = keys;
return this;
}

public int getMinDecryptionVersion() {
return minDecryptionVersion;
}

public VaultTransitKeyDetail setMinDecryptionVersion(int minDecryptionVersion) {
this.minDecryptionVersion = minDecryptionVersion;
return this;
}

public int getMinEncryptionVersion() {
return minEncryptionVersion;
}

public VaultTransitKeyDetail setMinEncryptionVersion(int minEncryptionVersion) {
this.minEncryptionVersion = minEncryptionVersion;
return this;
}

public boolean isSupportsEncryption() {
return supportsEncryption;
}

public VaultTransitKeyDetail setSupportsEncryption(boolean supportsEncryption) {
this.supportsEncryption = supportsEncryption;
return this;
}

public boolean isSupportsDecryption() {
return supportsDecryption;
}

public VaultTransitKeyDetail setSupportsDecryption(boolean supportsDecryption) {
this.supportsDecryption = supportsDecryption;
return this;
}

public boolean isSupportsDerivation() {
return supportsDerivation;
}

public VaultTransitKeyDetail setSupportsDerivation(boolean supportsDerivation) {
this.supportsDerivation = supportsDerivation;
return this;
}

public boolean isSupportsSigning() {
return supportsSigning;
}

public VaultTransitKeyDetail setSupportsSigning(boolean supportsSigning) {
this.supportsSigning = supportsSigning;
return this;
}
}
Loading