Skip to content

Commit

Permalink
Merge pull request #18 from OpenAS2/dev
Browse files Browse the repository at this point in the history
Release 2.1.0
  • Loading branch information
pete-gilchrist authored Oct 14, 2016
2 parents fa7447c + d694536 commit 5de54d9
Show file tree
Hide file tree
Showing 49 changed files with 1,668 additions and 432 deletions.
30 changes: 14 additions & 16 deletions RELEASE-NOTES.txt
Original file line number Diff line number Diff line change
@@ -1,27 +1,25 @@
OpenAS2 Server
Version 2.0.0
Version 2.1.0
RELEASE NOTES

The OpenAS2 project is pleased to announce the release of OpenAS2 2.0.0
The OpenAS2 project is pleased to announce the release of OpenAS2 2.1.0

The release download file is: OpenAS2Server-2.0.0.zip
The release download file is: OpenAS2Server-2.1.0.zip
The zip file contains a PDF document providing information on installing and using the application.

This release is an enhancement and bug fix release that includes compatibility testing with other AS2 systems:
1. Add support for custom HTTP headers
- configurable static headers as name/value pairs in the partnership
- configurable dynamic headers with header values set from parsing the name of the file to be sent
2. Fix generator encoding for compression, encryption and signing
3. Support configurable control of canonicalization when signing
4. Support overriding digest "sha-1" algorithm name in signing to use "old" name without dash ("sha1")
5. Support AES128, AES192, AES256 ciphers
6. Support disabling the CMS algorithm protection OID for older AS2 systems that do not support it
7. Added "Troubleshooting.." section to documentation
This release is an enhancement release:
1. Add message tracking module to allow easy identification of sent and received messages based on state
- persists state change tracking of messages to H2 database
- allow user-plugin of custom tracking module(s)
2. Enhanced documentation around certificate management
3. Added properties element to config to allow easy custom config property access from java modules and helper classes
4. Added support for parsing file name into partnership attributes using regular expressions
5. Added script to support launching OpenAS2 as a daemon using the init.d paradigm
6. Added system parameter to startup scripts to allow restricted HTTP headers that cause problems for some AS2 implementations

Upgrade Notes:
1. Canonicalization may affect existing working partnerships in prior versions of OpenAS2 if using a content transfer encoding other than "binary".
If the partnership stops working then add the following attribute to the partnership:
<attribute name="prevent_canonicalization_for_mic" value="true"/>
1. Add the new module to your existing config.xml (see classname="org.openas2.processor.msgtracking.DbTrackingModule" in release config.xml)
2. If using a custom startup script, re-integrate your customisations into the new script

Java 1.5 or later is required.
NOTE FOR JAVA 1.5: Prior to java 1.6, the Javabeans Activation Framework is NOT included in the standard Java install. Download the 1.1.1 version and extract from the zip file from this web page: http://www.oracle.com/technetwork/java/javasebusiness/downloads/java-archive-downloads-java-plat-419418.html#jaf-1.1.1-fcs-oth-JPR
Expand Down
104 changes: 104 additions & 0 deletions Server/bin/openas2.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
#!/bin/bash

### BEGIN INIT INFO
# Provides: openas2.d
# Required-Start:
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Startup script to launch OpenAS2 appliction as a daemon
# Description: This script can be used in any NIX based system that implements the init.d mechanism
# The EXECUTABLE variable below must be set to point to the OpenAS2 startup script
# See the OpenAS2HowTo.pdf for details on configuration checks for this mode of running OpenAS2
### END INIT INFO

SERVICE_NAME=OpenAS2
EXECUTABLE=/opt/OpenAS2/bin/start-openas2.sh
THIS_SCRIPT_NAME=`basename $0`
THIS_SCRIPT_EXEC=$0
if [ "$THIS_SCRIPT_NAME" = "$0" ]; then
THIS_SCRIPT_EXEC="/etc/init.d/$0"
fi
PID=$(ps -ef | grep java | grep org.openas2.app.OpenAS2Server | awk '{print $2}')

case "$1" in
start)
echo "Starting $SERVICE_NAME ..."
if [ -z $PID ]; then
export OPENAS2_AS_DAEMON=true
$EXECUTABLE
RETVAL="$?"
if [ "$RETVAL" = 0 ]; then
echo "$SERVICE_NAME started ..."
exit 0
else
echo "ERROR $SERVICE_NAME could not be started. Review logs"
exit 1
fi
else
echo "$SERVICE_NAME is already running ..."
fi
;;
stop|kill)
if [ ! -z $PID ]; then
echo "Attempting to stop $SERVICE_NAME..."
kill $PID
if [ "$?" = 0 ]; then
echo "$SERVICE_NAME terminated ..."
exit 0
else
echo "ERROR: $SERVICE_NAME failed to terminate. try force-stop"
exit 1
fi
else
echo "$SERVICE_NAME is not running ..."
exit 0
fi
;;
force-stop)
if [ ! -z $PID ]; then
echo "Attempting to force termination of $SERVICE_NAME..."
kill -9 $PID
if [ "$?" = 0 ]; then
echo "$SERVICE_NAME terminated ..."
exit 0
else
echo "ERROR: $SERVICE_NAME failed to terminate. "
exit 1
fi
else
echo "$SERVICE_NAME is not running ..."
exit 0
fi
;;
status)
if [ -z $PID ]; then
echo "$SERVICE_NAME is not running"
else
echo "$SERVICE_NAME is running"
fi
;;
force-reload|restart|reload)
$THIS_SCRIPT_EXEC stop
if [ ! -z $PID ]; then
CNT=0
while ps -p $PID 2>/dev/null; do
sleep 1;CNT=$CNT+1;
CNT=$((CNT+1)); if [ $CNT -ge 5 ]; then break; fi
done
if ps -p $PID 2>/dev/null; then
echo "ERROR: Failed to stop $SERVICE_NAME"
exit 1
else
PID=""
fi
fi
$THIS_SCRIPT_EXEC start
;;
*)
echo "Usage: $0 {start|stop|restart|reload|force-reload}"
exit 1
;;

esac

13 changes: 9 additions & 4 deletions Server/bin/start-openas2.bat
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
@echo off
rem Purpose: runs the OpenAS2 application

rem Set some of the base system properties for the Java environment and logging
rem remove -Dorg.apache.commons.logging.Log=org.openas2.logging.Log if using another logging package
rem
set EXTRA_PARMS=-Xms32m -Xmx384m -Dorg.apache.commons.logging.Log=org.openas2.logging.Log
rem By default allow restricted HTTP headers
set EXTRA_PARMS=%EXTRA_PARMS% -Dsun.net.http.allowRestrictedHeaders=true

rem Uncomment any of the following for enhanced debug
rem set EXTRA_PARMS=%EXTRA_PARMS% -Dmaillogger.debug.enabled=true
rem set EXTRA_PARMS=%EXTRA_PARMS% -DlogRxdMsgMimeBodyParts=true
Expand Down Expand Up @@ -54,11 +61,9 @@ if not "%JAVA%" == "" goto :Check_JAVA_END
)
set JAVA=%JAVA_HOME%\bin\java
:Check_JAVA_END

set LIB_JARS=../lib/h2-1.4.192.jar;../lib/javax.mail.jar;../lib/bcpkix-jdk15on-154.jar;../lib/bcprov-jdk15on-154.jar;../lib/bcmail-jdk15on-154.jar;../lib/commons-logging-1.2.jar;../lib/openas2-server.jar
rem
rem remove -Dorg.apache.commons.logging.Log=org.openas2.logging.Log if using another logging package
rem
"%JAVA%" "%EXTRA_PARMS% -Xms32m -Xmx384m -Dorg.apache.commons.logging.Log=org.openas2.logging.Log -cp .;../lib/javax.mail.jar;../lib/bcpkix-jdk15on-154.jar;../lib/bcprov-jdk15on-154.jar;../lib/bcmail-jdk15on-154.jar;../lib/commons-logging-1.2.jar;../lib/openas2-server.jar org.openas2.app.OpenAS2Server ../config/config.xml
"%JAVA%" %EXTRA_PARMS% -cp .;%LIB_JARS% org.openas2.app.OpenAS2Server ../config/config.xml

:warn
:END
Expand Down
25 changes: 20 additions & 5 deletions Server/bin/start-openas2.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@
#!/bin/sh
#!/bin/bash
# purpose: runs the OpenAS2 application
x=`basename $0`

binDir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
keyStorePwd=$1
PWD_OVERRIDE=""

# Set some of the base system properties for the Java environment and logging
# remove -Dorg.apache.commons.logging.Log=org.openas2.logging.Log if using another logging package
#
EXTRA_PARMS="-Xms32m -Xmx384m -Dorg.apache.commons.logging.Log=org.openas2.logging.Log"
# By default allow restricted HTTP headers
EXTRA_PARMS="$EXTRA_PARMS -Dsun.net.http.allowRestrictedHeaders=true"
# Uncomment any of the following for enhanced debug
#EXTRA_PARMS="$EXTRA_PARMS -Dmaillogger.debug.enabled=true"
#EXTRA_PARMS="$EXTRA_PARMS -DlogRxdMsgMimeBodyParts=true"
#EXTRA_PARMS="$EXTRA_PARMS -DlogRxdMdnMimeBodyParts=true"
#EXTRA_PARMS="$EXTRA_PARMS -Djavax.net.debug=SSL"

if [ ! -z $keyStorePwd ]; then
PWD_OVERRIDE="-Dorg.openas2.cert.Password=$keyStorePwd"
Expand All @@ -29,10 +38,16 @@ fi

if [ -z $JAVA_HOME ]; then
echo "ERROR: Cannot find JAVA_HOME"
exit
exit 1
fi

LIB_JARS="${binDir}/../lib/h2-1.4.192.jar:${binDir}/../lib/javax.mail.jar:${binDir}/../lib/bcpkix-jdk15on-154.jar:${binDir}/../lib/bcprov-jdk15on-154.jar:${binDir}/../lib/bcmail-jdk15on-154.jar:${binDir}/../lib/commons-logging-1.2.jar:${binDir}/../lib/openas2-server.jar"
JAVA_EXE=$JAVA_HOME/bin/java
#
# remove -Dorg.apache.commons.logging.Log=org.openas2.logging.Log if using another logging package
#
$JAVA_EXE ${PWD_OVERRIDE} -Xms32m -Xmx384m -Dorg.apache.commons.logging.Log=org.openas2.logging.Log -cp .:../lib/javax.mail.jar:../lib/bcpkix-jdk15on-154.jar:../lib/bcprov-jdk15on-154.jar:../lib/bcmail-jdk15on-154.jar:../lib/commons-logging-1.2.jar:../lib/openas2-server.jar org.openas2.app.OpenAS2Server ../config/config.xml
CMD="$JAVA_EXE ${PWD_OVERRIDE} ${EXTRA_PARMS} -cp .:${LIB_JARS} org.openas2.app.OpenAS2Server ${binDir}/../config/config.xml"
if [ "true" = "$OPENAS2_AS_DAEMON" ]; then
$CMD &
else
$CMD
fi
exit $?
Binary file added Server/config/DB/openas2.mv.db
Binary file not shown.
22 changes: 21 additions & 1 deletion Server/config/config.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
<openas2>
<properties
sql_timestamp_format="yyyy-MM-dd HH:mm:ss.SSS"

/>
<certificates classname="org.openas2.cert.PKCS12CertificateFactory"
filename="%home%/as2_certs.p12"
password="testas2"
Expand Down Expand Up @@ -51,7 +55,10 @@
<module classname="org.openas2.processor.sender.AS2SenderModule">
</module>

<!-- This will parse the filename to get a sender and receiver. For instance a file
<module classname="org.openas2.processor.sender.AsynchMDNSenderModule">
</module>

<!-- This will parse the filename to get a sender and receiver. For instance a file
named OpenAS2A_OID-OpenAS2B_OID.1234 would be sent from OpenAS2A to OpenAS2B. -->
<module classname="org.openas2.processor.receiver.AS2DirectoryPollingModule"
outboxdir="%home%/../data/toAny"
Expand All @@ -78,6 +85,19 @@
sendFilename="true"
mimetype="application/EDI-X12"/>

<module classname="org.openas2.processor.msgtracking.DbTrackingModule"
db_user="sa"
db_pwd="OpenAS2"
db_name="openas2"
db_directory="%home%/DB"
jdbc_driver="org.h2.Driver"
jdbc_connect_string="jdbc:h2:$component.db_directory$/$component.db_name$"
sql_escape_character="'"
tcp_server_start="true"
tcp_server_port="9092"
tcp_server_password="openas2"
/>

<module classname="org.openas2.processor.storage.MDNFileModule"
filename="%home%/../data/$mdn.msg.sender.as2_id$-$mdn.msg.receiver.as2_id$/mdn/$date.yyyy-MM-dd$/$mdn.msg.content-disposition.filename$-$mdn.msg.headers.message-id$"
protocol="as2"
Expand Down
29 changes: 29 additions & 0 deletions Server/config/db_ddl.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
set IGNORECASE TRUE;
DROP TABLE msg_metadata IF EXISTS;
CREATE TABLE msg_metadata (
ID INTEGER default 0 NOT NULL AUTO_INCREMENT,
MSG_ID LONGVARCHAR NOT NULL,
MDN_ID LONGVARCHAR,
DIRECTION VARCHAR(25) ,
IS_RESEND VARCHAR(1) DEFAULT 'N',
RESEND_COUNT INTEGER DEFAULT 0,
SENDER_ID VARCHAR(255) NOT NULL,
RECEIVER_ID VARCHAR(255) NOT NULL,
STATUS VARCHAR(255),
STATE VARCHAR(255),
SIGNATURE_ALGORITHM VARCHAR(255),
ENCRYPTION_ALGORITHM VARCHAR(255),
COMPRESSION VARCHAR(255),
FILE_NAME VARCHAR(255),
CONTENT_TYPE VARCHAR(255),
CONTENT_TRANSFER_ENCODING VARCHAR(255),
MDN_MODE VARCHAR(255),
MDN_RESPONSE LONGVARCHAR,
STATE_MSG LONGVARCHAR,
CREATE_DT TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
UPDATE_DT TIMESTAMP,

PRIMARY KEY (ID) );

ALTER TABLE msg_metadata ADD CONSTRAINT MSG_ID_UNIQUE UNIQUE (MSG_ID);

5 changes: 5 additions & 0 deletions Server/config/partnerships.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<attribute name="content_transfer_encoding" value="8bit"/>
<attribute name="compression_type" value="ZLIB"/>
<attribute name="subject" value="From OpenAS2A to OpenAS2B"/>
<attribute name="mdnsubject" value="Your requested MDN response from $receiver.as2_id$"/>
<attribute name="as2_url" value="http://localhost:10080"/>
<attribute name="as2_mdn_to" value="[email protected]"/>
<!-- <attribute name="as2_receipt_option" value="http://localhost:10080"/> ...for async MDN-->
Expand Down Expand Up @@ -56,6 +57,10 @@
Example for adding dynamic custom headers to Mime body part where filename is of form XXX-YYY.msg
<attribute name="custom_mime_header_names_from_filename" value="X-CustomRouteId,X-CustomCenter"/>
<attribute name="custom_mime_header_names_regex_on_filename" value="([^-]*)-([^.]*).msg"/>
Example for parsing filename into parameters that can be referenced this is a file name of the form XXXNNNN.edi where X is alphabetic and N are numerics
<attribute name="attribute_names_from_filename" value="P-DynamicParm1,P-DynamicParm2"/>
<attribute name="attribute_values_regex_on_filename" value="([A-Za-z]*)([^.]*).edi"/>
-->
</partnership>

Expand Down
Binary file not shown.
Binary file added Server/lib/h2-1.4.192.jar
Binary file not shown.
Binary file modified Server/lib/openas2-server.jar
Binary file not shown.
10 changes: 10 additions & 0 deletions Server/src/org/openas2/BaseSession.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

public abstract class BaseSession implements Session {
private Map<String, Component> components;
private String baseDirectory;

/**
* Creates a <code>BaseSession</code> object, then calls the <code>init()</code> method.
Expand Down Expand Up @@ -83,4 +84,13 @@ protected void initJavaMail() throws OpenAS2Exception {
"message/disposition-notification;; x-java-content-handler=org.openas2.util.DispositionDataContentHandler");
CommandMap.setDefaultCommandMap(mc);
}

public String getBaseDirectory() {
return baseDirectory;
}

public void setBaseDirectory(String dir) {
baseDirectory = dir;
}

}
7 changes: 6 additions & 1 deletion Server/src/org/openas2/Session.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*/
public interface Session {
/** Official OpenAS2 release version */
public static final String VERSION = "2.0.0";
public static final String VERSION = "2.1.0";

/** Official OpenAS2 title */
public static final String TITLE = "OpenAS2 v" + VERSION;
Expand Down Expand Up @@ -91,4 +91,9 @@ public interface Session {
* @see Component
*/
public Processor getProcessor() throws ComponentNotFoundException;

public String getBaseDirectory();

public void setBaseDirectory(String dir);

}
Loading

0 comments on commit 5de54d9

Please sign in to comment.