Ludovic LACHEVRE
Ludovic LACHEVRE

Reputation: 121

Special characters with JBoss CLI

I am in domain mode with JBoss 6.4.8 version. I want to add these 4 system properties by CLI :

1- /host=myserver/server-config=node/system-property=javax.net.ssl.keyStorePassword:add(boot-time=false,value=${VAULT::vault_block::attribute_name::1})

2- /host=myserver/server-config=node/system-property=javax.net.ssl.trustStorePassword:add(boot-time=false,value=${VAULT::vault_block::attribute_name::1})

It doesn't work

 "outcome" => "failed",
    "result" => undefined,
    "failure-description" => "JBAS010839: Operation failed or was rolled back on all servers.",
    "rolled-back" => true

As you can see there is $, : and {} characters, is it my problem ?

In the past, i encountered this problem with the $ and i solve it by \$ but here it doesn't work !

Can you help me ?

Thanks a lot

Ludo

Upvotes: 4

Views: 6944

Answers (2)

Miguel Bautista
Miguel Bautista

Reputation: 696

Notice, vault references are not resolved if vault configuration was recently added, a restart or reload of the configuration is required before you set a vault reference.

When not resolving parameter values

When JBoss-cli is NOT configured to resolve parameter values (resolve-parameter-values set to false in jboss-cli.xml -by default-):

a) Escape with \$ when using the --command cli parameter (aka non-interactive mode)

/path/to/jboss-cli.sh -c --command="/host=myserver/server-config=node/system-property=javax.net.ssl.keyStorePassword:add(boot-time=false,value=\${VAULT::vault_block::attribute_name::1})"

b) Use direct reference when using interactive mode

/host=myserver/server-config=node/system-property=javax.net.ssl.keyStorePassword:add(boot-time=false,value=${VAULT::vault_block::attribute_name::1})

When resolving parameter values

When JBoss-cli is configured to resolve parameter values (resolve-parameter-values set to true in jboss-cli.xml):

c) Escape with \$\$ when using the --command cli parameter (this prevents parameter expansion in bash )

/path/to/jboss-cli.sh -c --command="/host=myserver/server-config=node/system-property=javax.net.ssl.keyStorePassword:add(boot-time=false,value=\$\${VAULT::vault_block::attribute_name::1})"

d) Escape with $$ when using the --file cli parameter

/path/to/jboss-cli.sh -c --file="/path/to/commands.cli"

commands.cli contents:

/host=myserver/server-config=node/system-property=javax.net.ssl.keyStorePassword:add(boot-time=false,value=$${VAULT::vault_block::attribute_name::1})"

or interactive mode

/host=myserver/server-config=node/system-property=javax.net.ssl.keyStorePassword:add(boot-time=false,value=$${VAULT::vault_block::attribute_name::1})

Upvotes: 4

Andrew
Andrew

Reputation: 4622

Not sure about 6.4, but in 7 as per https://access.redhat.com/documentation/en/red-hat-jboss-enterprise-application-platform/7.0/single/management-cli-guide/#cli_special_characters you can enclose a value with "" or {}, so in your case you should put it inside ""

Upvotes: 1

Related Questions