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:23:14 UTC
svn commit: r1632013 - in /manifoldcf/trunk: ./ 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/src/main/ja...
Author: kwright
Date: Wed Oct 15 13:23:14 2014
New Revision: 1632013
URL: http://svn.apache.org/r1632013
Log:
Fix for CONNECTORS-1075.
Added:
manifoldcf/trunk/framework/obfuscate-scripts/
manifoldcf/trunk/framework/obfuscate-scripts/obfuscate.bat (with props)
manifoldcf/trunk/framework/obfuscate-scripts/obfuscate.sh (with props)
manifoldcf/trunk/framework/obfuscate-scripts/options.env.unix (with props)
manifoldcf/trunk/framework/obfuscate-scripts/options.env.win (with props)
Modified:
manifoldcf/trunk/CHANGES.txt
manifoldcf/trunk/build.xml
manifoldcf/trunk/framework/build.xml
manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/LockManagerFactory.java
manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/ManifoldCFConfiguration.java
manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/system/ManifoldCF.java
manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/ManifoldCF.java
Modified: manifoldcf/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/CHANGES.txt?rev=1632013&r1=1632012&r2=1632013&view=diff
==============================================================================
--- manifoldcf/trunk/CHANGES.txt (original)
+++ manifoldcf/trunk/CHANGES.txt Wed Oct 15 13:23:14 2014
@@ -3,6 +3,11 @@ $Id$
======================= 2.0-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/trunk/build.xml
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/build.xml?rev=1632013&r1=1632012&r2=1632013&view=diff
==============================================================================
--- manifoldcf/trunk/build.xml (original)
+++ manifoldcf/trunk/build.xml Wed Oct 15 13:23:14 2014
@@ -294,6 +294,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">
Modified: manifoldcf/trunk/framework/build.xml
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/build.xml?rev=1632013&r1=1632012&r2=1632013&view=diff
==============================================================================
--- manifoldcf/trunk/framework/build.xml (original)
+++ manifoldcf/trunk/framework/build.xml Wed Oct 15 13:23:14 2014
@@ -943,6 +943,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}:"/>
@@ -974,6 +979,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"/>
@@ -1066,6 +1077,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">
@@ -1157,7 +1175,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">
@@ -1230,6 +1254,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=" ">
@@ -1261,6 +1295,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}"/>
@@ -1503,6 +1545,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"/>
@@ -1851,7 +1900,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-HSQLDB,run-tests-HSQLDBext"/>
Modified: manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/LockManagerFactory.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/LockManagerFactory.java?rev=1632013&r1=1632012&r2=1632013&view=diff
==============================================================================
--- manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/LockManagerFactory.java (original)
+++ manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/LockManagerFactory.java Wed Oct 15 13:23: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/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/ManifoldCFConfiguration.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/ManifoldCFConfiguration.java?rev=1632013&r1=1632012&r2=1632013&view=diff
==============================================================================
--- manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/ManifoldCFConfiguration.java (original)
+++ manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/ManifoldCFConfiguration.java Wed Oct 15 13:23: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/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/system/ManifoldCF.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/system/ManifoldCF.java?rev=1632013&r1=1632012&r2=1632013&view=diff
==============================================================================
--- manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/system/ManifoldCF.java (original)
+++ manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/system/ManifoldCF.java Wed Oct 15 13:23: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());
Added: manifoldcf/trunk/framework/obfuscate-scripts/obfuscate.bat
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/obfuscate-scripts/obfuscate.bat?rev=1632013&view=auto
==============================================================================
--- manifoldcf/trunk/framework/obfuscate-scripts/obfuscate.bat (added)
+++ manifoldcf/trunk/framework/obfuscate-scripts/obfuscate.bat Wed Oct 15 13:23:14 2014
@@ -0,0 +1,30 @@
+@echo off
+rem Licensed to the Apache Software Foundation (ASF) under one or more
+rem contributor license agreements. See the NOTICE file distributed with
+rem this work for additional information regarding copyright ownership.
+rem The ASF licenses this file to You under the Apache License, Version 2.0
+rem (the "License"); you may not use this file except in compliance with
+rem the License. You may obtain a copy of the License at
+rem
+rem http://www.apache.org/licenses/LICENSE-2.0
+rem
+rem Unless required by applicable law or agreed to in writing, software
+rem distributed under the License is distributed on an "AS IS" BASIS,
+rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+rem See the License for the specific language governing permissions and
+rem limitations under the License.
+
+rem check that JAVA_HOME is set
+if not exist "%JAVA_HOME%\bin\java.exe" goto nojavahome
+if not exist "..\lib" goto nolcfhome
+set JAVAOPTIONS=
+for /f "delims=" %%a in ('type options.env.win') do call setjavaoption.bat "%%a"
+"%JAVA_HOME%\bin\java" %JAVAOPTIONS% org.apache.manifoldcf.core.Obfuscate %*
+goto done
+:nojavahome
+echo Environment variable JAVA_HOME is not set properly.
+goto done
+:nolcfhome
+echo Script must be run from obfuscate directory.
+goto done
+:done
Propchange: manifoldcf/trunk/framework/obfuscate-scripts/obfuscate.bat
------------------------------------------------------------------------------
svn:eol-style = CRLF
Added: manifoldcf/trunk/framework/obfuscate-scripts/obfuscate.sh
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/obfuscate-scripts/obfuscate.sh?rev=1632013&view=auto
==============================================================================
--- manifoldcf/trunk/framework/obfuscate-scripts/obfuscate.sh (added)
+++ manifoldcf/trunk/framework/obfuscate-scripts/obfuscate.sh Wed Oct 15 13:23:14 2014
@@ -0,0 +1,42 @@
+#!/bin/bash -e
+
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+if [[ $OSTYPE == "cygwin" ]] ; then
+ OPTIONSFILE="options.env.win"
+else
+ OPTIONSFILE="options.env.unix"
+fi
+
+#Make sure environment variables are properly set
+if [ -e "$JAVA_HOME"/bin/java ] ; then
+ if [ -e ../lib ] ; then
+
+ # Build the global options
+ OPTIONS=$(cat "$OPTIONSFILE")
+
+ "$JAVA_HOME/bin/java" $OPTIONS org.apache.manifoldcf.core.Obfuscate "$@"
+ exit $?
+
+ else
+ echo "Script must be run from obfuscate directory." 1>&2
+ exit 1
+ fi
+
+else
+ echo "Environment variable JAVA_HOME is not properly set." 1>&2
+ exit 1
+fi
Propchange: manifoldcf/trunk/framework/obfuscate-scripts/obfuscate.sh
------------------------------------------------------------------------------
svn:eol-style = LF
Added: manifoldcf/trunk/framework/obfuscate-scripts/options.env.unix
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/obfuscate-scripts/options.env.unix?rev=1632013&view=auto
==============================================================================
--- manifoldcf/trunk/framework/obfuscate-scripts/options.env.unix (added)
+++ manifoldcf/trunk/framework/obfuscate-scripts/options.env.unix Wed Oct 15 13:23:14 2014
@@ -0,0 +1,4 @@
+-Xms8m
+-Xmx8m
+-cp
+.:
Propchange: manifoldcf/trunk/framework/obfuscate-scripts/options.env.unix
------------------------------------------------------------------------------
svn:eol-style = LF
Added: manifoldcf/trunk/framework/obfuscate-scripts/options.env.win
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/obfuscate-scripts/options.env.win?rev=1632013&view=auto
==============================================================================
--- manifoldcf/trunk/framework/obfuscate-scripts/options.env.win (added)
+++ manifoldcf/trunk/framework/obfuscate-scripts/options.env.win Wed Oct 15 13:23:14 2014
@@ -0,0 +1,4 @@
+-Xms8m
+-Xmx8m
+-cp
+.;
Propchange: manifoldcf/trunk/framework/obfuscate-scripts/options.env.win
------------------------------------------------------------------------------
svn:eol-style = CRLF
Modified: manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/ManifoldCF.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/ManifoldCF.java?rev=1632013&r1=1632012&r2=1632013&view=diff
==============================================================================
--- manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/ManifoldCF.java (original)
+++ manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/ManifoldCF.java Wed Oct 15 13:23: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);
}