File tree Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ COPY bin/ /usr/local/bin
44
55RUN apt-get update \
66 && apt-get dist-upgrade -y \
7- && apt-get install -y openvpn \
7+ && apt-get install -y openvpn iptables \
88 && apt-get clean \
99 && rm -rf /var/lib/apt/lists/* \
1010 && chmod +x /usr/local/bin/*
Original file line number Diff line number Diff line change 11#! /bin/bash
22
3+ CONFIG_DIR=/etc/openvpn
4+
5+ ENABLE_NAT=${ENABLE_NAT:- 1}
6+ NAT_SOURCE=${NAT_SOURCE:- 10.8.0.0/ 24}
7+ NAT_DEVICE=${NAT_DEVICE:- eth0}
8+
39# Create device for tun interfaces
410mkdir -p /dev/net
511if [ ! -c /dev/net/tun ]; then
6- mknod /dev/net/tun c 10 200
12+ mknod /dev/net/tun c 10 200
13+ fi
14+
15+ if [[ $ENABLE_NAT = 1 ]]; then
16+ iptables -t nat -A POSTROUTING -s ${NAT_SOURCE} -o ${NAT_DEVICE} -j MASQUERADE
717fi
818
9- openvpn --config /etc/ openvpn/openvpn .conf $@
19+ exec openvpn --config ${CONFIG_DIR} / openvpn.conf --cd ${CONFIG_DIR} $@
You can’t perform that action at this time.
0 commit comments