How to create VAULT with CLI in EAP 6/7 ?

Solution Verified - Updated -

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP)
    • 6.x
    • 7.x

Issue

For EAP 6 :

  • I have create a keystore , and a vault . If I add the Vault section manually in the standalone.xml it works.
<vault>
  <vault-option name="KEYSTORE_URL" value="/path/to/vault.keystore"/>
  <vault-option name="KEYSTORE_PASSWORD" value="MASK-3rauBK.94Lxy3ergkZdex"/>
  <vault-option name="KEYSTORE_ALIAS" value="vault"/>
  <vault-option name="SALT" value="12345678"/>
  <vault-option name="ITERATION_COUNT" value="54"/>
  <vault-option name="ENC_FILE_DIR" value="/path/to/vault/"/>
</vault><management> 
  • But when vault is added through CLI it gives below error :
 /core-service=vault:add(vault-options=[("KEYSTORE_URL" => "/path/to/vault.keystore"),("KEYSTORE_PASSWORD" => "MASK-3rauBK.94Lxy3ergkZdex"),("KEYSTORE_ALIAS" => "vault"),"SALT" => "12345678" ),("ITERATION_COUNT" => "54"),("ENC_FILE_DIR" => "/path/to/vault/")])
{
    "outcome" => "failed",
    "failure-description" => "JBAS014749: Operation handler failed: JBAS015804: Error initializing vault --  org.jboss.as.server.services.security.VaultReaderException: JBAS013313: Vault Reader Exception:",
    "rolled-back" => true
}

For EAP 7 :

  • Below command returns an > sign when it is executed through CLI , it looks like if command is incomplete or there is some syntax error as described below :
/host=master/core-service=vault:add((vault-options=["KEYSTORE_URL" = "/app/jboss_vault/vault.keystore", "KEYSTORE_PASSWORD" = "MASK-0zPBD6RA./aCxRuyNhzfUY", "KEYSTORE_ALIAS" = "vault", "SALT" = "12345678, "ITERATION_COUNT" = "10", "ENC_FILE_DIR" = "/app/jboss_vault"]) 
>

Resolution

For EAP 6 :

  • The vault options are not a list so using [] might return exception.
  • The vault options are an object and can be defined using {} instead of [] - so the syntax becomes :
/core-service=vault:add(vault-options={ "KEYSTORE_URL" => "/path/to/vault.keystore", "KEYSTORE_PASSWORD" => "MASK-3rauBK.94Lxy3ergkZdex", "KEYSTORE_ALIAS" => "vault", "SALT" => "12345678", "ITERATION_COUNT" => "54", "ENC_FILE_DIR" => "/path/to/vault/"})

For EAP 7 :

  • Below command can be used to configure to use the password vault :
/host=master/core-service=vault:add(vault-options=
{KEYSTORE_URL="/path/to/vault.keystore",KEYSTORE_PASSWORD="MASK-3rauBK.94Lxy3ergkZdex",KEYSTORE_ALIAS="vault",SALT="12345678",ITERATION_COUNT="10"}

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.