X-Git-Url: https://ruderich.org/simon/gitweb/?p=tlsproxy%2Ftlsproxy.git;a=blobdiff_plain;f=src%2Ftlsproxy-setup;fp=src%2Ftlsproxy-setup;h=155b8c90786c9aff26a520b0d9caad45dfbec69d;hp=d76c998689454c38d004a93d304f00aa932302ee;hb=636a400063eee95cfecaa4c4a655b0fbf032e210;hpb=061aa8165e1d74ab90b1fe3b07870536779a67ce diff --git a/src/tlsproxy-setup b/src/tlsproxy-setup index d76c998..155b8c9 100755 --- a/src/tlsproxy-setup +++ b/src/tlsproxy-setup @@ -23,11 +23,23 @@ set -e -if test "$#" -ne 0; then - echo "Usage: $0" +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