Skip to content

Unix socket: cannot pull/push over SSH #3741

Closed
@sloonz

Description

@sloonz
  • Gitea version (or commit ref): 1.4.0
  • Git version: 2.16.3
  • Go version: 1.10
  • Operating system: ArchLinux
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant

Description

With the following configuration (actual domain redacted by example.com) in the [server] section:

PROTOCOL                   = unix
HTTP_ADDR                  = /run/nginx/gitea.sock
DOMAIN                     = git.example.com
ROOT_URL                   = https://git.example.com/
LOCAL_ROOT_URL = %(PROTOCOL)s://%(HTTP_ADDR)s:%(HTTP_PORT)s/

Trying to perform a git pull/push via SSH results in an error :

UpdatePublicKey: Post unix:///run/nginx/gitea.sockapi/internal/ssh/1/update: unsupported protocol scheme "unix"

Looks like a regression over #2232, which has been fixed months ago. Adding some good old Printf traces in the code, I can see that req.SetTransport is called in newInternalRequest, but the Dial function that is set up there is never called ; the error is encountered before then. Changing LOCAL_ROOT_URL to http://%(DOMAIN)s/ fixes the issue : both the req.SetTransport and Dial functions are called, and the request is performed on the unix socket (no log in the reverse proxy that’s listening on https://git.example.com/, and adding deny all on the reverse proxy do not prevent SSH pull/push), but that does not looks like to be the intended behavior.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type/questionIssue needs no code to be fixed, only a description on how to fix it yourself.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions