summaryrefslogtreecommitdiff
path: root/release/src/router/httpd/gencert.sh
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2015-01-03 12:04:58 +0100
committerAndreas Baumann <mail@andreasbaumann.cc>2015-01-03 12:04:58 +0100
commit008d0be72b2f160382c6e880765e96b64a050c65 (patch)
tree36f48a98a3815a408e2ce1693dd182af90f80305 /release/src/router/httpd/gencert.sh
parent611becfb8726c60cb060368541ad98191d4532f5 (diff)
downloadtomato-008d0be72b2f160382c6e880765e96b64a050c65.tar.gz
tomato-008d0be72b2f160382c6e880765e96b64a050c65.tar.bz2
imported original firmware WRT54GL_v4.30.11_11_US
Diffstat (limited to 'release/src/router/httpd/gencert.sh')
-rwxr-xr-xrelease/src/router/httpd/gencert.sh18
1 files changed, 18 insertions, 0 deletions
diff --git a/release/src/router/httpd/gencert.sh b/release/src/router/httpd/gencert.sh
new file mode 100755
index 00000000..52e64d96
--- /dev/null
+++ b/release/src/router/httpd/gencert.sh
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+SECS=$1
+
+# create the key and certificate request
+openssl req -new -out /tmp/cert.csr -config /etc/openssl.cnf -keyout /tmp/privkey.pem -newkey rsa:512 -passout pass:password
+# remove the passphrase from the key
+openssl rsa -in /tmp/privkey.pem -out /tmp/key.pem -passin pass:password
+# convert the certificate request into a signed certificate
+if test "$SECS" -eq "" ; then
+ openssl x509 -in /tmp/cert.csr -out /tmp/cert.pem -req -signkey /tmp/key.pem -days 3650
+else
+ openssl x509 -in /tmp/cert.csr -out /tmp/cert.pem -req -signkey /tmp/key.pem -days 3650 -setstartsecs $SECS
+fi
+# Show human-readable format
+openssl x509 -in /tmp/cert.pem -text -noout
+# Remove unused files
+rm -f /tmp/cert.csr /tmp/privkey.pem