This repository was archived by the owner on Mar 16, 2024. It is now read-only.
File tree 4 files changed +15
-31
lines changed
4 files changed +15
-31
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1
1
#! /usr/bin/env bash
2
2
3
- set -e
3
+ set -o errexit
4
+ set -o nounset
5
+ set -o pipefail
4
6
5
7
cleanup () {
6
8
kill TERM " $openvpn_pid "
19
21
fi
20
22
21
23
if [[ -z $config_file ]]; then
22
- >&2 echo ' no openvpn configuration file found'
24
+ echo " no openvpn configuration file found" >&2
23
25
exit 1
24
26
fi
25
27
Original file line number Diff line number Diff line change 1
1
#! /usr/bin/env bash
2
2
3
- set -e
3
+ set -o errexit
4
+ set -o nounset
5
+ set -o pipefail
4
6
5
7
iptables --insert OUTPUT \
6
8
! --out-interface tun0 \
19
21
# Punch holes in the firewall for the OpenVPN server addresses
20
22
# $config is set by OpenVPN:
21
23
# "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 " } " )
25
27
ip_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]))$'
26
28
while IFS= read -r line; do
27
29
# Read a comment-stripped version of the line
28
30
# Fixes #84
29
- IFS=' ' read -ra remote <<< " ${line%%\#*}"
31
+ IFS=" " read -ra remote <<< " ${line%%\#*}"
30
32
address=${remote[0]}
31
33
port=${remote[1]:- ${global_port:- 1194} }
32
34
protocol=${remote[2]:- ${global_protocol:- udp} }
Original file line number Diff line number Diff line change @@ -3,11 +3,11 @@ services:
3
3
image : ghcr.io/wfg/openvpn-client:latest
4
4
container_name : openvpn-client
5
5
cap_add :
6
- - NET_ADMIN
6
+ - NET_ADMIN
7
7
devices :
8
- - /dev/net/tun:/dev/net/tun
8
+ - /dev/net/tun:/dev/net/tun
9
9
environment :
10
- - ALLOWED_SUBNETS=192.168.10.0/24
10
+ - ALLOWED_SUBNETS=192.168.10.0/24
11
11
volumes :
12
- - ./local:/config
12
+ - ./local:/config
13
13
restart : unless-stopped
You can’t perform that action at this time.
0 commit comments