File tree Expand file tree Collapse file tree 4 files changed +15
-31
lines changed Expand file tree Collapse file tree 4 files changed +15
-31
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 11#! /usr/bin/env bash
22
3- set -e
3+ set -o errexit
4+ set -o nounset
5+ set -o pipefail
46
57cleanup () {
68 kill TERM " $openvpn_pid "
1921fi
2022
2123if [[ -z $config_file ]]; then
22- >&2 echo ' no openvpn configuration file found'
24+ echo " no openvpn configuration file found" >&2
2325 exit 1
2426fi
2527
Original file line number Diff line number Diff line change 11#! /usr/bin/env bash
22
3- set -e
3+ set -o errexit
4+ set -o nounset
5+ set -o pipefail
46
57iptables --insert OUTPUT \
68 ! --out-interface tun0 \
1921# Punch holes in the firewall for the OpenVPN server addresses
2022# $config is set by OpenVPN:
2123# "Name of first --config file. Set on program initiation and reset on SIGHUP."
22- global_port=$( awk ' $1 == "port" { print $2 }' " ${config:? } " )
23- global_protocol=$( awk ' $1 == "proto" { print $2 }' " ${config:? } " )
24- remotes=$( awk ' $1 == "remote" { print $2, $3, $4 }' " ${config:? } " )
24+ global_port=$( awk ' $1 == "port" { print $2 }' " ${config:? " config file not found by kill switch " } " )
25+ global_protocol=$( awk ' $1 == "proto" { print $2 }' " ${config:? " config file not found by kill switch " } " )
26+ remotes=$( awk ' $1 == "remote" { print $2, $3, $4 }' " ${config:? " config file not found by kill switch " } " )
2527ip_regex=' ^(([1-9]?[0-9]|1[0-9][0-9]|2([0-4][0-9]|5[0-5]))\.){3}([1-9]?[0-9]|1[0-9][0-9]|2([0-4][0-9]|5[0-5]))$'
2628while IFS= read -r line; do
2729 # Read a comment-stripped version of the line
2830 # Fixes #84
29- IFS=' ' read -ra remote <<< " ${line%%\#*}"
31+ IFS=" " read -ra remote <<< " ${line%%\#*}"
3032 address=${remote[0]}
3133 port=${remote[1]:- ${global_port:- 1194} }
3234 protocol=${remote[2]:- ${global_protocol:- udp} }
Original file line number Diff line number Diff line change @@ -3,11 +3,11 @@ services:
33 image : ghcr.io/wfg/openvpn-client:latest
44 container_name : openvpn-client
55 cap_add :
6- - NET_ADMIN
6+ - NET_ADMIN
77 devices :
8- - /dev/net/tun:/dev/net/tun
8+ - /dev/net/tun:/dev/net/tun
99 environment :
10- - ALLOWED_SUBNETS=192.168.10.0/24
10+ - ALLOWED_SUBNETS=192.168.10.0/24
1111 volumes :
12- - ./local:/config
12+ - ./local:/config
1313 restart : unless-stopped
You can’t perform that action at this time.
0 commit comments