Make insignificant changes

This commit is contained in:
Wyatt Gill 2022-10-29 16:28:16 -05:00
parent 333fcc682a
commit d3ce6295ff
4 changed files with 15 additions and 31 deletions

View file

@ -1,20 +0,0 @@
#!/usr/bin/env python3
import argparse
import datetime
import subprocess
parser = argparse.ArgumentParser()
parser.add_argument('image_version')
args = parser.parse_args()
docker_build_cmd = [
'docker', 'build',
'--build-arg', f'BUILD_DATE={str(datetime.datetime.utcnow())}',
'--build-arg', f'IMAGE_VERSION={args.image_version}',
'--tag', f'ghcr.io/wfg/openvpn-client:{args.image_version}',
'--tag', 'ghcr.io/wfg/openvpn-client:latest',
'./build',
]
subprocess.run(docker_build_cmd)

View file

@ -1,6 +1,8 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -e set -o errexit
set -o nounset
set -o pipefail
cleanup() { cleanup() {
kill TERM "$openvpn_pid" kill TERM "$openvpn_pid"
@ -19,7 +21,7 @@ else
fi fi
if [[ -z $config_file ]]; then if [[ -z $config_file ]]; then
>&2 echo 'no openvpn configuration file found' echo "no openvpn configuration file found" >&2
exit 1 exit 1
fi fi

View file

@ -1,6 +1,8 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -e set -o errexit
set -o nounset
set -o pipefail
iptables --insert OUTPUT \ iptables --insert OUTPUT \
! --out-interface tun0 \ ! --out-interface tun0 \
@ -19,14 +21,14 @@ done
# Punch holes in the firewall for the OpenVPN server addresses # Punch holes in the firewall for the OpenVPN server addresses
# $config is set by OpenVPN: # $config is set by OpenVPN:
# "Name of first --config file. Set on program initiation and reset on SIGHUP." # "Name of first --config file. Set on program initiation and reset on SIGHUP."
global_port=$(awk '$1 == "port" { print $2 }' "${config:?}") global_port=$(awk '$1 == "port" { print $2 }' "${config:?"config file not found by kill switch"}")
global_protocol=$(awk '$1 == "proto" { print $2 }' "${config:?}") global_protocol=$(awk '$1 == "proto" { print $2 }' "${config:?"config file not found by kill switch"}")
remotes=$(awk '$1 == "remote" { print $2, $3, $4 }' "${config:?}") remotes=$(awk '$1 == "remote" { print $2, $3, $4 }' "${config:?"config file not found by kill switch"}")
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]))$' 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]))$'
while IFS= read -r line; do while IFS= read -r line; do
# Read a comment-stripped version of the line # Read a comment-stripped version of the line
# Fixes #84 # Fixes #84
IFS=' ' read -ra remote <<< "${line%%\#*}" IFS=" " read -ra remote <<< "${line%%\#*}"
address=${remote[0]} address=${remote[0]}
port=${remote[1]:-${global_port:-1194}} port=${remote[1]:-${global_port:-1194}}
protocol=${remote[2]:-${global_protocol:-udp}} protocol=${remote[2]:-${global_protocol:-udp}}

View file

@ -3,11 +3,11 @@ services:
image: ghcr.io/wfg/openvpn-client:latest image: ghcr.io/wfg/openvpn-client:latest
container_name: openvpn-client container_name: openvpn-client
cap_add: cap_add:
- NET_ADMIN - NET_ADMIN
devices: devices:
- /dev/net/tun:/dev/net/tun - /dev/net/tun:/dev/net/tun
environment: environment:
- ALLOWED_SUBNETS=192.168.10.0/24 - ALLOWED_SUBNETS=192.168.10.0/24
volumes: volumes:
- ./local:/config - ./local:/config
restart: unless-stopped restart: unless-stopped