-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GetRepositoryByOwnerAndName fails when running natively on HTTPS #5800
Comments
Thank you @joohoi for this detailed bug report. I haven't personally duplicated your bug but from your information provided I'm going to set the reviewed/confirmed tag. I'm not sure which approach to take. Clearly this can be fixed for the majority by using the configuration options that are already there - so fixing the documentation is an option. However that's slightly annoying and goes against the principle that Gitea should be painless. On the other hand, it could be very difficult to assure that the remote URL is definitely reachable from the localhost. It's certainly possible that a device may have an external domain name that it itself cannot connect to.
I wonder is there any way to provide a preresolved ip i.e. http_addr or 127.0.0.1 and the fqdn derived from app_url to the request? |
My idea for disregarding TLS errors was strictly for connections made over TLS to To keep Gitea painless, I still do think that making an exception for TLS cetificate validation if the host we're connecting is |
OK. So I've just looked at the code base, all requests using func newInternalRequest(url, method string) *httplib.Request {
req := newRequest(url, method).SetTLSClientConfig(&tls.Config{
InsecureSkipVerify: true,
})
if setting.Protocol == setting.UnixSocket {
req.SetTransport(&http.Transport{
Dial: func(_, _ string) (net.Conn, error) {
return net.Dial("unix", setting.HTTPAddr)
},
})
}
return req
} So just confirm for me that the problem is definitely still on master and v1.7? It seems like we've already decided to skip verification on internal lookup but we're just not doing it properly. It looks like a quick PR that changes that |
I can confirm that the issue still exists in 1.7 and master branch. I dug into the code, and This was a pretty straightforward fix however, and no new functionality was required. |
When running gitea with configuration like:
And pushing to a repository (in my case over SSH), gitea errors with message:
This happens as
localhost
naturally isn't a valid domain name in the certificate provided by the HTTP server component.Why is
localhost
selected for a domain then? In modules/setting/setting.go:824-832 the variableHTTP_ADDR
: (the address to bind the web service to) is used, and if it's set to0.0.0.0
, "localhost" will be used as domain for the internal HTTP API call.This issue can be alleviated by setting variable
LOCAL_ROOT_URL
to include the FQDN that the x509 certificate is issued for.However the documentation regarding this issue isn't too clear:
My suggestion is to clarify the documentation, and to either make the local API URL generation more sophisticated to include this use case, or to use
to omit the certificate verification when accessing a
localhost
URL.The text was updated successfully, but these errors were encountered: