Bug 1029079

Summary: Installer must escape backslashes in paths during post-install configuration
Product: [JBoss] JBoss Enterprise Application Platform 6 Reporter: Petr Kremensky <pkremens>
Component: InstallerAssignee: Francisco Canas <fcanas>
Status: CLOSED CURRENTRELEASE QA Contact: Petr Kremensky <pkremens>
Severity: urgent Docs Contact: Russell Dickenson <rdickens>
Priority: unspecified    
Version: 6.2.0CC: fcanas, mtjandra, thauser
Target Milestone: CR3   
Target Release: EAP 6.2.0   
Hardware: Unspecified   
OS: Windows   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-12-15 16:15:44 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Petr Kremensky 2013-11-11 15:49:49 UTC
Description of problem:
 Installer must escape '\' used as path delimiter on windows for all post-install actions, because '\' is omitted. 

Version-Release number of selected component (if applicable):
 EAP 6.2.0.ER7

How reproducible:
 Always

Steps to Reproduce:
 1. Run gui installer. Use default options to get onto Post-intall configuration screen. 
 2. Choose to "Enable SSL security".
 3. On SSL screen enter some password and location of keystore (eg. W:\pkremens\installer\ssl.keystore)
 4. Finish the installation and observe server configuration files (eg.standalone.xml)

Actual results:
 command in batch: 
/core-service=management/security-realm=ManagementRealm/server-identity=ssl:add(keystore-path=W:\pkremens\installer\ssl.keystore,keystore-password="password")
 content of standalone.xml file:
<ssl>
   <keystore keystore-password="password" path="W:pkremensinstallerssl.keystore"/>
</ssl>
Server failt to start.

Expected results:
 command in batch:
/core-service=management/security-realm=ManagementRealm/server-identity=ssl:add(keystore-path=W:\\pkremens\\installer\\ssl.keystore,keystore-password="password")
 content of standalone.xml file:
<ssl>
   <keystore keystore-password="password" path="W:pkremens\\installer\\ssl.keystore"/>
</ssl>

Additional info:
 - see BZ1024381 - windows paths with '\' as delimiter are not used correctly. '\' is omited
 - we should fix this in all post-install actions entering some path (Install password vault, Enable SSL security, and Add a security-domain)

Comment 1 Francisco Canas 2013-11-18 14:32:50 UTC
I've added the necessary extra escape characters to the Installer's CLI commands so that windows paths are inserted into the batch command and the config xmls with the proper escaped backslashes like so: 

"C:\\fcanas\\vault\\keystore.jks"

Note: The above works, but then final Installationlog file will show the command with extra escape characters, which unfortunately means that it is no longer reproducible by the user int he CLI (unless he removes the extra \'s). This is due to the way the CLI returns info (through the stdout rather then as a return value) and how we capture that info in order to log it. Will try to find a way to display the correct path in the log, but it may require some more modifications to izpack that I didn't want to make so close to the release.

http://git.app.eng.bos.redhat.com/jbossas-installer.git/commit/?h=eap-6.2&id=6f2523e64391df17316ce30035d5b58a4b10830d

Comment 2 Petr Kremensky 2013-11-19 15:11:28 UTC
I see things like:
"W:\\\\\\\\tmp\\\\\\\\pkremens\\\\\\\\ssl.keystore" 
in xml files and CLI log. Although it is working, we should definitely spend some time trying to find cleaner solution for 6.3 (agree with avoiding more complicated modifications to izpack now).

Please fix also commands using Keystore and Truststore URL during JSSE configuration, the rest seems to be fine.

Comment 3 Thomas Hauser 2013-11-19 16:38:51 UTC
Please note that all of this is a side effect of the JBoss CLI API, unfortunately.

Comment 4 Francisco Canas 2013-11-19 17:25:43 UTC
I have added similar path escaping to the JSSE keystore and truststore URL elements. 

Note that the JSSE properties are parsed differently by the CLI, so the actual number of escape characters required in the installer is halved. This has the unfortunate side effect of creating more inconsistency in the Installationlog file:

For SSL that path appears like this:
c:\\\\\\\\myfolder\\\\\\\\myfile.jks

For JSSE the path appears like this:
c:\\\\myfolder\\\\myfile.jks

Even though the path appears like this in the actual xmls for *both*:
c:\\myfolder\\myfile.jks

For 6.3 we'll come up with some other workaround to replace the paths shown in the logs with the third version so it's consistent with the xml files.

Comment 5 Francisco Canas 2013-11-19 19:04:16 UTC
One more note:

Made a few changes in order to preserve spaces in the paths:
(ie. c:\my folder\keystore.jks)

This again changes what we see in the Installationlogs, but it is now more consistent. All paths will have the same number of escape chars.

Comment 6 Petr Kremensky 2013-11-20 06:19:37 UTC
I am aware that CLI is villain here, we were complaining about this (BZ1024381), but we didn't succeeded so far :/.

Comment 7 Petr Kremensky 2013-11-20 13:44:34 UTC
There is one more thing that need to be fixed. You've accidentally removed double quotes from vault configuration command on KEYSTORE_URL and KEYSTORE_FILE_DIR attribute values.

Command looks like:
...("KEYSTORE_URL" => /home/pkremens/jbossqe-eap-tests-installer/src/test/resources/vault/vault.keystore), ... ("ENC_FILE_DIR" => /home/pkremens/jbossqe-eap-tests-installer/target/eap/)])

This is throwing Vault Reader Exception -> installation fails

http://git.app.eng.bos.redhat.com/jbossas-installer.git/commit/?h=eap-6.2&id=6f2523e64391df17316ce30035d5b58a4b10830d

Comment 8 Francisco Canas 2013-11-20 14:49:27 UTC
I actually re-added the quotes yesterday (see comment 5) because the CLI wasn't preserving spaces in the path otherwise. The vault installation succeeds with the command:

/core-service=vault:add(vault-options=[("KEYSTORE_URL" => "/home/yyz/fcanas/vault/keystore.jks"), ("KEYSTORE_PASSWORD" => "MASK-1KXfR4wmalv87Emab3wgdL"), ("KEYSTORE_ALIAS" => "myvault"), ("SALT" => "12345678"), ("ITERATION_COUNT" => "44"), ("ENC_FILE_DIR" => "/home/yyz/fcanas/EAP-6.2.0/")])
The batch executed successfully
{"outcome" => "success"}

This update will be in the re-spin and/or CR3.

Comment 9 Petr Kremensky 2013-11-26 07:37:39 UTC
Verified on EAP 6.2.0.CR3 installer.