This commit is contained in:
Paramtamtam
2020-07-11 11:49:43 +05:00
parent 6d94db1ba6
commit 04fb12076c
6 changed files with 49 additions and 48 deletions

View File

@@ -15,46 +15,7 @@ if [ "$AUTH_REQUIRED" = "true" ]; then
fi;
echo "$0: setup '${PROXY_LOGIN}:${PROXY_PASSWORD}' as proxy user";
echo "${PROXY_LOGIN}:CL:${PROXY_PASSWORD}" > /etc/3proxy/passwd
fi;
echo "$0: rewrite configuration file";
cat << \EOF > /etc/3proxy/3proxy.cfg
#!/usr/bin/3proxy
config /etc/3proxy/3proxy.cfg
# you may use system to execute some external command if proxy starts
system "echo `which 3proxy`': Starting 3proxy'"
# We can configure nservers to avoid unsafe gethostbyname() usage
nserver 1.0.0.1
nserver 1.1.1.1
nserver 8.8.4.4
nserver 8.8.8.8
# nscache is good to save speed, traffic and bandwidth
nscache 65536
# Here we can change timeout values
timeouts 1 5 30 60 180 1800 15 60
log /dev/stdout
logformat "- +_L%t.%. %N.%p %E %U %C:%c %R:%r %O %I %h %T"
maxconn 1024
#AUTH_SETTINGS
proxy -a -p3128
socks -a -p1080
flush
EOF
if [ "$AUTH_REQUIRED" = "true" ]; then
echo "$0: setup auth settings in configuration file";
sed -i "s~#AUTH_SETTINGS~users \$/etc/3proxy/passwd\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;
exec "$@"