Skip to content

Commit

Permalink
Add support for Vault’s PKI secret engine
Browse files Browse the repository at this point in the history
* Supports all endpoints of PKI secret engine, except prvileged endpoints.
* Has complete test coverage for all endpoints and options.
  • Loading branch information
kdubb committed Jul 14, 2021
1 parent dd4d221 commit 43dd636
Show file tree
Hide file tree
Showing 60 changed files with 3,471 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
import io.quarkus.vault.runtime.VaultDbManager;
import io.quarkus.vault.runtime.VaultKubernetesAuthManager;
import io.quarkus.vault.runtime.VaultKvManager;
import io.quarkus.vault.runtime.VaultPKIManager;
import io.quarkus.vault.runtime.VaultPKIManagerFactory;
import io.quarkus.vault.runtime.VaultRecorder;
import io.quarkus.vault.runtime.VaultSystemBackendManager;
import io.quarkus.vault.runtime.VaultTOTPManager;
Expand All @@ -38,6 +40,7 @@
import io.quarkus.vault.runtime.client.secretengine.VaultInternalDatabaseSecretEngine;
import io.quarkus.vault.runtime.client.secretengine.VaultInternalKvV1SecretEngine;
import io.quarkus.vault.runtime.client.secretengine.VaultInternalKvV2SecretEngine;
import io.quarkus.vault.runtime.client.secretengine.VaultInternalPKISecretEngine;
import io.quarkus.vault.runtime.client.secretengine.VaultInternalTOPTSecretEngine;
import io.quarkus.vault.runtime.client.secretengine.VaultInternalTransitSecretEngine;
import io.quarkus.vault.runtime.config.VaultBootstrapConfig;
Expand Down Expand Up @@ -87,6 +90,8 @@ AdditionalBeanBuildItem registerAdditionalBeans() {
.addBeanClass(VaultDbManager.class)
.addBeanClass(VertxVaultClient.class)
.addBeanClass(VaultConfigHolder.class)
.addBeanClass(VaultPKIManager.class)
.addBeanClass(VaultPKIManagerFactory.class)
.addBeanClass(VaultInternalKvV1SecretEngine.class)
.addBeanClass(VaultInternalKvV2SecretEngine.class)
.addBeanClass(VaultInternalTransitSecretEngine.class)
Expand All @@ -97,6 +102,7 @@ AdditionalBeanBuildItem registerAdditionalBeans() {
.addBeanClass(VaultInternalTokenAuthMethod.class)
.addBeanClass(VaultInternalUserpassAuthMethod.class)
.addBeanClass(VaultInternalDatabaseSecretEngine.class)
.addBeanClass(VaultInternalPKISecretEngine.class)
.build();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package io.quarkus.vault.runtime.client.dto.pki;

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

public class VaultPKICRLRotateData implements VaultModel {
public boolean success;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package io.quarkus.vault.runtime.client.dto.pki;

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

public class VaultPKICRLRotateResult extends AbstractVaultDTO<VaultPKICRLRotateData, Object> {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package io.quarkus.vault.runtime.client.dto.pki;

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

public class VaultPKICertificateData implements VaultModel {
public String certificate;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package io.quarkus.vault.runtime.client.dto.pki;

import java.util.List;

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

public class VaultPKICertificateListData 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.pki;

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

public class VaultPKICertificateListResult extends AbstractVaultDTO<VaultPKICertificateListData, Object> {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package io.quarkus.vault.runtime.client.dto.pki;

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

public class VaultPKICertificateResult extends AbstractVaultDTO<VaultPKICertificateData, Object> {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package io.quarkus.vault.runtime.client.dto.pki;

import com.fasterxml.jackson.annotation.JsonProperty;

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

public class VaultPKIConfigCABody implements VaultModel {

@JsonProperty("pem_bundle")
public String pemBundle;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package io.quarkus.vault.runtime.client.dto.pki;

public class VaultPKIConfigCRLBody extends VaultPKIConfigCRLData {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package io.quarkus.vault.runtime.client.dto.pki;

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

public class VaultPKIConfigCRLData implements VaultModel {

public String expiry;

public Boolean disable;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package io.quarkus.vault.runtime.client.dto.pki;

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

public class VaultPKIConfigCRLResult extends AbstractVaultDTO<VaultPKIConfigCRLData, Object> {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package io.quarkus.vault.runtime.client.dto.pki;

public class VaultPKIConfigURLsBody extends VaultPKIConfigURLsData {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package io.quarkus.vault.runtime.client.dto.pki;

import java.util.List;

import com.fasterxml.jackson.annotation.JsonProperty;

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

public class VaultPKIConfigURLsData implements VaultModel {

@JsonProperty("issuing_certificates")
public List<String> issuingCertificates;

@JsonProperty("crl_distribution_points")
public List<String> crlDistributionPoints;

@JsonProperty("ocsp_servers")
public List<String> ocspServers;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package io.quarkus.vault.runtime.client.dto.pki;

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

public class VaultPKIConfigURLsResult extends AbstractVaultDTO<VaultPKIConfigURLsData, Object> {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package io.quarkus.vault.runtime.client.dto.pki;

import java.util.List;

import com.fasterxml.jackson.annotation.JsonProperty;

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

public class VaultPKIGenerateCertificateBody implements VaultModel {

@JsonProperty("common_name")
public String subjectCommonName;

@JsonProperty("alt_names")
public String subjectAlternativeNames;

@JsonProperty("ip_sans")
public String ipSubjectAlternativeNames;

@JsonProperty("uri_sans")
public String uriSubjectAlternativeNames;

@JsonProperty("other_sans")
public List<String> otherSubjectAlternativeNames;

@JsonProperty("ttl")
public String timeToLive;

public String format = "pem";

@JsonProperty("private_key_format")
public String privateKeyFormat = "pkcs8";

@JsonProperty("exclude_cn_from_sans")
public Boolean excludeCommonNameFromSubjectAlternativeNames;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package io.quarkus.vault.runtime.client.dto.pki;

import java.util.List;

import com.fasterxml.jackson.annotation.JsonProperty;

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

public class VaultPKIGenerateCertificateData implements VaultModel {

public String certificate;

@JsonProperty("issuing_ca")
public String issuingCA;

@JsonProperty("ca_chain")
public List<String> caChain;

@JsonProperty("private_key")
public String privateKey;

@JsonProperty("private_key_type")
public String privateKeyType;

@JsonProperty("serial_number")
public String serialNumber;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package io.quarkus.vault.runtime.client.dto.pki;

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

public class VaultPKIGenerateCertificateResult extends AbstractVaultDTO<VaultPKIGenerateCertificateData, Object> {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
package io.quarkus.vault.runtime.client.dto.pki;

import java.util.List;

import com.fasterxml.jackson.annotation.JsonProperty;

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

public class VaultPKIGenerateIntermediateCSRBody implements VaultModel {

@JsonProperty("common_name")
public String subjectCommonName;

@JsonProperty("organization")
public String subjectOrganization;

@JsonProperty("ou")
public String subjectOrganizationalUnit;

@JsonProperty("street_address")
public String subjectStreetAddress;

@JsonProperty("postal_code")
public String subjectPostalCode;

@JsonProperty("locality")
public String subjectLocality;

@JsonProperty("province")
public String subjectProvince;

@JsonProperty("country")
public String subjectCountry;

@JsonProperty("alt_names")
public String subjectAlternativeNames;

@JsonProperty("ip_sans")
public String ipSubjectAlternativeNames;

@JsonProperty("uri_sans")
public String uriSubjectAlternativeNames;

@JsonProperty("other_sans")
public List<String> otherSubjectAlternativeNames;

@JsonProperty("serial_number")
public String subjectSerialNumber;

public String format = "pem";

@JsonProperty("private_key_format")
public String privateKeyFormat = "pkcs8";

@JsonProperty("key_type")
public String keyType;

@JsonProperty("key_bits")
public Integer keyBits;

@JsonProperty("exclude_cn_from_sans")
public Boolean excludeCommonNameFromSubjectAlternativeNames;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package io.quarkus.vault.runtime.client.dto.pki;

import com.fasterxml.jackson.annotation.JsonProperty;

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

public class VaultPKIGenerateIntermediateCSRData implements VaultModel {

public String csr;

@JsonProperty("private_key")
public String privateKey;

@JsonProperty("private_key_type")
public String privateKeyType;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package io.quarkus.vault.runtime.client.dto.pki;

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

public class VaultPKIGenerateIntermediateCSRResult extends AbstractVaultDTO<VaultPKIGenerateIntermediateCSRData, Object> {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
package io.quarkus.vault.runtime.client.dto.pki;

import java.util.List;

import com.fasterxml.jackson.annotation.JsonProperty;

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

public class VaultPKIGenerateRootBody implements VaultModel {

@JsonProperty("common_name")
public String subjectCommonName;

@JsonProperty("organization")
public String subjectOrganization;

@JsonProperty("ou")
public String subjectOrganizationalUnit;

@JsonProperty("street_address")
public String subjectStreetAddress;

@JsonProperty("postal_code")
public String subjectPostalCode;

@JsonProperty("locality")
public String subjectLocality;

@JsonProperty("province")
public String subjectProvince;

@JsonProperty("country")
public String subjectCountry;

@JsonProperty("alt_names")
public String subjectAlternativeNames;

@JsonProperty("ip_sans")
public String ipSubjectAlternativeNames;

@JsonProperty("uri_sans")
public String uriSubjectAlternativeNames;

@JsonProperty("other_sans")
public List<String> otherSubjectAlternativeNames;

@JsonProperty("serial_number")
public String subjectSerialNumber;

@JsonProperty("ttl")
public String timeToLive;

public String format = "pem";

@JsonProperty("private_key_format")
public String privateKeyFormat = "pkcs8";

@JsonProperty("key_type")
public String keyType;

@JsonProperty("key_bits")
public Integer keyBits;

@JsonProperty("max_path_length")
public Integer maxPathLength;

@JsonProperty("exclude_cn_from_sans")
public Boolean excludeCommonNameFromSubjectAlternativeNames;

@JsonProperty("permitted_dns_domains")
public List<String> permittedDnsDomains;

}
Loading

0 comments on commit 43dd636

Please sign in to comment.