0

I'm encountering the below warning about a change in the fingerprint for a server I regularly connect to:

Certificate information
Issued by:          R3
Issued to:          CN=sms.erjoalgo.com
Hostname:           sms.erjoalgo.com
Public key:         RSA, signature: RSA-SHA256
Protocol:           TLS1.2, key: ECDHE-RSA, cipher: AES-256-GCM, mac: AEAD
Security level:     Medium
Valid:              From 2022-03-17 to 2022-06-15


The fingerprint for the connection to sms.erjoalgo.com:443 has changed
from sha1:b6:cb:d0:98:44:97:5b:08:23:c9:67:3e:93:92:47:54:3a:e7:8d:e6
to sha1:b3:97:fd:8c:6f:5f:13:4e:27:75:87:7d:06:ef:c7:6e:5c:f6:51:c4

The current SHA1 fingerprint of this server should be:

$ openssl-https-server-fingerprint sms.erjoalgo.com:443
SHA1 Fingerprint=EC:07:B9:54:EF:D0:42:55:A2:A1:D0:FD:24:AF:98:72:81:7E:AA:50

$ type openssl-https-server-fingerprint sms.erjoalgo.com:443
openssl-https-server-fingerprint is a function
openssl-https-server-fingerprint () 
{ 
    SERVER=${1} && shift;
    openssl s_client -connect ${SERVER} < /dev/null 2> /dev/null | openssl x509 -fingerprint -noout -in /dev/stdin
}

Looking at the output of (gnutls-peer-status process) in the stack trace, I do see the correct fingerprint in the certificate-id field. But the "public-key-id" doesn't match anything I recognize:

(:version 3
:serial-number "04:e3:50:93:69:d6:4c:a5:cf:cf:6a:b2:db:ca:cc:e8:4d:50"
:issuer "C=US,O=Let's Encrypt,CN=R3"
:valid-from "2022-03-17"
:valid-to "2022-06-15"
:subject "CN=sms.erjoalgo.com"
:public-key-algorithm "RSA"
:certificate-security-level "Medium"
:signature-algorithm "RSA-SHA256"
;; what is this 'public-key-id'? 
:public-key-id 
"sha1:b3:97:fd:8c:6f:5f:13:4e:27:75:87:7d:06:ef:c7:6e:5c:f6:51:c4"
;; certificate-id matches the server's certificate
:certificate-id "sha1:ec:07:b9:54:ef:d0:42:55:a2:a1:d0:fd:24:af:98:72:81:7e:aa:50" 
)

Where does this 'public-key-id' come from?

I tried digging down into gnutls-peer-status but the sources are not available in lisp.

Here's the full stacktrace that prompted the warning:

Debugger entered--entering a function:
* #f(compiled-function () #<bytecode 0x16792d1>)()
  read-multiple-choice("Continue connecting?" ((97 "always" "Accept this certificate this session and for all future sessions.") (115 "session only" "Accept this certificate this session only.") (110 "no" "Refuse to use this certificate, and close the connection.")))
  nsm-query-user("The fingerprint for the connection to %s:%s has changed from %s to %s" ("sms.erjoalgo.com" 443 "sha1:b6:cb:d0:98:44:97:5b:08:23:c9:67:3e:93:92:47:54:3a:e7:8d:e6" "sha1:b3:97:fd:8c:6f:5f:13:4e:27:75:87:7d:06:ef:c7:6e:5c:f6:51:c4") #("Certificate information\nIssued by:          R3\nIssued to:          CN=sms.erjoalgo.com\nHostname:           sms.erjoalgo.com\nPublic key:         RSA, signature: RSA-SHA256\nProtocol:           TLS1.2, key: ECDHE-RSA, cipher: AES-256-GCM, mac: AEAD\nSecurity level:     Medium\nValid:              From 2022-03-17 to 2022-06-15\n\n" 266 272 (face bold)))
  nsm-query("sms.erjoalgo.com" 443 (:warnings (:expired :invalid) :certificate (:version 3 :serial-number "04:e3:50:93:69:d6:4c:a5:cf:cf:6a:b2:db:ca:cc:e8:4d:50" :issuer "C=US,O=Let's Encrypt,CN=R3" :valid-from "2022-03-17" :valid-to "2022-06-15" :subject "CN=sms.erjoalgo.com" :public-key-algorithm "RSA" :certificate-security-level "Medium" :signature-algorithm "RSA-SHA256" :public-key-id "sha1:b3:97:fd:8c:6f:5f:13:4e:27:75:87:7d:06:ef:c7:6e:5c:f6:51:c4" :certificate-id "sha1:ec:07:b9:54:ef:d0:42:55:a2:a1:d0:fd:24:af:98:72:81:7e:aa:50") :key-exchange "ECDHE-RSA" :protocol "TLS1.2" :cipher "AES-256-GCM" :mac "AEAD") fingerprint "The fingerprint for the connection to %s:%s has changed from %s to %s" "sms.erjoalgo.com" 443 "sha1:b6:cb:d0:98:44:97:5b:08:23:c9:67:3e:93:92:47:54:3a:e7:8d:e6" "sha1:b3:97:fd:8c:6f:5f:13:4e:27:75:87:7d:06:ef:c7:6e:5c:f6:51:c4")
  nsm-fingerprint-ok-p("sms.erjoalgo.com" 443 (:warnings (:expired :invalid) :certificate (:version 3 :serial-number "04:e3:50:93:69:d6:4c:a5:cf:cf:6a:b2:db:ca:cc:e8:4d:50" :issuer "C=US,O=Let's Encrypt,CN=R3" :valid-from "2022-03-17" :valid-to "2022-06-15" :subject "CN=sms.erjoalgo.com" :public-key-algorithm "RSA" :certificate-security-level "Medium" :signature-algorithm "RSA-SHA256" :public-key-id "sha1:b3:97:fd:8c:6f:5f:13:4e:27:75:87:7d:06:ef:c7:6e:5c:f6:51:c4" :certificate-id "sha1:ec:07:b9:54:ef:d0:42:55:a2:a1:d0:fd:24:af:98:72:81:7e:aa:50") :key-exchange "ECDHE-RSA" :protocol "TLS1.2" :cipher "AES-256-GCM" :mac "AEAD") (:id "sha1:b5715bfbf6500a05df0117ed8156f8ed6e0512df" :fingerprint "sha1:b6:cb:d0:98:44:97:5b:08:23:c9:67:3e:93:92:47:54:3a:e7:8d:e6" :host "sms.erjoalgo.com:443" :conditions (:expired :invalid)))
  nsm-check-certificate(#<process websocket process> "sms.erjoalgo.com" 443 (:warnings (:expired :invalid) :certificate (:version 3 :serial-number "04:e3:50:93:69:d6:4c:a5:cf:cf:6a:b2:db:ca:cc:e8:4d:50" :issuer "C=US,O=Let's Encrypt,CN=R3" :valid-from "2022-03-17" :valid-to "2022-06-15" :subject "CN=sms.erjoalgo.com" :public-key-algorithm "RSA" :certificate-security-level "Medium" :signature-algorithm "RSA-SHA256" :public-key-id "sha1:b3:97:fd:8c:6f:5f:13:4e:27:75:87:7d:06:ef:c7:6e:5c:f6:51:c4" :certificate-id "sha1:ec:07:b9:54:ef:d0:42:55:a2:a1:d0:fd:24:af:98:72:81:7e:aa:50") :key-exchange "ECDHE-RSA" :protocol "TLS1.2" :cipher "AES-256-GCM" :mac "AEAD") (:id "sha1:b5715bfbf6500a05df0117ed8156f8ed6e0512df" :fingerprint "sha1:b6:cb:d0:98:44:97:5b:08:23:c9:67:3e:93:92:47:54:3a:e7:8d:e6" :host "sms.erjoalgo.com:443" :conditions (:expired :invalid)))
  nsm-check-tls-connection(#<process websocket process> "sms.erjoalgo.com" 443 (:warnings (:expired :invalid) :certificate (:version 3 :serial-number "04:e3:50:93:69:d6:4c:a5:cf:cf:6a:b2:db:ca:cc:e8:4d:50" :issuer "C=US,O=Let's Encrypt,CN=R3" :valid-from "2022-03-17" :valid-to "2022-06-15" :subject "CN=sms.erjoalgo.com" :public-key-algorithm "RSA" :certificate-security-level "Medium" :signature-algorithm "RSA-SHA256" :public-key-id "sha1:b3:97:fd:8c:6f:5f:13:4e:27:75:87:7d:06:ef:c7:6e:5c:f6:51:c4" :certificate-id "sha1:ec:07:b9:54:ef:d0:42:55:a2:a1:d0:fd:24:af:98:72:81:7e:aa:50") :key-exchange "ECDHE-RSA" :protocol "TLS1.2" :cipher "AES-256-GCM" :mac "AEAD") (:id "sha1:b5715bfbf6500a05df0117ed8156f8ed6e0512df" :fingerprint "sha1:b6:cb:d0:98:44:97:5b:08:23:c9:67:3e:93:92:47:54:3a:e7:8d:e6" :host "sms.erjoalgo.com:443" :conditions (:expired :invalid)))
  nsm-verify-connection(#<process websocket process> "sms.erjoalgo.com" 443)
  network-stream-open-tls("websocket process" #<buffer  *stream buffer*-554214> "sms.erjoalgo.com" 443 (:type tls :nowait nil))
  open-network-stream("websocket process" nil "sms.erjoalgo.com" 443 :type tls :nowait nil)

And the nms-verify-connection where the (gnutls-peer-status process) call is made:

(defun nsm-verify-connection (process host port &optional
                      save-fingerprint warn-unencrypted)
  "Verify the security status of PROCESS that's connected to HOST:PORT.
If PROCESS is a gnutls connection, the certificate validity will
be examined.  If it's a non-TLS connection, it may be compared
against previous connections.  If the function determines that
there is something odd about the connection, the user will be
queried about what to do about it.

The process is returned if everything is OK, and otherwise, the
process will be deleted and nil is returned.

If SAVE-FINGERPRINT, always save the fingerprint of the
server (if the connection is a TLS connection).  This is useful
to keep track of the TLS status of STARTTLS servers.

If WARN-UNENCRYPTED, query the user if the connection is
unencrypted."
  (if (eq network-security-level 'low)
      process
    (let* ((status (gnutls-peer-status process))
       (id (nsm-id host port))
       (settings (nsm-host-settings id)))
      (cond
       ((not (process-live-p process))
    nil)
       ((not status)
    ;; This is a non-TLS connection.
    (nsm-check-plain-connection process host port settings
                    warn-unencrypted))
       (t
    (let ((process
           (nsm-check-tls-connection process host port status settings)))
      (when (and process save-fingerprint
             (null (nsm-host-settings id)))
        (nsm-save-host host port status 'fingerprint 'always))
      process))))))

expired certificate?

3
  • Looking at the sources, it appears that public-key-id is generated by https://man7.org/linux/man-pages/man3/gnutls_x509_crt_get_key_id.3.html, and is a non-standard fingerprint that depends on the cert specified as a gnutls_x509_crt_t object.
    – erjoalgo
    Apr 22, 2022 at 2:43
  • Interestingly, gnutls is spitting more warnings about the certificate being expired and invalid, but the same screen shows the certificate will expire in June 2022 (in ~2 months as of this writing), and the browsers appear to have no problem with this certificate. It would be great if more details could be provided on the certificate could not be verified warning.
    – erjoalgo
    Apr 22, 2022 at 2:49
  • You might want to send a bug report with M-x report-emacs-bug.
    – NickD
    Apr 22, 2022 at 11:33

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.