Philip W
Philip W

Reputation: 1

wildfly elytron setting the system property from encryption:create-expression fails WFLYCTL0097 Expected [EXPRESSION, STRING] but was OBJECT

I am using wildfly-33.0.0.Final and trying to set the encrypted value of a parameter through a cli script.

Basically I am trying to do the following:

 /system-property=aaa:add(value=`/subsystem=elytron/expression=encryption:create-expression( resolver=initial-resolver, clear-text=MyPassword)`)

It fails with:

{
    "outcome" => "failed",
    "failure-description" => "WFLYCTL0097: Wrong type for 'value'. Expected [EXPRESSION, STRING] but was OBJECT",
    "rolled-back" => true
}

Running the command by itself works:
{
    "outcome" => "success",
    "result" => {"expression" => "${ENC::initial-resolver:RUxZAUMQoZDjFfjIaeCy9ETpuoyrgwTDkWg8ZyKKBUytd92IgGM=}"}
}

When I set it as a variable manually:

<property name="aaa" value="${ENC:initial-resolver:RUxZAUMQTnTEH2mZfEfZ1oGcTsuAzc/gls/LyJe/XUxFnLgXuoE=}"/>

When I try to set a variable locally:

 set aaa=`/subsystem=elytron/expression=encryption:create-expression( resolver=initial-resolver, clear-text=MyPassword)`
echo $aaa
{"expression" => ":initial-resolver:RUxZAUMQn6sd6FR+ERTzI4uGgrZLzIVWuNWLGtQ+bRnKYKl/pEI="}

I think it may be evaluating the ${ENC: but I am not sure.

I need it to be repeatable and set the value of the parameter as part of a script so we can run this as part of our deployment scripts.

This is so much more complicated than the simple vault used to be...

Any help would be appreciated.

I looked at the following:

https://wildfly-security.github.io/wildfly-elytron/blog/wildfly-encrypted-expressions/ https://www.mastertheboss.com/jbossas/jboss-script/using-properties-in-cli-scripts/ ...

Tried:

 /system-property=aaa:add(value=`/subsystem=elytron/expression=encryption:create-expression( resolver=initial-resolver, clear-text=MyPassword)`)

Expected:

<property name="aaa" value="${ENC:initial-resolver:RUxZAUMQTnTEH2mZfEfZ1oGcTsuAzc/gls/LyJe/XUxFnLgXuoE=}"/>

Failed with:

{
    "outcome" => "failed",
    "failure-description" => "WFLYCTL0097: Wrong type for 'value'. Expected [EXPRESSION, STRING] but was OBJECT",
    "rolled-back" => true
}

Upvotes: 0

Views: 51

Answers (0)

Related Questions