X-Git-Url: https://ruderich.org/simon/gitweb/?a=blobdiff_plain;f=src%2Ftlsproxy-setup;h=155b8c90786c9aff26a520b0d9caad45dfbec69d;hb=636a400063eee95cfecaa4c4a655b0fbf032e210;hp=4b57a2220aafd62c888c6fba8bb9be82a2ef07cf;hpb=33933ff752898dca2d5e5a7b995d129313716d5c;p=tlsproxy%2Ftlsproxy.git diff --git a/src/tlsproxy-setup b/src/tlsproxy-setup index 4b57a22..155b8c9 100755 --- a/src/tlsproxy-setup +++ b/src/tlsproxy-setup @@ -22,6 +22,24 @@ set -e + +if test "$#" -ge 1 && test x"$*" != 'x--force'; then + echo "Usage: $0 [--force]" >&2 + exit 1 +fi + +# Prevent accidental overwrites. +if test x"$1" != 'x--force'; then + for x in proxy-ca-key.pem proxy-ca.pem \ + proxy-key.pem proxy-invalid.pem proxy-dh.pem; do + if test -f "$x"; then + echo "File '$x' already exists. Use --force to overwrite." >&2 + exit 2 + fi + done +fi + + tempfile=`mktemp` trap 'rm -f "$tempfile"' EXIT @@ -59,4 +77,9 @@ certtool --generate-self-signed \ rm "$tempfile" +# Generate proxy Diffie-Hellman parameters. +certtool --generate-dh-params \ + --sec-param high \ + --outfile proxy-dh.pem + echo done