generated from Templates/Baseline
44 lines
781 B
Bash
44 lines
781 B
Bash
|
#!/usr/bin/env bash
|
||
|
|
||
|
set -e
|
||
|
|
||
|
CONFIG = "/etc/tinyrpoxy/tinyproxy.conf"
|
||
|
|
||
|
function writeConfig() {
|
||
|
cat << EOF >> "$CONFIG"
|
||
|
User $TINYPROXY_UID
|
||
|
Group $TINYPROXY_GID
|
||
|
Port $PORT
|
||
|
Timeout $TIMEOUT
|
||
|
DefaultErrorFile "/usr/share/tinyproxy/default.html"
|
||
|
|
||
|
StatHost "tinyproxy.stats"
|
||
|
StatFile "/usr/share/tinyproxy/stats.html"
|
||
|
|
||
|
LogLevel $LOGLEVEL
|
||
|
MaxClients $MAXCLIENTS
|
||
|
ViaProxyName "tinyproxy"
|
||
|
|
||
|
Filter "$FILTER_FILE"
|
||
|
FilterURLs Off
|
||
|
FilterCaseSensitive Off
|
||
|
FilterDefaultDeny Yes
|
||
|
|
||
|
Allow 127.0.0.1/8
|
||
|
Allow 10.0.0.0/8
|
||
|
|
||
|
EOF
|
||
|
}
|
||
|
|
||
|
function addUpstreamConfig() {
|
||
|
[ -z "$UPSTREAM_PROXY_FILE" ] || export UPSTREAM_PROXY=$(cat $UPSTREAM_PROXY_FILE)
|
||
|
[ -z "$UPSTREAM_PROXY" ] || echo "upstream http $UPSTREAM_PROXY \".\"" >> "$CONFIG"
|
||
|
}
|
||
|
|
||
|
function main() {
|
||
|
writeConfig
|
||
|
addUpstreamConfig
|
||
|
}
|
||
|
|
||
|
main $@
|