dns resolvers changing using environment variables
This commit is contained in:
parent
93902a6aef
commit
7200ecad96
@ -4,11 +4,12 @@ config /etc/3proxy/3proxy.cfg
|
|||||||
# you may use system to execute some external command if proxy starts
|
# you may use system to execute some external command if proxy starts
|
||||||
system "echo `which 3proxy`': Starting 3proxy'"
|
system "echo `which 3proxy`': Starting 3proxy'"
|
||||||
|
|
||||||
# We can configure nservers to avoid unsafe gethostbyname() usage
|
# We can configure nservers to avoid unsafe gethostbyname() usage (max 5 servers)
|
||||||
|
#NSERVER1
|
||||||
|
#NSERVER2
|
||||||
nserver 1.0.0.1
|
nserver 1.0.0.1
|
||||||
nserver 1.1.1.1
|
nserver 1.1.1.1
|
||||||
nserver 8.8.4.4
|
nserver 8.8.4.4
|
||||||
nserver 8.8.8.8
|
|
||||||
|
|
||||||
# nscache is good to save speed, traffic and bandwidth
|
# nscache is good to save speed, traffic and bandwidth
|
||||||
nscache 65536
|
nscache 65536
|
||||||
|
@ -4,6 +4,12 @@ All notable changes to this package will be documented in this file.
|
|||||||
|
|
||||||
The format is based on [Keep a Changelog][keepachangelog] and this project adheres to [Semantic Versioning][semver].
|
The format is based on [Keep a Changelog][keepachangelog] and this project adheres to [Semantic Versioning][semver].
|
||||||
|
|
||||||
|
## v1.6.0
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Possibility of changing DNS resolvers using environment variables `NAME_SERVER_1` (primary) and `NAME_SERVER_2` (secondary)
|
||||||
|
|
||||||
## v1.5.0
|
## v1.5.0
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
@ -6,7 +6,7 @@ ARG Z3PROXY_VERSION=0.9.4
|
|||||||
|
|
||||||
# Fetch 3proxy sources
|
# Fetch 3proxy sources
|
||||||
RUN set -x \
|
RUN set -x \
|
||||||
&& git clone --branch "${Z3PROXY_VERSION}" https://github.com/z3APA3A/3proxy.git /tmp/3proxy
|
&& git -c advice.detachedHead=false clone --depth 1 --branch "${Z3PROXY_VERSION}" https://github.com/z3APA3A/3proxy.git /tmp/3proxy
|
||||||
|
|
||||||
WORKDIR /tmp/3proxy
|
WORKDIR /tmp/3proxy
|
||||||
|
|
||||||
|
@ -32,9 +32,11 @@ All supported image tags [can be found here][link_docker_tags].
|
|||||||
## Supported environment variables
|
## Supported environment variables
|
||||||
|
|
||||||
| Variable name | Description | Example |
|
| Variable name | Description | Example |
|
||||||
|------------------|------------------------|------------|
|
|------------------|-------------------------------------|------------------------|
|
||||||
| `PROXY_LOGIN` | Authorization login | `username` |
|
| `PROXY_LOGIN` | Authorization login | `username` |
|
||||||
| `PROXY_PASSWORD` | Authorization password | `password` |
|
| `PROXY_PASSWORD` | Authorization password | `password` |
|
||||||
|
| `NAME_SERVER_1` | Primary nameserver (dns resolver) | `8.8.8.8` |
|
||||||
|
| `NAME_SERVER_2` | Secondary nameserver (dns resolver) | `2001:4860:4860::8844` |
|
||||||
|
|
||||||
## How can I use this?
|
## How can I use this?
|
||||||
|
|
||||||
@ -47,7 +49,7 @@ $ docker run --rm -d \
|
|||||||
tarampampam/3proxy:latest
|
tarampampam/3proxy:latest
|
||||||
```
|
```
|
||||||
|
|
||||||
Or with auth settings:
|
Or with auth & resolver settings:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ docker run --rm -d \
|
$ docker run --rm -d \
|
||||||
@ -55,6 +57,7 @@ $ docker run --rm -d \
|
|||||||
-p "1080:1080/tcp" \
|
-p "1080:1080/tcp" \
|
||||||
-e "PROXY_LOGIN=evil" \
|
-e "PROXY_LOGIN=evil" \
|
||||||
-e "PROXY_PASSWORD=live" \
|
-e "PROXY_PASSWORD=live" \
|
||||||
|
-e "NAME_SERVER_1=2001:4860:4860::8888" \
|
||||||
tarampampam/3proxy:latest
|
tarampampam/3proxy:latest
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -3,10 +3,22 @@ set -e
|
|||||||
|
|
||||||
PROXY_LOGIN=${PROXY_LOGIN:-} # string
|
PROXY_LOGIN=${PROXY_LOGIN:-} # string
|
||||||
PROXY_PASSWORD=${PROXY_PASSWORD:-} # string
|
PROXY_PASSWORD=${PROXY_PASSWORD:-} # string
|
||||||
|
NAME_SERVER_1=${NAME_SERVER_1:-} # string
|
||||||
|
NAME_SERVER_2=${NAME_SERVER_2:-} # string
|
||||||
|
|
||||||
if [ -n "$PROXY_LOGIN" ] && [ -n "$PROXY_PASSWORD" ]; then
|
if [ -n "$PROXY_LOGIN" ] && [ -n "$PROXY_PASSWORD" ]; then
|
||||||
echo "$0: setup '${PROXY_LOGIN}:${PROXY_PASSWORD}' as proxy user";
|
echo "$0: setup '${PROXY_LOGIN}:${PROXY_PASSWORD}' as proxy user";
|
||||||
sed -i "s~#AUTH_SETTINGS~users ${PROXY_LOGIN}:CL:${PROXY_PASSWORD}\nauth strong\nallow ${PROXY_LOGIN}~" /etc/3proxy/3proxy.cfg
|
sed -i "s~#AUTH_SETTINGS~users ${PROXY_LOGIN}:CL:${PROXY_PASSWORD}\nauth strong\nallow ${PROXY_LOGIN}~" /etc/3proxy/3proxy.cfg
|
||||||
fi;
|
fi;
|
||||||
|
|
||||||
|
if [ -n "$NAME_SERVER_1" ]; then
|
||||||
|
echo "$0: setup '${NAME_SERVER_1}' as the first nameserver";
|
||||||
|
sed -i "s~#NSERVER1~nserver ${NAME_SERVER_1}~" /etc/3proxy/3proxy.cfg
|
||||||
|
fi;
|
||||||
|
|
||||||
|
if [ -n "$NAME_SERVER_2" ]; then
|
||||||
|
echo "$0: setup '${NAME_SERVER_2}' as the second nameserver";
|
||||||
|
sed -i "s~#NSERVER2~nserver ${NAME_SERVER_2}~" /etc/3proxy/3proxy.cfg
|
||||||
|
fi;
|
||||||
|
|
||||||
exec "$@"
|
exec "$@"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user