#
# Requires certtool (from GnuTLS).
#
-# Copyright (C) 2011 Simon Ruderich
+# Copyright (C) 2011-2012 Simon Ruderich
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
tempfile=`mktemp` || exit 1
die() {
- rm -f $tempfile
+ rm -f "$tempfile"
exit 1
}
# Generate proxy CA key file.
certtool --generate-privkey > proxy-ca-key.pem || die
# Generate proxy CA.
-echo 'cn = tlsproxy CA' > $tempfile
-echo ca >> $tempfile
-echo cert_signing_key >> $tempfile
+echo 'cn = tlsproxy CA' > "$tempfile"
+echo ca >> "$tempfile"
+echo cert_signing_key >> "$tempfile"
certtool --generate-self-signed \
--load-privkey proxy-ca-key.pem \
- --template $tempfile \
+ --template "$tempfile" \
--outfile proxy-ca.pem || die
# Generate proxy key file.
# Generate proxy "invalid" server certificate. It's used for problematic
# connections.
-echo 'organization = tlsproxy' > $tempfile
-echo 'cn = invalid' >> $tempfile
-echo tls_www_server >> $tempfile
-echo encryption_key >> $tempfile
-echo signing_key >> $tempfile
+echo 'organization = tlsproxy' > "$tempfile"
+echo 'cn = invalid' >> "$tempfile"
+echo tls_www_server >> "$tempfile"
+echo encryption_key >> "$tempfile"
+echo signing_key >> "$tempfile"
certtool --generate-self-signed \
--load-privkey proxy-key.pem \
- --template $tempfile \
+ --template "$tempfile" \
--outfile proxy-invalid.pem || die
-rm $tempfile
+rm "$tempfile"
echo done