aboutsummaryrefslogtreecommitdiff
path: root/websockets/generate_cert.sh
diff options
context:
space:
mode:
Diffstat (limited to 'websockets/generate_cert.sh')
-rwxr-xr-xwebsockets/generate_cert.sh11
1 files changed, 11 insertions, 0 deletions
diff --git a/websockets/generate_cert.sh b/websockets/generate_cert.sh
new file mode 100755
index 0000000..26315a1
--- /dev/null
+++ b/websockets/generate_cert.sh
@@ -0,0 +1,11 @@
+#!/usr/bin/env bash
+if [[ $# -ne 2 ]]; then
+ echo >&2 "Usage: $0 <key.pem> <cert.pem>"
+ echo >&2 "<key.pem> is the filename for the private key; <cert.pem> is the filename for"
+ echo >&2 "the public certificate."
+ exit 1
+fi
+
+keyfile="$1"
+certfile="$2"
+openssl req -x509 -newkey rsa:4096 -keyout "$keyfile" -out "$certfile" -nodes -subj '/CN=localhost'