commit 74616be5713bcb27e622082589323d6b9f78c7c5
parent 2e38ff9cdec602aae0b5470ea81f73d691960153
Author: Christoph Lohmann <20h@r-36.net>
Date: Wed, 21 Nov 2012 11:16:47 +0100
Adding some more examples how to use socat.
Diffstat:
7 files changed, 41 insertions(+), 0 deletions(-)
diff --git a/examples/gencert.sh b/examples/gencert.sh
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+if [ $# -gt 0 ];
+then
+ KEY="$1"
+else
+ KEY="nonhttpd"
+fi
+
+openssl genrsa -out "${KEY}.key" 1024
+openssl req -new -key "${KEY}.key" -x509 -days 3653 -out "${KEY}.crt"
+cat "${KEY}.key" "${KEY}.crt" > "${KEY}.pem"
+chmod 600 "${KEY}.key" "${KEY}.pem"
+
diff --git a/examples/gencerts.sh b/examples/gencerts.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+./gencert.sh server
+./gencert.sh client
+
diff --git a/examples/socat-nonhttpd-cert-client.sh b/examples/socat-nonhttpd-cert-client.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+socat stdio openssl-connect:localhost:4433,cert=client.pem,cafile=server.crt
+
diff --git a/examples/socat-nonhttpd-cert.sh b/examples/socat-nonhttpd-cert.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+socat openssl-listen:4433,reuseaddr,fork,cert=server.pem,cafile=client.crt \
+ exec:/usr/bin/nonhttpd
+
diff --git a/examples/socat-nonhttpd-ssl-client.sh b/examples/socat-nonhttpd-ssl-client.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+socat stdio openssl-connect:localhost:4433,verify=0
+
diff --git a/examples/socat-nonhttpd-ssl.sh b/examples/socat-nonhttpd-ssl.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+socat openssl-listen:4433,reuseaddr,fork,cert=server.pem,verify=0 \
+ exec:/usr/bin/nonhttpd
+
diff --git a/examples/socat-nonhttpd.sh b/examples/socat-nonhttpd.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+socat tcp-l:8080,reuseaddr,fork exec:/usr/bin/nonhttpd
+