From: Ian Kelling Date: Thu, 13 Jan 2022 19:31:01 +0000 (-0500) Subject: add ifname option X-Git-Url: https://iankelling.org/git/?a=commitdiff_plain;h=05f5ee9aa2a7e237d28155f0330380ce610b0ccf;p=vpn-setup add ifname option --- diff --git a/vpn-server-setup b/vpn-server-setup index 69ce541..a4b203b 100755 --- a/vpn-server-setup +++ b/vpn-server-setup @@ -27,6 +27,7 @@ usage: ${0##*/} [OPTIONS] [IPV6_ADDR/BITS] -6 IP6_NETWORK Do ip6 nat for this network. ipv6 will work without nat, but you may want it in certain circumstances. -d Do not push dns +-i INTERFACE_NAME name of tun interface -n NAME default = server. 2 servers on the same host need different names. -p PORT default 1194 -r Do not push default route @@ -58,13 +59,14 @@ route=true start=true ip4=10.8.0 name=server -temp=$(getopt -l help 4:6:dn:p:rsh "$@") || usage 1 +temp=$(getopt -l help 4:6:di:n:p:rsh "$@") || usage 1 eval set -- "$temp" while true; do case $1 in -4) ip4=$2; shift 2 ;; -6) ip6net=$2; shift 2 ;; -d) dns=false; shift ;; + -i) ifname=$2; shift 2 ;; -n) name=$2; shift 2 ;; -p) port=$2; shift 2 ;; -r) route=false; shift ;; @@ -160,8 +162,12 @@ if ! $keys_exist; then fi fi - -gzip -dc /usr/share/doc/openvpn/examples/sample-config-files/server.conf.gz >$conf +if [[ -e /usr/share/doc/openvpn/examples/sample-config-files/server.conf ]]; then + cat /usr/share/doc/openvpn/examples/sample-config-files/server.conf >$conf +else + # pre-bullsye name + gzip -dc /usr/share/doc/openvpn/examples/sample-config-files/server.conf.gz >$conf +fi cafile=$server_dir/ca-$name.crt cp $ca_origin $cafile @@ -222,6 +228,12 @@ push "dhcp-option DNS $ip4.1" EOF fi +if [[ $ifname ]]; then + cat >>$conf <>$conf <