Skip to content

Proxy support broke in Gitea 1.18 #22335

Closed
@zfLQ2qx2

Description

@zfLQ2qx2

Description

I run gitea as a tor service so that I do not have to expose ports on my home firewall. Applications on my tor server do not have direct access to the internet, instead the tor daemon acts as a socks5 proxy and is responsible for name resolution and forwarding outgoing traffic through the tor network.

To have gitea work with tor I added the following lines to my app.ini:

[proxy]
ENABLED = true
PROXY_URL = socks://127.0.0.1:9050/
PROXY_HOSTS = *

In versions upto 1.16.1 this worked correctly and I setup mirrors of a number repos from github, gitlab, and .onion domains without issue.

I jumped from 1.16.1 to 1.18.0 and in the latest version all of my mirror connections fail with DNS resolution errors which suggests that gitea is still trying to resolve the names itself instead of entrusting them to the socks5 proxy. This makes it impossible to reach onion addresses also since only the tor client can resolve those.

My test cases to show tor is working are:

ALL_PROXY=socks5h://127.0.0.1:9050/ curl -vvv http://github.com/
ALL_PROXY=socks5h://127.0.0.1:9050/ curl -vvv http://eweiibe6tdjsdprb4px6rqrzzcsi22m4koia44kc5pcjr7nec2rlxyad.onion/

(the later is the gitlab run by the tor project)

I should point out that in curl there is a difference, socks5 and socks5h, where the former uses the libc resolver and the later uses the socks5 resolver. The golang base libraries don't have a distinction.

Gitea Version

1.18

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

Linux

How are you running Gitea?

gitea-1.18.0-linux-amd64 from github releases

Database

SQLite

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions