[rhq] Branch 'rhq-on-as7' - 2 commits - modules/enterprise modules/helpers
mazz
mazz at fedoraproject.org
Thu Aug 2 22:03:25 UTC 2012
modules/enterprise/gui/installer/pom.xml | 4
modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/server/servlet/ServerInstallUtil.java | 51 ++++++++++
modules/enterprise/server/container-lib/pom.xml | 2
modules/enterprise/server/pom.xml | 4
modules/helpers/rtfilter/pom.xml | 7 +
5 files changed, 63 insertions(+), 5 deletions(-)
New commits:
commit e8c394d2963cd674205460993f4d1bbe96f445f4
Author: John Mazzitelli <mazz at redhat.com>
Date: Thu Aug 2 18:03:12 2012 -0400
add de-obfuscate method
diff --git a/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/server/servlet/ServerInstallUtil.java b/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/server/servlet/ServerInstallUtil.java
index 2f0ea78..25eb39b 100644
--- a/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/server/servlet/ServerInstallUtil.java
+++ b/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/server/servlet/ServerInstallUtil.java
@@ -270,6 +270,7 @@ public class ServerInstallUtil {
*/
public static Connection getDatabaseConnection(String connectionUrl, String userName, String password)
throws SQLException {
+ System.out.println(deobfuscatePassword(obfuscatePassword("helloworld!")));
return DbUtil.getConnection(connectionUrl, userName, password);
}
@@ -290,10 +291,35 @@ public class ServerInstallUtil {
Object object = clazz.newInstance();
Method method = clazz.getDeclaredMethod("encode", String.class);
method.setAccessible(true);
- String res = method.invoke(object, password).toString();
- return res;
+ String result = method.invoke(object, password).toString();
+ return result;
+ } catch (Exception e) {
+ throw new RuntimeException("obfuscating db password failed: ", e);
+ }
+ }
+
+ /**
+ * Use the internal JBossAS mechanism to de-obfuscate a password back to its
+ * clear text form. This is not true encryption.
+ *
+ * @param obfuscatedPasswordd the obfuscated password
+ * @return the clear-text password
+ */
+ private static String deobfuscatePassword(String obfuscatedPassword) {
+
+ // We need to do some mumbo jumbo, as the interesting method is private
+ // in SecureIdentityLoginModule
+
+ try {
+ String className = "org.picketbox.datasource.security.SecureIdentityLoginModule";
+ Class<?> clazz = Class.forName(className);
+ Object object = clazz.newInstance();
+ Method method = clazz.getDeclaredMethod("decode", String.class);
+ method.setAccessible(true);
+ char[] result = (char[]) method.invoke(object, obfuscatedPassword);
+ return new String(result);
} catch (Exception e) {
- throw new RuntimeException("Encoding db password failed: ", e);
+ throw new RuntimeException("de-obfuscating db password failed: ", e);
}
}
}
commit 39f6098bd3641ca67716c1caaf57039889e01296
Author: John Mazzitelli <mazz at redhat.com>
Date: Thu Aug 2 17:48:08 2012 -0400
fix some poms
implement a method to obfuscate a pw using picketbox
diff --git a/modules/enterprise/gui/installer/pom.xml b/modules/enterprise/gui/installer/pom.xml
index 0cf27cb..18fc658 100644
--- a/modules/enterprise/gui/installer/pom.xml
+++ b/modules/enterprise/gui/installer/pom.xml
@@ -272,7 +272,7 @@
<rhq.rootDir>../../../..</rhq.rootDir>
<rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir>
<rhq.deploymentName>${project.build.finalName}.war</rhq.deploymentName>
- <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.earName}/${rhq.deploymentName}</rhq.deploymentDir>
+ <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/deployments/${rhq.deploymentName}</rhq.deploymentDir>
</properties>
<build>
@@ -292,6 +292,8 @@
<copy todir="${deployment.dir}" verbose="${rhq.verbose}">
<fileset dir="${basedir}/src/main/webapp" />
</copy>
+ <!-- TODO: do we want to deploy the installer even if dev mode? -->
+ <touch file="${deployment.dir}/../${rhq.deploymentName}.dodeploy" />
</target>
</configuration>
<goals>
diff --git a/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/server/servlet/ServerInstallUtil.java b/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/server/servlet/ServerInstallUtil.java
index 4577789..2f0ea78 100644
--- a/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/server/servlet/ServerInstallUtil.java
+++ b/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/server/servlet/ServerInstallUtil.java
@@ -18,6 +18,7 @@
*/
package org.rhq.enterprise.gui.installer.server.servlet;
+import java.lang.reflect.Method;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
@@ -271,4 +272,28 @@ public class ServerInstallUtil {
throws SQLException {
return DbUtil.getConnection(connectionUrl, userName, password);
}
+
+ /**
+ * Use the internal JBossAS mechanism to obfuscate a password. This is not true encryption.
+ *
+ * @param password the clear text of the password to obfuscate
+ * @return the obfuscated password
+ */
+ private static String obfuscatePassword(String password) {
+
+ // We need to do some mumbo jumbo, as the interesting method is private
+ // in SecureIdentityLoginModule
+
+ try {
+ String className = "org.picketbox.datasource.security.SecureIdentityLoginModule";
+ Class<?> clazz = Class.forName(className);
+ Object object = clazz.newInstance();
+ Method method = clazz.getDeclaredMethod("encode", String.class);
+ method.setAccessible(true);
+ String res = method.invoke(object, password).toString();
+ return res;
+ } catch (Exception e) {
+ throw new RuntimeException("Encoding db password failed: ", e);
+ }
+ }
}
diff --git a/modules/enterprise/server/container-lib/pom.xml b/modules/enterprise/server/container-lib/pom.xml
index 8a5f9dd..d3ec8c9 100644
--- a/modules/enterprise/server/container-lib/pom.xml
+++ b/modules/enterprise/server/container-lib/pom.xml
@@ -55,7 +55,7 @@
<properties>
<rhq.rootDir>../../../..</rhq.rootDir>
<rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir>
- <rhq.deploymentDir>${rhq.containerDir}/jbossas/server/default/lib</rhq.deploymentDir>
+ <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/lib</rhq.deploymentDir>
</properties>
<build>
diff --git a/modules/enterprise/server/pom.xml b/modules/enterprise/server/pom.xml
index 84d4348..26baeec 100644
--- a/modules/enterprise/server/pom.xml
+++ b/modules/enterprise/server/pom.xml
@@ -25,7 +25,7 @@
</activation>
<modules>
<module>xml-schemas</module>
- <module>container-lib</module>
+ <!--<module>container-lib</module>-->
<module>jar</module>
<module>sars</module>
<module>plugins</module>
@@ -45,7 +45,7 @@
</activation>
<modules>
<module>xml-schemas</module>
- <module>container-lib</module>
+ <!--<module>container-lib</module>-->
<module>jar</module>
<module>safe-invoker</module>
</modules>
diff --git a/modules/helpers/rtfilter/pom.xml b/modules/helpers/rtfilter/pom.xml
index 821df29..237e8ea 100644
--- a/modules/helpers/rtfilter/pom.xml
+++ b/modules/helpers/rtfilter/pom.xml
@@ -87,10 +87,12 @@
<profile>
<id>dev</id>
+ <!-- TODO - make this build an AS7 module and put it in the modules location -->
+
<properties>
<rhq.rootDir>../../..</rhq.rootDir>
<rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir>
- <rhq.deploymentDir>${rhq.containerDir}/jbossas/server/default/lib</rhq.deploymentDir>
+ <rhq.deploymentDir>${rhq.containerDir}/jbossas/standalone/lib</rhq.deploymentDir>
</properties>
<build>
@@ -105,10 +107,13 @@
<phase>compile</phase>
<configuration>
<target>
+ <!-- TODO: this is for the old 4.2.3 container, put this in the proper AS7 location -->
+ <!--
<mkdir dir="${rhq.deploymentDir}" />
<property name="deployment.file" location="${rhq.deploymentDir}/${project.build.finalName}.jar" />
<echo>*** Updating ${deployment.file}...</echo>
<jar destfile="${deployment.file}" basedir="${project.build.outputDirectory}" />
+ -->
</target>
</configuration>
<goals>
More information about the rhq-commits
mailing list