summaryrefslogtreecommitdiff
path: root/public/fs/etc/openvpn/hostvpn-conf.sh
blob: 24cb39028c6088360049929100940673bca04268 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/sh

set -eu

sitezone="$1"

cfg_script="$0"
cfg_srcdir=$(cd -- "${cfg_script%/*}/" ; pwd -P)

source /root/config/private/config/server.ports
source /root/config/private/config/hostinfo/${sitezone}

if [ ${vpn_route_all} = 'yes' ]; then
	vpn_route_all_subst='s/^@vpn_route_all@ //g'
else
	vpn_route_all_subst='/^@vpn_route_all@ /d'
fi

sed -e 's/@vpn_port@/'${vpn_port}'/g'    \
	-e 's/@hostname@/'${hostname}'/g' \
	-e 's/@vpn_net4@/'${vpn_net4}'/g'  \
	-e 's/@vpn_ipv4@/'${vpn_ipv4}'/g'   \
	-e 's/@host_ipv4@/'${host_ipv4}'/g'  \
	-e 's/@host_ipv6@/'${host_ipv6}'/g'   \
	-e "${vpn_route_all_subst}"            \
	"${cfg_srcdir}/hostvpn.conf.in"