X-Git-Url: https://iankelling.org/git/?p=vpn-setup;a=blobdiff_plain;f=vpn-mk-client-cert;h=baecdf1cf30b5ee5539b8829db9e4cd4aa7e9705;hp=1aa9b4166aca033059b65b25328c829a68677b15;hb=dacf50e689875098352985acadc8210d845b358d;hpb=c34b9b437d4a7173190ea58e040a3ae76f7410d7 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: