Thursday, July 8, 2010

A simple build script for ejbca on debian. It expects you to pull the appropriate jboss and ejbca archives into $SOURCE
It's based mostly on
  • http://projects.arcs.org.au/trac/systems/wiki/HowTo/InstallSLCSServer2/InstallEJBCA
  • http://www.ejbca.org/installation.html


#!/bin/sh

set -e
SOURCE=/home/lmwangi/
export JBOSS_HOME=/opt/jboss
export PATH=$PATH:$JBOSS_HOME/bin
export APPSRV_HOME=$JBOSS_HOME
export ANT_OPTS=-Xmx512m
export JAVA_HOME=/usr/lib/jvm/java-6-sun/jre
export JAVA_OPTS="-server -Xms128m -Xmx512m"
export JAVAC_OPTS="-Dno-xdoc"

echonice() {
echo "==================================================="
echo "$1"
echo "==================================================="
echo
}
cd /opt/
rm -rf jboss/ ejbca/
unzip $SOURCE/jboss-4.2.3.GA-jdk6.zip
unzip $SOURCE/ejbca_3_10_3.zip

mv jboss-4.2* jboss/
mv ejbca_3* ejbca/

cd /opt/ejbca/conf && for file in `ls *.sample`; do cp $file `echo $file|sed -e 's/.sample//'`; done

#sed -i -e 's/httpsserver.hostname=localhost/httpsserver.hostname=some.server.com/' web.properties

echonice "Debian testing has a bug that breaks networking in java \n Refer to http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=560044"

sleep 5;

cd /opt/ejbca/ && ant bootstrap

#echo "Please start jboss in another shell using /opt/jboss/bin/run.sh -b 0.0.0.0"
echonice "Attempting to start jboss in another shell"
/opt/jboss/bin/run.sh -b 0.0.0.0 &
sleep 60;

echonice "Attempting install"
ant install
sleep 20;

echonice "Attempting to kill jboss"
kill `ps aux|grep jboss|grep run.sh|awk '{print $2}'`

sleep 20;

echonice "Starting ant deploy"
ant deploy


echonice "Final Jboss Startup"
/opt/jboss/bin/run.sh -b 0.0.0.0


Debug
If you are trying to get ejbca to work and run into this error on debian, have a look at this debian bug 560044

--
[echo] ca init AdminCA1 "CN=AdminCA1,O=EJBCA Sample,C=SE" soft null 2048 RSA 3650 null SHA1WithRSA conf/catoken.properties
[java] Initializing CA
[java] Generating rootCA keystore:
[java] CA name: AdminCA1
[java] DN: CN=AdminCA1,O=EJBCA Sample,C=SE
[java] CA token type: soft
[java] CA token password: null
[java] Keyspec: 2048
[java] Keytype: RSA
[java] Validity (days): 3650
[java] Policy ID: null
[java] Signature alg: SHA1WithRSA
[java] CA token properties: null
[java] Initalizing Temporary Authorization Module.
[java] javax.naming.CommunicationException: Could not obtain connection to any of these urls: 127.0.0.1:1099 and discovery failed with error: javax.naming.CommunicationException: Network is unreachable [Root exception is java.io.IOException: Network is unreachable] [Root exception is javax.naming.CommunicationException: Failed to connect to server 127.0.0.1:1099 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server 127.0.0.1:1099 [Root exception is java.net.SocketException: Network is unreachable]]]
[java] Java Result: -1

--

No comments:

Post a Comment