LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File fixserverproperties.sh of Package dba-tomcat-8516-core (Project home:csbuild:DBA)

#!/bin/sh

#############################################
# this script changes ServerInfo.properties 
# to unsuspicous entries in order to unreveal
# server.info, build and number
#############################################

INST_DIR=`pwd`
CATALINA_UTIL_DIR=org/apache/catalina/util
TEMP_DIR=/tmp/catalina

# now copy the catalina archive and manipulate the serverinfo

if [ ! -d ${TEMP_DIR} ]; then
  mkdir -p ${TEMP_DIR}
fi
cp ${INST_DIR}/lib/catalina.jar ${TEMP_DIR}
cd ${TEMP_DIR}
jar xvf catalina.jar
rm catalina.jar
cp ${CATALINA_UTIL_DIR}/ServerInfo.properties ${CATALINA_UTIL_DIR}/ServerInfo.properties.orig
rm ${CATALINA_UTIL_DIR}/ServerInfo.properties
echo "server.info=Application Server" > ${CATALINA_UTIL_DIR}/ServerInfo.properties
echo "server.number=0.0.0.0" >> ${CATALINA_UTIL_DIR}/ServerInfo.properties
echo "server.built=XXXX 00 0000 0000" >> ${CATALINA_UTIL_DIR}/ServerInfo.properties
jar cvf catalina.jar .

# copy manipulated catalina.jar into tomcat installation directory
cp catalina.jar ${INST_DIR}/lib

cd ${INST_DIR}

# delete temporary directory in /tmp
rm -r ${TEMP_DIR}

exit 0