magit / forge

Work with Git forges from the comfort of Magit
GNU General Public License v3.0
1.32k stars 117 forks source link

gnutls-negotiate: GnuTLS error: ..., -50 #152

Closed davep closed 5 years ago

davep commented 5 years ago

Apologies in advance if this isn't actually a forge issue, but having stumbled on #149 while trying to research/diagnose a gnutls error while using forge, I thought it worth checking.

In the past couple or so days (apologies, I work on different machines often and update things at different times so it's hard to pin down) I've run into a problem that, any time I attempt to forge-pull in a repository hosted on either our company-internal gitlab server, or even GitHub, I get an error like this:

gnutls-negotiate: GnuTLS error: #<process api.github.com>, -50

If I set gnutls-log-level to 2 I get the following information:

gnutls.c: [1] (Emacs) connecting to host: api.github.com
gnutls.c: [1] (Emacs) allocating credentials
gnutls.c: [2] (Emacs) allocating x509 credentials
gnutls.c: [2] (Emacs) using default verification flags
gnutls.c: [1] (Emacs) setting the trustfile:  /etc/ssl/certs/ca-certificates.crt
gnutls.c: [1] (Emacs) gnutls callbacks
gnutls.c: [1] (Emacs) gnutls_init
gnutls.c: [1] (Emacs) got non-default priority string: NORMAL:-VERS-TLS1.3
gnutls.c: [1] (Emacs) setting the priority string
gnutls.el: (err=[-50] The request is invalid.) boot: (:priority NORMAL:-VERS-TLS1.3 :hostname api.github.com :loglevel 2 :min-prime-bits 256 :trustfiles (/etc/ssl/certs/ca-certificates.crt) :crlfiles nil :keylist nil :verify-flags nil :verify-error nil :callbacks nil)
gnutls-negotiate: GnuTLS error: #<process api.github.com>, -50

Emacs is 26.2. Build options were simply:

,----[ C-h v system-configuration-options RET ]
| system-configuration-options is a variable defined in ‘C source code’.
| Its value is "--prefix=/usr/local/stow/emacs --with-pop"
| 
| Documentation:
| String containing the configuration options Emacs was built with.
`----

Evaluating gnutls-available-p returns:

(ClientHello\ Padding macs ciphers digests gnutls3 gnutls)

Does this seem to be related to how forge works and, if so, can I do anything to help diagnose it further?

tarsius commented 5 years ago

can I do anything to help diagnose it further?

By commenting on https://github.com/magit/ghub/issues/89.

davep commented 5 years ago

Thanks for the pointer. Done.

tarsius commented 5 years ago

Fixed with https://github.com/magit/ghub/pull/90.

LuciusChen commented 2 months ago

The company's self-hosted GitLab is accessed via IP address and port. The configuration in .authinfo and Forge is as follows, but the following error is encountered.

machine 192.168.1.220:9081/api/v4 login lucius^forge password xxxxxxxxxx
(add-to-list 'forge-alist
                 '("192.168.1.220:9081" "192.168.1.220:9081/api/v4"
                   "192.168.1.220:9081" forge-gitlab-repository))
gnutls.el: (err=[-15] An unexpected TLS packet was received.) boot: (:priority NORMAL:%DUMBFW :hostname 192.168.1.220 :loglevel 0 :min-prime-bits nil :trustfiles (/etc/ssl/cert.pem) :crlfiles nil :keylist nil :verify-flags nil :verify-error nil :pass nil :flags nil :callbacks nil)
gnutls-negotiate: GnuTLS error: #<process 192.168.1.220>, -15
LuciusChen commented 2 months ago

solved. https://github.com/magit/forge/wiki/Tips-and-Tricks#accessing-unsecured-forges