openwrt / openwrt/packages

tinyproxy - Configuring upstream proxy causes config file syntax error

Open
#19,942 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Makefile
Stars
4.6k
Forks
4k
Avg merge
3d 12h
Merged PRs (30d)
134

Description

Maintainer: @jow-
Environment: Clean Install, 22.03.2 built with imagebuilder. SamKnows WB8.
make image PROFILE=samknows_whitebox-v8 PACKAGES="luci luci-ssl luci-app-uhttpd luci-app-openvpn openvpn-openssl tcpdump luci-app-wireguard wireguard-tools luci-app-mwan3 mwan3 luci-app-tinyproxy tinyproxy"

Description: tinyproxy - Configuring upstream proxy causes config file syntax error

When you configure an upsteam proxy in uci/luci the tinyproxy.conf file generated has a syntax error.

UCI Config:

root@OpenWRT:~# uci export tinyproxy
package tinyproxy

config tinyproxy
        option User 'nobody'
        option Group 'nogroup'
        option Port '8888'
        option Timeout '600'
        option DefaultErrorFile '/usr/share/tinyproxy/default.html'
        option StatFile '/usr/share/tinyproxy/stats.html'
        option LogFile '/var/log/tinyproxy.log'
        option LogLevel 'Info'
        option MaxClients '100'
        option MinSpareServers '5'
        option MaxSpareServers '20'
        option StartServers '10'
        option MaxRequestsPerChild '0'
        option ViaProxyName 'tinyproxy'
        list ConnectPort '443'
        list ConnectPort '563'
        list Allow '127.0.0.1'
        list Allow '192.168.204.0/22'
        option enabled '1'

config upstream
        option type 'proxy'
        option via '172.20.1.175:3128'

Generated config file:

root@OpenWRT:~# cat /tmp/etc/tinyproxy.conf
### AUTOGENERATED CONFIGURATION
### DO NOT EDIT
### SEE /etc/config/tinyproxy INSTEAD

User nobody
Group nogroup
Port 8888
Timeout 600
DefaultErrorFile "/usr/share/tinyproxy/default.html"
StatHost "127.0.0.1"
StatFile "/usr/share/tinyproxy/stats.html"
LogFile "/var/log/tinyproxy.log"
Syslog Off
LogLevel Info
XTinyproxy Off
MaxClients 100
MinSpareServers 5
MaxSpareServers 20
StartServers 10
MaxRequestsPerChild 0
Allow 127.0.0.1
Allow 192.168.204.0/22
ViaProxyName "tinyproxy"
FilterURLs Off
FilterExtended Off
FilterCaseSensitive Off
FilterDefaultDeny No
ConnectPort 443
ConnectPort 563
upstream 172.16.1.1:3128 

At this point tinyproxy refuses to start:

root@OpenWRT:~# tinyproxy -c /tmp/etc/tinyproxy.conf
Syntax error on line 30
Unable to parse config file. Not starting.

Correcting the last line from upstream 172.16.1.1:3128 to upstream http 172.16.1.1:3128 fixes the problem.
Unfortunately the .conf file gets overrwitten in by the /etc/init.d/tinyproxy script so this is useable for testing only.

Fix (I think)
/etc/init.d/tinyproxy line 27 to be updated from echo "upstream $via$target" to echo "upstream http $via$target"

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at line 27 of /etc/init.d/tinyproxy and compare its generated upstream directive with the tinyproxy syntax shown in the issue. Recreate the UCI configuration, run tinyproxy -c /tmp/etc/tinyproxy.conf, and confirm the generated configuration parses and the service starts.

Written by the indexing model from the issue text.

Assessment

Tech stack
shell
Domain
networking
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.