Skip to content

Commit bffa368

Browse files
committed
Merge branch 'master' of github.com:wfg/docker-openvpn-client
2 parents dc5d456 + ffddfb0 commit bffa368

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ services:
7878
| `PROXY_PASSWORD` | | Credentials for accessing the proxies. If `PROXY_PASSWORD` is specified, you must also specify `PROXY_USERNAME`. |
7979
| `PROXY_USERNAME_SECRET` | | Docker secrets that contain the credentials for accessing the proxies. If `PROXY_USERNAME_SECRET` is specified, you must also specify `PROXY_PASSWORD_SECRET`. |
8080
| `PROXY_PASSWORD_SECRET` | | Docker secrets that contain the credentials for accessing the proxies. If `PROXY_PASSWORD_SECRET` is specified, you must also specify `PROXY_USERNAME_SECRET`. |
81+
| `LISTEN_ON` | | Address the proxies will be listening on. Set to `0.0.0.0` to allow all IP addresses. |
8182

8283
##### Environment variable considerations
8384
###### `SUBNETS`

data/scripts/entry.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ SOCKS proxy: ${SOCKS_PROXY:-off}
3939
Proxy username secret: ${PROXY_PASSWORD_SECRET:-none}
4040
Proxy password secret: ${PROXY_USERNAME_SECRET:-none}
4141
Allowing subnets: ${SUBNETS:-none}
42-
Using OpenVPN log level: $vpn_log_level"
42+
Using OpenVPN log level: $vpn_log_level
43+
Listening on: ${LISTEN_ON:-none}"
4344

4445
if [ -n "$VPN_CONFIG_FILE" ]; then
4546
config_file_original="/data/vpn/$VPN_CONFIG_FILE"
@@ -165,6 +166,9 @@ if [ "$HTTP_PROXY" = "on" ]; then
165166
fi
166167

167168
if [ "$SOCKS_PROXY" = "on" ]; then
169+
if [ "$LISTEN_ON" ]; then
170+
sed -i "s/internal: eth0/internal: $LISTEN_ON/" /data/sockd.conf
171+
fi
168172
if [ "$PROXY_USERNAME" ]; then
169173
if [ "$PROXY_PASSWORD" ]; then
170174
echo "Configuring SOCKS proxy authentication."

data/scripts/tinyproxy_wrapper.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,12 @@ until ip link show tun0 2>&1 | grep -qv "does not exist"; do
88
sleep 1
99
done
1010

11-
addr_eth=$(ip a show dev eth0 | grep inet | cut -d " " -f 6 | cut -d "/" -f 1)
12-
addr_tun=$(ip a show dev tun0 | grep inet | cut -d " " -f 6 | cut -d "/" -f 1)
11+
function get_addr {
12+
echo $(ip a show dev $1 | grep inet | cut -d " " -f 6 | cut -d "/" -f 1)
13+
}
14+
15+
addr_eth=${LISTEN_ON:-$(get_addr eth0)}
16+
addr_tun=$(get_addr tun0)
1317
sed -i \
1418
-e "/Listen/c Listen $addr_eth" \
1519
-e "/Bind/c Bind $addr_tun" \

0 commit comments

Comments
 (0)