From 3f55aa12449ee5cbf0db1ef4bf7e4ab1c221660f Mon Sep 17 00:00:00 2001 From: garthpatil Date: Wed, 10 Apr 2013 17:57:48 -0700 Subject: [PATCH] Added sample configuration for testing interoperability with stunnel encryption wrapped server. --- SSL.md | 7 +++++-- .../com/cloudhopper/smpp/demo/SslClientMain.java | 2 +- .../com/cloudhopper/smpp/demo/SslServerMain.java | 2 +- src/test/resources/server.crt | 13 +++++++++++++ src/test/resources/server.key | 15 +++++++++++++++ src/test/resources/stunnel.conf | 9 +++++++++ 6 files changed, 44 insertions(+), 4 deletions(-) create mode 100644 src/test/resources/server.crt create mode 100644 src/test/resources/server.key create mode 100644 src/test/resources/stunnel.conf diff --git a/SSL.md b/SSL.md index c61f41bf..84d0ec4d 100644 --- a/SSL.md +++ b/SSL.md @@ -72,7 +72,7 @@ Generating Keys and Certificates with OpenSSL Generating a CSR from keytool - keytool -certreq -alias jetty -keystore keystore -file smpp.csr + keytool -certreq -alias smpp -keystore keystore -file smpp.csr Generating a CSR from OpenSSL @@ -98,8 +98,11 @@ The following OpenSSL command combines the keys in smpp.key and the certificate ## Appendix -### Known issues ### Interop with stunnel +This library has been tested with stunnel4 wrapping both client and servers. There is a sample stunnel.conf in src/test/resources that works with `make server` and `make ssl-client`. The SSL implementation should be compatible with other TLS/SSL encryption wrappers, assuming the JDK you are using supports the same cryptographic algorithms as the encryption wrapper. + +### Known issues + diff --git a/src/test/java/com/cloudhopper/smpp/demo/SslClientMain.java b/src/test/java/com/cloudhopper/smpp/demo/SslClientMain.java index 8bc7356c..566fe8d2 100644 --- a/src/test/java/com/cloudhopper/smpp/demo/SslClientMain.java +++ b/src/test/java/com/cloudhopper/smpp/demo/SslClientMain.java @@ -97,7 +97,7 @@ public Thread newThread(Runnable r) { config0.setName("Tester.Session.0"); config0.setType(SmppBindType.TRANSCEIVER); config0.setHost("127.0.0.1"); - config0.setPort(2776); + config0.setPort(2777); config0.setConnectTimeout(10000); config0.setSystemId("1234567890"); config0.setPassword("password"); diff --git a/src/test/java/com/cloudhopper/smpp/demo/SslServerMain.java b/src/test/java/com/cloudhopper/smpp/demo/SslServerMain.java index e0f6a2c2..efc6afe8 100644 --- a/src/test/java/com/cloudhopper/smpp/demo/SslServerMain.java +++ b/src/test/java/com/cloudhopper/smpp/demo/SslServerMain.java @@ -77,7 +77,7 @@ public Thread newThread(Runnable r) { // create a server configuration SmppServerConfiguration configuration = new SmppServerConfiguration(); - configuration.setPort(2776); + configuration.setPort(2777); configuration.setMaxConnectionSize(10); configuration.setNonBlockingSocketsEnabled(true); configuration.setDefaultRequestExpiryTimeout(30000); diff --git a/src/test/resources/server.crt b/src/test/resources/server.crt new file mode 100644 index 00000000..725a02ba --- /dev/null +++ b/src/test/resources/server.crt @@ -0,0 +1,13 @@ +-----BEGIN CERTIFICATE----- +MIICATCCAWoCCQCEwdEo1Uc29TANBgkqhkiG9w0BAQUFADBFMQswCQYDVQQGEwJB +VTETMBEGA1UECAwKU29tZS1TdGF0ZTEhMB8GA1UECgwYSW50ZXJuZXQgV2lkZ2l0 +cyBQdHkgTHRkMB4XDTEzMDQxMDIzNTI1M1oXDTE0MDQxMDIzNTI1M1owRTELMAkG +A1UEBhMCQVUxEzARBgNVBAgMClNvbWUtU3RhdGUxITAfBgNVBAoMGEludGVybmV0 +IFdpZGdpdHMgUHR5IEx0ZDCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAs9ao +eqfWIKjMQ+hggOclu6/zftOrvoCcZ8HYoE5G2YOQuvT2zIcTDR5EHcMuhlkF/5SV +ta4baG6EZdO/WE3sJcVjJ64/5gBAXAOzw+f/pNoPyEGnFzpJugKemy0WntdHZZ9h +83OO2iKdk1Oco+7qc7MFaItoQsempiQPniQa+uMCAwEAATANBgkqhkiG9w0BAQUF +AAOBgQBxUQtSeudvSUFNZSR7QdW3Kh8Gb1+ay9LNnQ/rcW+5pXk88inHIIzIdjo9 +NUwhRNLRyQUzW7sHTOut5lEZpkkOTFopoa2lmwyw7pZqDoVm71aKmxoCK5nwC8t7 +O4cHK2mWeZ1moUuemdKQZFVMAGS8TBgTlCump311o/2qOzEZaw== +-----END CERTIFICATE----- diff --git a/src/test/resources/server.key b/src/test/resources/server.key new file mode 100644 index 00000000..06be013b --- /dev/null +++ b/src/test/resources/server.key @@ -0,0 +1,15 @@ +-----BEGIN RSA PRIVATE KEY----- +MIICXQIBAAKBgQCz1qh6p9YgqMxD6GCA5yW7r/N+06u+gJxnwdigTkbZg5C69PbM +hxMNHkQdwy6GWQX/lJW1rhtoboRl079YTewlxWMnrj/mAEBcA7PD5/+k2g/IQacX +Okm6Ap6bLRae10dln2Hzc47aIp2TU5yj7upzswVoi2hCx6amJA+eJBr64wIDAQAB +AoGALzCboxvZb1Z7yzH16L0+xIJGJbiLb4C2Ce/u1RnVM4x3dOeEv2SOVjnj699k +nPJNRaSKqFLYdE3TxhiLNDO2TD5fhCHdwN+bczNLX7FH2LRGgVNi7WNGLcFOKXkp +WPke9zxcqTT6QiCw9upa2VrzzMFK7mb1pYPaGDOktdraWBkCQQDa1KSQ5n3OL6ue +xHS4Nl+AJhu0dtbaHD4/lKZMINbH5x/yZ8Jl0YI16cWf0ERfSqIjCWLybYaWp23D +y36YHkh1AkEA0mKHzFMg/StWojLGOQmYS8SGEm6g5USOiovq2v5LYVN+kPpJj9qf +ju6cPsfOuFnXpknw/x0dji0dKvHTAgSK9wJBAIwmRiN7SzVjeIHdhnd4c1+KiJHi +zqWwEvn7hSoamhQ7ZU2FwI4fSUqoJua8px10mjTgTRvAo8MXBgiw6qoYMwUCQQC1 +hbIpx6f1CMmtFSYW3IJ9DUmo6a8FYkuimuq+nR6pEQNpT6rc5gM5rgM93+QrB8mb +frzjQVnY7G/4N8KaQRUtAkAaJnEV2MFXgKdiE8uLuGnrRBjRovDxM93H3zjlTAaO +fSkL6WL8/g2RYrw2/W4WNu8I9Eqh0XlqSelFQYLd5FQE +-----END RSA PRIVATE KEY----- diff --git a/src/test/resources/stunnel.conf b/src/test/resources/stunnel.conf new file mode 100644 index 00000000..7cffd72a --- /dev/null +++ b/src/test/resources/stunnel.conf @@ -0,0 +1,9 @@ +client=no +foreground=yes +debug=7 +pid=/tmp/stunnel.pid +cert=src/test/resources/server.crt +key=src/test/resources/server.key +[smpp] +accept=2777 +connect=127.0.0.1:2776