mirror of
https://github.com/wfg/docker-openvpn-client.git
synced 2025-06-28 04:13:00 -04:00
Make insignificant changes
This commit is contained in:
parent
333fcc682a
commit
d3ce6295ff
4 changed files with 15 additions and 31 deletions
20
build.py
20
build.py
|
@ -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)
|
|
|
@ -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
|
||||||
|
|
||||||
|
|
|
@ -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}}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue