From: Ian Kelling Date: Mon, 31 Aug 2020 19:37:31 +0000 (-0400) Subject: minor improvements X-Git-Url: https://iankelling.org/git/?a=commitdiff_plain;h=dacf50e689875098352985acadc8210d845b358d;p=vpn-setup minor improvements --- diff --git a/client-cert-helper b/client-cert-helper index 6589c40..40078aa 100755 --- a/client-cert-helper +++ b/client-cert-helper @@ -6,6 +6,8 @@ set -eE -o pipefail rm -f /tmp/vpn-mk-client-cert.log exec 2>/tmp/vpn-mk-client-cert.log +date >&2 + name=$1 common_name=$2 diff --git a/vpn-mk-client-cert b/vpn-mk-client-cert index 1aa9b41..baecdf1 100755 --- a/vpn-mk-client-cert +++ b/vpn-mk-client-cert @@ -25,15 +25,17 @@ usage() { cat <<'EOF' usage: ${0##*/} VPN_SERVER_HOST --b COMMON_NAME By default, use $HOSTNAME or $CLIENT_HOST. If the cert - already exists on the server, with the CLIENT_NAME - name, we use the existing one. See comment below if we - ever want to check existing common names. They must be - unique per server, so you can use $(uuidgen) if - needed. You used to be able to create multiple with the - same name, but not connect at the same time, but now, - the generator keeps track, so you can't generate. --c CLIENT_HOST default is localhost. Else we ssh to root@CLIENT_HOST +-b COMMON_NAME By default, use $CLIENT_HOST or if it is not given, + $HOSTNAME. If the cert already exists on the server, + with the CLIENT_NAME name, we use the existing one. See + comment below if we ever want to check existing common + names. They must be unique per server, so you can use + $(uuidgen) if needed. You used to be able to create + multiple with the same name, but not connect at the + same time, but now, the generator keeps track, so you + can't generate. + +-c CLIENT_HOST Default is localhost. Else we ssh to root@CLIENT_HOST. -n CONFIG_NAME default is client -s SCRIPT_PATH Use custom up/down script at SCRIPT_PATH. copied to same path on client, if client is not localhost. @@ -92,8 +94,8 @@ host=$1 ####### end command line parsing and checking ############## - # bash or else we get motd spam. note sleep 2, sleep 1 failed. +$shell '[[ -e /etc/openvpn ]] || apt install openvpn' if ! ssh root@$host bash -s -- $name $common_name < client-cert-helper \ | $shell 'id -u | grep -xF 0 || s=sudo; $s tar xzv -C /etc/openvpn/client'; then echo ssh root@$host cat /tmp/vpn-mk-client-cert.log: