Configuration Security - Vault

You can also store sensitive settings inside Vault. Vault can store your existing secrets, or it can dynamically generate new secrets to control access to third-party resources or provide time-limited credentials for your infrastructure. To learn more about Vault and its installation process, please visit the project website.

Once vault is accessible and configured inside CAS, support is provided via the following dependency:

1
2
3
4
5
<dependency>
    <groupId>org.apereo.cas</groupId>
    <artifactId>cas-server-support-configuration-cloud-vault</artifactId>
    <version>${cas.version}</version>
</dependency>
1
implementation "org.apereo.cas:cas-server-support-configuration-cloud-vault:${project.'cas.version'}"
1
2
3
4
5
6
7
8
9
dependencyManagement {
    imports {
        mavenBom "org.apereo.cas:cas-server-support-bom:${project.'cas.version'}"
    }
}

dependencies {
    implementation "org.apereo.cas:cas-server-support-configuration-cloud-vault"
}
1
2
3
4
5
6
7
8
9
10
dependencies {
    /*
    The following platform references should be included automatically and are listed here for reference only.
            
    implementation enforcedPlatform("org.apereo.cas:cas-server-support-bom:${project.'cas.version'}")
    implementation platform(org.springframework.boot.gradle.plugin.SpringBootPlugin.BOM_COORDINATES)
    */

    implementation "org.apereo.cas:cas-server-support-configuration-cloud-vault"
}

The following settings and properties are available from the CAS configuration catalog:

The configuration settings listed below are tagged as Required in the CAS configuration metadata. This flag indicates that the presence of the setting may be needed to activate or affect the behavior of the CAS feature and generally should be reviewed, possibly owned and adjusted. If the setting is assigned a default value, you do not need to strictly put the setting in your copy of the configuration, but should review it nonetheless to make sure it matches your deployment expectations.

The configuration settings listed below are tagged as Optional in the CAS configuration metadata. This flag indicates that the presence of the setting is not immediately necessary in the end-user CAS configuration, because a default value is assigned or the activation of the feature is not conditionally controlled by the setting value. In other words, you should only include this field in your configuration if you need to modify the default value or if you need to turn on the feature controlled by the setting.

The configuration settings listed below are tagged as Third Party in the CAS configuration metadata. This flag indicates that the configuration setting is not controlled, owned or managed by the CAS ecosystem, and affects functionality that is offered by a third-party library, such as Spring Boot or Spring Cloud to CAS. For additional info, you might have to visit the third-party source to find more details.

  • spring.cloud.vault.app-id.app-id-path=app-id
  • Mount path of the AppId authentication backend.

    org.springframework.cloud.vault.config.VaultProperties$AppIdProperties.

    How can I configure this property?

  • spring.cloud.vault.app-id.network-interface=
  • Network interface hint for the "MAC_ADDRESS" UserId mechanism.

    org.springframework.cloud.vault.config.VaultProperties$AppIdProperties.

    How can I configure this property?

  • spring.cloud.vault.app-id.user-id=MAC_ADDRESS
  • UserId mechanism. Can be either "MAC_ADDRESS", "IP_ADDRESS", a string or a class name.

    org.springframework.cloud.vault.config.VaultProperties$AppIdProperties.

    How can I configure this property?

  • spring.cloud.vault.app-role.app-role-path=approle
  • Mount path of the AppRole authentication backend.

    org.springframework.cloud.vault.config.VaultProperties$AppRoleProperties.

    How can I configure this property?

  • spring.cloud.vault.app-role.role=
  • Name of the role, optional, used for pull-mode.

    org.springframework.cloud.vault.config.VaultProperties$AppRoleProperties.

    How can I configure this property?

  • spring.cloud.vault.app-role.role-id=
  • The RoleId.

    org.springframework.cloud.vault.config.VaultProperties$AppRoleProperties.

    How can I configure this property?

  • spring.cloud.vault.app-role.secret-id=
  • The SecretId.

    org.springframework.cloud.vault.config.VaultProperties$AppRoleProperties.

    How can I configure this property?

  • spring.cloud.vault.application-name=application
  • Application name for AppId authentication.

    org.springframework.cloud.vault.config.VaultProperties.

    How can I configure this property?

  • spring.cloud.vault.authentication=
  • org.springframework.cloud.vault.config.VaultProperties.

    How can I configure this property?

  • spring.cloud.vault.aws-ec2.aws-ec2-path=aws-ec2
  • Mount path of the AWS-EC2 authentication backend.

    org.springframework.cloud.vault.config.VaultProperties$AwsEc2Properties.

    How can I configure this property?

  • spring.cloud.vault.aws-ec2.identity-document=http://169.254.169.254/latest/dynamic/instance-identity/pkcs7
  • URL of the AWS-EC2 PKCS7 identity document.

    org.springframework.cloud.vault.config.VaultProperties$AwsEc2Properties.

    How can I configure this property?

  • spring.cloud.vault.aws-ec2.nonce=
  • Nonce used for AWS-EC2 authentication. An empty nonce defaults to nonce generation.

    org.springframework.cloud.vault.config.VaultProperties$AwsEc2Properties.

    How can I configure this property?

  • spring.cloud.vault.aws-ec2.role=
  • Name of the role, optional.

    org.springframework.cloud.vault.config.VaultProperties$AwsEc2Properties.

    How can I configure this property?

  • spring.cloud.vault.aws-iam.aws-path=aws
  • Mount path of the AWS authentication backend.

    org.springframework.cloud.vault.config.VaultProperties$AwsIamProperties.

    How can I configure this property?

  • spring.cloud.vault.aws-iam.endpoint-uri=
  • STS server URI. @since 2.2

    org.springframework.cloud.vault.config.VaultProperties$AwsIamProperties.

    How can I configure this property?

  • spring.cloud.vault.aws-iam.region=
  • Name of the region, optional. Inferred by AWS defaults if not set. @since 4.0.1

    org.springframework.cloud.vault.config.VaultProperties$AwsIamProperties.

    How can I configure this property?

  • spring.cloud.vault.aws-iam.role=
  • Name of the role, optional. Defaults to the friendly IAM name if not set.

    org.springframework.cloud.vault.config.VaultProperties$AwsIamProperties.

    How can I configure this property?

  • spring.cloud.vault.aws-iam.server-name=
  • Name of the server used to set X-Vault-AWS-IAM-Server-ID header in the headers of login requests.

    org.springframework.cloud.vault.config.VaultProperties$AwsIamProperties.

    How can I configure this property?

  • spring.cloud.vault.azure-msi.azure-path=azure
  • Mount path of the Azure MSI authentication backend.

    org.springframework.cloud.vault.config.VaultProperties$AzureMsiProperties.

    How can I configure this property?

  • spring.cloud.vault.azure-msi.identity-token-service=
  • Identity token service URI. @since 3.0

    org.springframework.cloud.vault.config.VaultProperties$AzureMsiProperties.

    How can I configure this property?

  • spring.cloud.vault.azure-msi.metadata-service=
  • Instance metadata service URI. @since 3.0

    org.springframework.cloud.vault.config.VaultProperties$AzureMsiProperties.

    How can I configure this property?

  • spring.cloud.vault.azure-msi.role=
  • Name of the role.

    org.springframework.cloud.vault.config.VaultProperties$AzureMsiProperties.

    How can I configure this property?

  • spring.cloud.vault.config.lifecycle.enabled=true
  • Enable lifecycle management.

    org.springframework.cloud.vault.config.VaultProperties$ConfigLifecycle.

    How can I configure this property?

  • spring.cloud.vault.config.lifecycle.expiry-threshold=
  • The expiry threshold. Lease is renewed the given Duration before it expires. @since 2.2

    org.springframework.cloud.vault.config.VaultProperties$ConfigLifecycle.

    How can I configure this property?

  • spring.cloud.vault.config.lifecycle.lease-endpoints=
  • Set the LeaseEndpoints to delegate renewal/revocation calls to. LeaseEndpoints encapsulates differences between Vault versions that affect the location of renewal/revocation endpoints. Can be LeaseEndpoints#SysLeases for version 0.8 or above of Vault or LeaseEndpoints#Legacy for older versions (the default). @since 2.2

    org.springframework.cloud.vault.config.VaultProperties$ConfigLifecycle.

    How can I configure this property?

  • spring.cloud.vault.config.lifecycle.lease-strategy=
  • Sets the LeaseStrategy to be used with org.springframework.vault.core.lease.SecretLeaseContainer#setLeaseStrategy(LeaseStrategy) to retain or drop tokens on renewal errors. @since 4.1

    org.springframework.cloud.vault.config.VaultProperties$ConfigLifecycle.

    How can I configure this property?

  • spring.cloud.vault.config.lifecycle.min-renewal=
  • The time period that is at least required before renewing a lease. @since 2.2

    org.springframework.cloud.vault.config.VaultProperties$ConfigLifecycle.

    How can I configure this property?

  • spring.cloud.vault.config.order=0
  • Used to set a org.springframework.core.env.PropertySource priority. This is useful to use Vault as an override on other property sources. @see org.springframework.core.PriorityOrdered

    org.springframework.cloud.vault.config.VaultProperties$Config.

    How can I configure this property?

    Deprecation status is WARNINGwithout a replacement setting.

  • spring.cloud.vault.connection-timeout=5000
  • Connection timeout.

    org.springframework.cloud.vault.config.VaultProperties.

    How can I configure this property?

  • spring.cloud.vault.discovery.enabled=false
  • Flag to indicate that Vault server discovery is enabled (vault server URL will be looked up via discovery).

    org.springframework.cloud.vault.config.VaultProperties$Discovery.

    How can I configure this property?

  • spring.cloud.vault.discovery.service-id=vault
  • Service id to locate Vault.

    org.springframework.cloud.vault.config.VaultProperties$Discovery.

    How can I configure this property?

  • spring.cloud.vault.enabled=true
  • Enable Vault config server.

    org.springframework.cloud.vault.config.VaultProperties.

    How can I configure this property?

  • spring.cloud.vault.fail-fast=false
  • Fail fast if data cannot be obtained from Vault.

    org.springframework.cloud.vault.config.VaultProperties.

    How can I configure this property?

  • spring.cloud.vault.gcp-gce.gcp-path=gcp
  • Mount path of the Kubernetes authentication backend.

    org.springframework.cloud.vault.config.VaultProperties$GcpGceProperties.

    How can I configure this property?

  • spring.cloud.vault.gcp-gce.role=
  • Name of the role against which the login is being attempted.

    org.springframework.cloud.vault.config.VaultProperties$GcpGceProperties.

    How can I configure this property?

  • spring.cloud.vault.gcp-gce.service-account=
  • Optional service account id. Using the default id if left unconfigured.

    org.springframework.cloud.vault.config.VaultProperties$GcpGceProperties.

    How can I configure this property?

  • spring.cloud.vault.gcp-iam.credentials.encoded-key=
  • The base64 encoded contents of an OAuth2 account private key in JSON format.

    org.springframework.cloud.vault.config.VaultProperties$GcpCredentials.

    How can I configure this property?

  • spring.cloud.vault.gcp-iam.credentials.location=
  • Location of the OAuth2 credentials private key.

    Since this is a Resource, the private key can be in a multitude of locations, such as a local file system, classpath, URL, etc.

    org.springframework.cloud.vault.config.VaultProperties$GcpCredentials.

    How can I configure this property?

  • spring.cloud.vault.gcp-iam.gcp-path=gcp
  • Mount path of the Kubernetes authentication backend.

    org.springframework.cloud.vault.config.VaultProperties$GcpIamProperties.

    How can I configure this property?

  • spring.cloud.vault.gcp-iam.jwt-validity=15m
  • Validity of the JWT token.

    org.springframework.cloud.vault.config.VaultProperties$GcpIamProperties.

    How can I configure this property?

  • spring.cloud.vault.gcp-iam.project-id=
  • Overrides the GCP project Id.

    org.springframework.cloud.vault.config.VaultProperties$GcpIamProperties.

    How can I configure this property?

  • spring.cloud.vault.gcp-iam.role=
  • Name of the role against which the login is being attempted.

    org.springframework.cloud.vault.config.VaultProperties$GcpIamProperties.

    How can I configure this property?

  • spring.cloud.vault.gcp-iam.service-account-id=
  • Overrides the GCP service account Id.

    org.springframework.cloud.vault.config.VaultProperties$GcpIamProperties.

    How can I configure this property?

  • spring.cloud.vault.host=localhost
  • Vault server host.

    org.springframework.cloud.vault.config.VaultProperties.

    How can I configure this property?

  • spring.cloud.vault.kubernetes.kubernetes-path=kubernetes
  • Mount path of the Kubernetes authentication backend.

    org.springframework.cloud.vault.config.VaultProperties$KubernetesProperties.

    How can I configure this property?

  • spring.cloud.vault.kubernetes.role=
  • Name of the role against which the login is being attempted.

    org.springframework.cloud.vault.config.VaultProperties$KubernetesProperties.

    How can I configure this property?

  • spring.cloud.vault.kubernetes.service-account-token-file=/var/run/secrets/kubernetes.io/serviceaccount/token
  • Path to the service account token file.

    org.springframework.cloud.vault.config.VaultProperties$KubernetesProperties.

    How can I configure this property?

  • spring.cloud.vault.kv.application-name=application
  • Application name to be used for the context.

    org.springframework.cloud.vault.config.VaultKeyValueBackendProperties.

    How can I configure this property?

  • spring.cloud.vault.kv.backend=secret
  • Name of the default backend.

    org.springframework.cloud.vault.config.VaultKeyValueBackendProperties.

    How can I configure this property?

  • spring.cloud.vault.kv.backend-version=2
  • Key-Value backend version. Currently supported versions are:

    • Version 1 (unversioned key-value backend).
    • Version 2 (versioned key-value backend).

    org.springframework.cloud.vault.config.VaultKeyValueBackendProperties.

    How can I configure this property?

    Deprecation status is WARNINGwithout a replacement setting.

  • spring.cloud.vault.kv.default-context=application
  • Name of the default context.

    org.springframework.cloud.vault.config.VaultKeyValueBackendProperties.

    How can I configure this property?

  • spring.cloud.vault.kv.enabled=true
  • Enable the key-value backend.

    org.springframework.cloud.vault.config.VaultKeyValueBackendProperties.

    How can I configure this property?

  • spring.cloud.vault.kv.profile-separator=/
  • Profile-separator to combine application name and profile.

    org.springframework.cloud.vault.config.VaultKeyValueBackendProperties.

    How can I configure this property?

  • spring.cloud.vault.kv.profiles=
  • List of active profiles. @since 3.0

    org.springframework.cloud.vault.config.VaultKeyValueBackendProperties.

    How can I configure this property?

  • spring.cloud.vault.namespace=
  • Vault namespace (requires Vault Enterprise).

    org.springframework.cloud.vault.config.VaultProperties.

    How can I configure this property?

  • spring.cloud.vault.pcf.instance-certificate=
  • Path to the instance certificate (PEM). Defaults to CF_INSTANCE_CERT env variable.

    org.springframework.cloud.vault.config.VaultProperties$PcfProperties.

    How can I configure this property?

  • spring.cloud.vault.pcf.instance-key=
  • Path to the instance key (PEM). Defaults to CF_INSTANCE_KEY env variable.

    org.springframework.cloud.vault.config.VaultProperties$PcfProperties.

    How can I configure this property?

  • spring.cloud.vault.pcf.pcf-path=pcf
  • Mount path of the Kubernetes authentication backend.

    org.springframework.cloud.vault.config.VaultProperties$PcfProperties.

    How can I configure this property?

  • spring.cloud.vault.pcf.role=
  • Name of the role against which the login is being attempted.

    org.springframework.cloud.vault.config.VaultProperties$PcfProperties.

    How can I configure this property?

  • spring.cloud.vault.port=8200
  • Vault server port.

    org.springframework.cloud.vault.config.VaultProperties.

    How can I configure this property?

  • spring.cloud.vault.reactive.enabled=true
  • Flag to indicate that reactive discovery is enabled

    org.springframework.cloud.vault.config.VaultProperties$Reactive.

    How can I configure this property?

  • spring.cloud.vault.read-timeout=15000
  • Read timeout.

    org.springframework.cloud.vault.config.VaultProperties.

    How can I configure this property?

  • spring.cloud.vault.scheme=https
  • Protocol scheme. Can be either "http" or "https".

    org.springframework.cloud.vault.config.VaultProperties.

    How can I configure this property?

  • spring.cloud.vault.session.lifecycle.enabled=true
  • Enable session lifecycle management.

    org.springframework.cloud.vault.config.VaultProperties$SessionLifecycle.

    How can I configure this property?

  • spring.cloud.vault.session.lifecycle.expiry-threshold=7s
  • The expiry threshold for a LoginToken. The threshold represents a minimum TTL duration to consider a login token as valid. Tokens with a shorter TTL are considered expired and are not used anymore. Should be greater than refreshBeforeExpiry to prevent token expiry.

    org.springframework.cloud.vault.config.VaultProperties$SessionLifecycle.

    How can I configure this property?

  • spring.cloud.vault.session.lifecycle.refresh-before-expiry=5s
  • The time period that is at least required before renewing the LoginToken.

    org.springframework.cloud.vault.config.VaultProperties$SessionLifecycle.

    How can I configure this property?

  • spring.cloud.vault.ssl.cert-auth-path=cert
  • Mount path of the TLS cert authentication backend.

    org.springframework.cloud.vault.config.VaultProperties$Ssl.

    How can I configure this property?

  • spring.cloud.vault.ssl.enabled-cipher-suites=
  • List of enabled SSL/TLS cipher suites. @since 3.0.2

    org.springframework.cloud.vault.config.VaultProperties$Ssl.

    How can I configure this property?

  • spring.cloud.vault.ssl.enabled-protocols=
  • List of enabled SSL/TLS protocol. @since 3.0.2

    org.springframework.cloud.vault.config.VaultProperties$Ssl.

    How can I configure this property?

  • spring.cloud.vault.ssl.key-store=
  • Trust store that holds certificates and private keys.

    org.springframework.cloud.vault.config.VaultProperties$Ssl.

    How can I configure this property?

  • spring.cloud.vault.ssl.key-store-password=
  • Password used to access the key store.

    org.springframework.cloud.vault.config.VaultProperties$Ssl.

    How can I configure this property?

  • spring.cloud.vault.ssl.key-store-type=
  • Type of the key store. @since 3.0

    org.springframework.cloud.vault.config.VaultProperties$Ssl.

    How can I configure this property?

  • spring.cloud.vault.ssl.trust-store=
  • Trust store that holds SSL certificates.

    org.springframework.cloud.vault.config.VaultProperties$Ssl.

    How can I configure this property?

  • spring.cloud.vault.ssl.trust-store-password=
  • Password used to access the trust store.

    org.springframework.cloud.vault.config.VaultProperties$Ssl.

    How can I configure this property?

  • spring.cloud.vault.ssl.trust-store-type=
  • Type of the trust store. @since 3.0

    org.springframework.cloud.vault.config.VaultProperties$Ssl.

    How can I configure this property?

  • spring.cloud.vault.token=
  • Static vault token. Required if #authentication is TOKEN.

    org.springframework.cloud.vault.config.VaultProperties.

    How can I configure this property?

  • spring.cloud.vault.uri=
  • Vault URI. Can be set with scheme, host and port.

    org.springframework.cloud.vault.config.VaultProperties.

    How can I configure this property?

    Configuration Metadata

    The collection of configuration properties listed in this section are automatically generated from the CAS source and components that contain the actual field definitions, types, descriptions, modules, etc. This metadata may not always be 100% accurate, or could be lacking details and sufficient explanations.

    Be Selective

    This section is meant as a guide only. Do NOT copy/paste the entire collection of settings into your CAS configuration; rather pick only the properties that you need. Do NOT enable settings unless you are certain of their purpose and do NOT copy settings into your configuration only to keep them as reference. All these ideas lead to upgrade headaches, maintenance nightmares and premature aging.

    YAGNI

    Note that for nearly ALL use cases, declaring and configuring properties listed here is sufficient. You should NOT have to explicitly massage a CAS XML/Java/etc configuration file to design an authentication handler, create attribute release policies, etc. CAS at runtime will auto-configure all required changes for you. If you are unsure about the meaning of a given CAS setting, do NOT turn it on without hesitation. Review the codebase or better yet, ask questions to clarify the intended behavior.

    Naming Convention

    Property names can be specified in very relaxed terms. For instance cas.someProperty, cas.some-property, cas.some_property are all valid names. While all forms are accepted by CAS, there are certain components (in CAS and other frameworks used) whose activation at runtime is conditional on a property value, where this property is required to have been specified in CAS configuration using kebab case. This is both true for properties that are owned by CAS as well as those that might be presented to the system via an external library or framework such as Spring Boot, etc.

    :information_source: Note

    When possible, properties should be stored in lower-case kebab format, such as cas.property-name=value. The only possible exception to this rule is when naming actuator endpoints; The name of the actuator endpoints (i.e. ssoSessions) MUST remain in camelCase mode.

    Settings and properties that are controlled by the CAS platform directly always begin with the prefix cas. All other settings are controlled and provided to CAS via other underlying frameworks and may have their own schemas and syntax. BE CAREFUL with the distinction. Unrecognized properties are rejected by CAS and/or frameworks upon which CAS depends. This means if you somehow misspell a property definition or fail to adhere to the dot-notation syntax and such, your setting is entirely refused by CAS and likely the feature it controls will never be activated in the way you intend.

    Validation

    Configuration properties are automatically validated on CAS startup to report issues with configuration binding, specially if defined CAS settings cannot be recognized or validated by the configuration schema. Additional validation processes are also handled via Configuration Metadata and property migrations applied automatically on startup by Spring Boot and family.

    Indexed Settings

    CAS settings able to accept multiple values are typically documented with an index, such as cas.some.setting[0]=value. The index [0] is meant to be incremented by the adopter to allow for distinct multiple configuration blocks.

    With CAS, secrets are picked up at startup of the application server. CAS uses the data and settings from the application name (i.e. cas) and active profiles to determine contexts paths in which secrets should be stored and later fetched.

    These context paths typically are:

    1
    2
    
    /secret/{application}/{profile}
    /secret/{application}
    

    As an example, you may write the following CAS setting to Vault:

    1
    
    vault write secret/cas/native <setting-name>=<value>
    

    CAS will execute the equivalent of the following command to read settings later when needed:

    1
    
    vault read secret/cas/native
    

    All settings and secrets that are stored inside Vault may be reloaded at any given time. To learn more about how CAS allows you to reload configuration changes, please review this guide. To learn more about how configuration is managed and profiled by CAS, please review this guide.

    Troubleshooting

    To enable additional logging, modify the logging configuration file to add the following:

    1
    2
    3
    4
    
    <Logger name="org.springframework.cloud.vault" level="debug" additivity="false">
        <AppenderRef ref="casConsole"/>
        <AppenderRef ref="casFile"/>
    </Logger>