aboutsummaryrefslogtreecommitdiff
path: root/tlsproxy.sh
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2021-12-30 21:23:24 +0100
committerAlex Auvolat <alex@adnab.me>2021-12-30 21:23:24 +0100
commit1ade671f964516976151ab8b2e8dc6027aa9e73f (patch)
treef771a27cdf930bf8104eff1e63699438f4794bdf /tlsproxy.sh
parent6718d7f1da80fa6ed70d084a7c4df61a2b3187ed (diff)
downloadnixcfg-1ade671f964516976151ab8b2e8dc6027aa9e73f.tar.gz
nixcfg-1ade671f964516976151ab8b2e8dc6027aa9e73f.zip
Add readme and cleanup a bit
Diffstat (limited to 'tlsproxy.sh')
-rwxr-xr-xtlsproxy.sh20
1 files changed, 20 insertions, 0 deletions
diff --git a/tlsproxy.sh b/tlsproxy.sh
new file mode 100755
index 0000000..aa0006a
--- /dev/null
+++ b/tlsproxy.sh
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+YEAR=$(date +%Y)
+
+_int() {
+ echo "Caught SIGINT signal!"
+ kill -INT "$child1" 2>/dev/null
+ kill -INT "$child2" 2>/dev/null
+}
+
+trap _int SIGINT
+
+socat -dd tcp4-listen:4646,reuseaddr,fork openssl:localhost:14646,cert=secrets/pki/nomad$YEAR-client.crt,key=secrets/pki/nomad$YEAR-client.key,cafile=secrets/pki/nomad$YEAR.crt &
+child1=$!
+
+socat -dd tcp4-listen:8500,reuseaddr,fork openssl:localhost:8501,cert=secrets/pki/consul$YEAR-client.crt,key=secrets/pki/consul$YEAR-client.key,cafile=secrets/pki/consul$YEAR.crt &
+child2=$!
+
+wait "$child1"
+wait "$child2"