You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@manifoldcf.apache.org by kw...@apache.org on 2014/10/15 15:24:15 UTC

svn commit: r1632014 - in /manifoldcf/branches/dev_1x: ./ framework/ framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/ framework/core/src/main/java/org/apache/manifoldcf/core/system/ framework/obfuscate-scripts/ framework/pull-agent/s...

Author: kwright
Date: Wed Oct 15 13:24:14 2014
New Revision: 1632014

URL: http://svn.apache.org/r1632014
Log:
Pull up fix for CONNECTORS-1075 from trunk.

Added:
    manifoldcf/branches/dev_1x/framework/obfuscate-scripts/
      - copied from r1632013, manifoldcf/trunk/framework/obfuscate-scripts/
Modified:
    manifoldcf/branches/dev_1x/   (props changed)
    manifoldcf/branches/dev_1x/CHANGES.txt
    manifoldcf/branches/dev_1x/build.xml
    manifoldcf/branches/dev_1x/framework/   (props changed)
    manifoldcf/branches/dev_1x/framework/build.xml
    manifoldcf/branches/dev_1x/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/LockManagerFactory.java
    manifoldcf/branches/dev_1x/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/ManifoldCFConfiguration.java
    manifoldcf/branches/dev_1x/framework/core/src/main/java/org/apache/manifoldcf/core/system/ManifoldCF.java
    manifoldcf/branches/dev_1x/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/ManifoldCF.java

Propchange: manifoldcf/branches/dev_1x/
------------------------------------------------------------------------------
  Merged /manifoldcf/trunk:r1632013

Modified: manifoldcf/branches/dev_1x/CHANGES.txt
URL: http://svn.apache.org/viewvc/manifoldcf/branches/dev_1x/CHANGES.txt?rev=1632014&r1=1632013&r2=1632014&view=diff
==============================================================================
--- manifoldcf/branches/dev_1x/CHANGES.txt (original)
+++ manifoldcf/branches/dev_1x/CHANGES.txt Wed Oct 15 13:24:14 2014
@@ -3,6 +3,11 @@ $Id$
 
 ======================= 1.8-dev =====================
 
+CONNECTORS-1075: Provide a means of obfuscating passwords in
+properties.xml and global-properties.xml.  Also include an obfuscation
+utility in the distribution, for generating obfuscated passwords.
+(Karl Wright)
+
 CONNECTORS-1071: JCIFS connector should provide date metadata in
 standard ISO8601 format with names that don't conflict with what
 Tika extractor generates.

Modified: manifoldcf/branches/dev_1x/build.xml
URL: http://svn.apache.org/viewvc/manifoldcf/branches/dev_1x/build.xml?rev=1632014&r1=1632013&r2=1632014&view=diff
==============================================================================
--- manifoldcf/branches/dev_1x/build.xml (original)
+++ manifoldcf/branches/dev_1x/build.xml Wed Oct 15 13:24:14 2014
@@ -299,6 +299,10 @@
         <copy todir="dist/script-engine">
             <fileset dir="framework/dist/script-engine"/>
         </copy>
+        <mkdir dir="dist/obfuscation-utility"/>
+        <copy todir="dist/obfuscation-utility">
+            <fileset dir="framework/dist/obfuscation-utility"/>
+        </copy>
         <mkdir dir="dist"/>
         <copy todir="dist">
             <fileset dir="framework/dist">

Propchange: manifoldcf/branches/dev_1x/framework/
------------------------------------------------------------------------------
  Merged /manifoldcf/trunk/framework:r1632013

Modified: manifoldcf/branches/dev_1x/framework/build.xml
URL: http://svn.apache.org/viewvc/manifoldcf/branches/dev_1x/framework/build.xml?rev=1632014&r1=1632013&r2=1632014&view=diff
==============================================================================
--- manifoldcf/branches/dev_1x/framework/build.xml (original)
+++ manifoldcf/branches/dev_1x/framework/build.xml Wed Oct 15 13:24:14 2014
@@ -954,6 +954,11 @@
         <replace file="${processes-dir}/options.env.unix" token=".:" value=".:${unix-classpath}:"/>
     </target>
 
+    <target name="general-set-obfuscate-classpath">
+        <replace file="${processes-dir}/options.env.win" token=".;" value=".;${win-classpath};"/>
+        <replace file="${processes-dir}/options.env.unix" token=".:" value=".:${unix-classpath}:"/>
+    </target>
+
     <target name="general-set-jetty-classpath">
         <replace file="${processes-dir}/jetty-options.env.win" token=".;" value=".;${win-classpath};"/>
         <replace file="${processes-dir}/jetty-options.env.unix" token=".:" value=".:${unix-classpath}:"/>
@@ -985,6 +990,12 @@
         <delete file="${processes-dir}/options.env.unix"/>
     </target>
 
+    <target name="preclean-obfuscate-processes">
+        <mkdir dir="${processes-dir}"/>
+        <delete file="${processes-dir}/options.env.win"/>
+        <delete file="${processes-dir}/options.env.unix"/>
+    </target>
+
     <target name="preclean-engine-processes">
         <mkdir dir="${processes-dir}"/>
         <delete file="${processes-dir}/options.env.win"/>
@@ -1077,6 +1088,13 @@
         </copy>
     </target>
 
+    <target name="scripts-obfuscate" depends="scripts-common">
+        <mkdir dir="${processes-dir}"/>
+        <copy todir="${processes-dir}">
+            <fileset dir="obfuscate-scripts"/>
+        </copy>
+    </target>
+
     <!-- Paths, as used to construct script classpaths -->
     
     <path id="jetty-lib">
@@ -1169,7 +1187,13 @@
             <include name="httpclient*.jar"/>
         </fileset>
     </path>
-    
+
+    <path id="obfuscate-lib">
+        <fileset dir="../lib">
+            <include name="commons-logging*.jar"/>
+        </fileset>
+    </path>
+
     <!-- Classpaths -->
     
     <target name="jetty-lib-classpath" depends="lib">
@@ -1242,6 +1266,16 @@
         </pathconvert>
     </target>
 
+    <target name="obfuscate-lib-classpath" depends="lib">
+        <property name="obfuscate-lib-classpath" location="../lib"/>
+        <pathconvert property="obfuscate-lib-classpath-win" refid="obfuscate-lib" dirsep="\" pathsep=";">
+            <map from="${obfuscate-lib-classpath}" to="..\lib"/>
+        </pathconvert>
+        <pathconvert property="obfuscate-lib-classpath-unix" refid="obfuscate-lib" dirsep="/" pathsep=":">
+            <map from="${obfuscate-lib-classpath}" to="../lib"/>
+        </pathconvert>
+    </target>
+
     <target name="jetty-lib-manifest" depends="lib">
         <property name="jetty-lib-manifest" location="../lib"/>
         <pathconvert property="jetty-manifest-cp" refid="jetty-lib" dirsep="/" pathsep=" ">
@@ -1273,6 +1307,14 @@
 
     <!-- Apply classpaths to various scripts -->
     
+    <target name="setup-obfuscate-processes" depends="preclean-obfuscate-processes,scripts-obfuscate,obfuscate-lib-classpath">
+        <antcall target="general-set-obfuscate-classpath">
+            <param name="processes-dir" value="${processes-dir}"/>
+            <param name="win-classpath" value="..\lib\mcf-core.jar;${obfuscate-lib-classpath-win}"/>
+            <param name="unix-classpath" value="../lib/mcf-core.jar:${obfuscate-lib-classpath-unix}"/>
+        </antcall>
+    </target>
+
     <target name="setup-engine-processes" depends="preclean-engine-processes,scripts-engine,engine-lib-classpath">
         <antcall target="general-set-engine-classpath">
             <param name="processes-dir" value="${processes-dir}"/>
@@ -1515,6 +1557,13 @@
         <chmod dir="dist/multiprocess-zk-example-proprietary" perm="a+x" includes="**/*.sh"/>
     </target>
 
+    <target name="obfuscation-utility" depends="lib">
+        <antcall target="setup-obfuscate-processes">
+            <param name="processes-dir" value="dist/obfuscation-utility"/>
+        </antcall>
+        <chmod dir="dist/obfuscation-utility" perm="a+x" includes="**/*.sh"/>
+    </target>
+    
     <target name="script-engine" depends="lib">
         <antcall target="setup-engine-processes">
             <param name="processes-dir" value="dist/script-engine"/>
@@ -1882,7 +1931,7 @@
         </java>
     </target>
     
-    <target name="build" depends="multi-process-zk-example,multi-process-zk-example-proprietary,multi-process-file-example,multi-process-file-example-proprietary,single-process-example,single-process-example-proprietary,example-common,script-engine,buildfiles,test-lib"/>
+    <target name="build" depends="multi-process-zk-example,multi-process-zk-example-proprietary,multi-process-file-example,multi-process-file-example-proprietary,single-process-example,single-process-example-proprietary,example-common,script-engine,obfuscation-utility,buildfiles,test-lib"/>
     
     <target name="all" depends="build,doc,build-tests,run-tests,run-tests-derby,run-tests-HSQLDB,run-tests-HSQLDBext"/>
     

Modified: manifoldcf/branches/dev_1x/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/LockManagerFactory.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/dev_1x/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/LockManagerFactory.java?rev=1632014&r1=1632013&r2=1632014&view=diff
==============================================================================
--- manifoldcf/branches/dev_1x/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/LockManagerFactory.java (original)
+++ manifoldcf/branches/dev_1x/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/LockManagerFactory.java Wed Oct 15 13:24:14 2014
@@ -86,6 +86,12 @@ public class LockManagerFactory
     return make(tc).getSharedConfiguration().getStringProperty(s, defaultValue);
   }
   
+  public static String getPossiblyObfuscatedStringProperty(IThreadContext tc, String s, String defaultValue)
+    throws ManifoldCFException
+  {
+    return make(tc).getSharedConfiguration().getPossiblyObfuscatedStringProperty(s, defaultValue);
+  }
+  
   public static int getIntProperty(IThreadContext tc, String s, int defaultValue)
     throws ManifoldCFException
   {

Modified: manifoldcf/branches/dev_1x/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/ManifoldCFConfiguration.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/dev_1x/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/ManifoldCFConfiguration.java?rev=1632014&r1=1632013&r2=1632014&view=diff
==============================================================================
--- manifoldcf/branches/dev_1x/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/ManifoldCFConfiguration.java (original)
+++ manifoldcf/branches/dev_1x/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/ManifoldCFConfiguration.java Wed Oct 15 13:24:14 2014
@@ -71,6 +71,24 @@ public class ManifoldCFConfiguration ext
     return rval;
   }
 
+  /** Read a possibly obfuscated string property, either from the system properties, or from the local configuration file.
+  *@param s is the property name.
+  *@param defaultValue is the default value for the property.
+  *@return the property value, as a string.
+  */
+  public String getPossiblyObfuscatedStringProperty(String s, String defaultValue)
+    throws ManifoldCFException
+  {
+    String obfuscatedPropertyName = s + ".obfuscated";
+    String rval = getProperty(obfuscatedPropertyName);
+    if (rval != null)
+      return org.apache.manifoldcf.core.system.ManifoldCF.deobfuscate(rval);
+    rval = getProperty(s);
+    if (rval == null)
+      rval = defaultValue;
+    return rval;
+  }
+
   /** Read a boolean property
   */
   public boolean getBooleanProperty(String s, boolean defaultValue)

Modified: manifoldcf/branches/dev_1x/framework/core/src/main/java/org/apache/manifoldcf/core/system/ManifoldCF.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/dev_1x/framework/core/src/main/java/org/apache/manifoldcf/core/system/ManifoldCF.java?rev=1632014&r1=1632013&r2=1632014&view=diff
==============================================================================
--- manifoldcf/branches/dev_1x/framework/core/src/main/java/org/apache/manifoldcf/core/system/ManifoldCF.java (original)
+++ manifoldcf/branches/dev_1x/framework/core/src/main/java/org/apache/manifoldcf/core/system/ManifoldCF.java Wed Oct 15 13:24:14 2014
@@ -248,11 +248,11 @@ public class ManifoldCF
           Logging.setLogLevels(threadContext);
 
           loginUserName = LockManagerFactory.getStringProperty(threadContext,loginUserNameProperty,"admin");
-          loginPassword = LockManagerFactory.getStringProperty(threadContext,loginPasswordProperty,"admin");
+          loginPassword = LockManagerFactory.getPossiblyObfuscatedStringProperty(threadContext,loginPasswordProperty,"admin");
 
           masterDatabaseName = LockManagerFactory.getStringProperty(threadContext,masterDatabaseNameProperty,"dbname");
           masterDatabaseUsername = LockManagerFactory.getStringProperty(threadContext,masterDatabaseUsernameProperty,"manifoldcf");
-          masterDatabasePassword = LockManagerFactory.getStringProperty(threadContext,masterDatabasePasswordProperty,"local_pg_passwd");
+          masterDatabasePassword = LockManagerFactory.getPossiblyObfuscatedStringProperty(threadContext,masterDatabasePasswordProperty,"local_pg_passwd");
 
           // Register the throttler for cleanup on shutdown
           addShutdownHook(new ThrottlerShutdown());

Modified: manifoldcf/branches/dev_1x/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/ManifoldCF.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/dev_1x/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/ManifoldCF.java?rev=1632014&r1=1632013&r2=1632014&view=diff
==============================================================================
--- manifoldcf/branches/dev_1x/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/ManifoldCF.java (original)
+++ manifoldcf/branches/dev_1x/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/ManifoldCF.java Wed Oct 15 13:24:14 2014
@@ -123,7 +123,7 @@ public class ManifoldCF extends org.apac
   {
     // Get the specified superuser name and password, in case this isn't Derby we're using
     String superuserName = LockManagerFactory.getStringProperty(threadContext, databaseSuperuserNameProperty, "");
-    String superuserPassword = LockManagerFactory.getStringProperty(threadContext, databaseSuperuserPasswordProperty, "");
+    String superuserPassword = LockManagerFactory.getPossiblyObfuscatedStringProperty(threadContext, databaseSuperuserPasswordProperty, "");
     createSystemDatabase(threadContext,superuserName,superuserPassword);
   }