X-Git-Url: https://ruderich.org/simon/gitweb/?p=tlsproxy%2Ftlsproxy.git;a=blobdiff_plain;f=src%2Ftlsproxy-setup;h=ba71e56c127381df0dc8351cd2316f15ee09b702;hp=d76c998689454c38d004a93d304f00aa932302ee;hb=7eba49d24d56288d83746f3f0ce383d7c0c36552;hpb=df1daac85cc5baa6ded75040b36e2b1743ac4a19 diff --git a/src/tlsproxy-setup b/src/tlsproxy-setup index d76c998..ba71e56 100755 --- a/src/tlsproxy-setup +++ b/src/tlsproxy-setup @@ -4,7 +4,7 @@ # # Requires certtool (from GnuTLS). # -# Copyright (C) 2011-2013 Simon Ruderich +# Copyright (C) 2011-2014 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 @@ -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