Skip to content

[Bug]: pem_finger has inconsistent behaviour that causes minions to fail master verification #69970

Closed

Description

@W-Hamra

What happened?

I'm new to salt. I am still testing it, when on the very first minion I tried to add I got this warning:

salt-minion[117528]: [CRITICAL] The specified fingerprint in the master configuration file:
salt-minion[117528]: 3f:75:bf:9a:91:bf:c4:d9:6d:2f:54:c0:4e:32:57:75:bf:d4:db:07:e4:5f:c8:37:73:f9:b1:20:b5:dd:cc:a9
salt-minion[117528]: Does not match the authenticating master's key:
salt-minion[117528]: 46:a4:b8:d9:79:32:71:7b:ed:f6:8c:7f:7e:84:1d:a9:3c:f1:ed:0c:f6:71:3a:57:4f:9d:e9:28:0b:66:89:9a

And this piqued my interest because the master had no problem showing and later accepting the minion. Also, on master, I get:

root@salt:~# salt-key -F       
Local Keys:
salt.pem:  98:b2:f0:c8:18:d3:9d:50:3e:38:6a:af:89:9f:1d:8a:03:92:88:a2:05:1d:6d:aa:60:12:56:b9:52:f4:07:26
salt.pub:  3f:75:bf:9a:91:bf:c4:d9:6d:2f:54:c0:4e:32:57:75:bf:d4:db:07:e4:5f:c8:37:73:f9:b1:20:b5:dd:cc:a9

(Don't worry about keys, I'll change them all once done with this report)

So obviously, the key I gave the minion is the correct one, the one that starts with 3f, but where is the 46 one coming from?

This sent me on a long rabbit hole that I don't want to repeat, but suffice to say, the source of the bug is salt.utils.crypt.pem_finger which gives a different result if presented with a file path or a key string. Easiest way to see this is this simple python bit:

root@salt:~# cp /etc/salt/pki/master/master.pub /tmp/master.pub                                                                                                                                           
                                                                                                                                                                                                          
/opt/saltstack/salt/bin/python3 - <<'PY'                                                                                                                                                                  
import salt.utils.crypt                                                                                                                                                                                   
                                                                                                                                                                                                          
path = "/tmp/master.pub"                                                                                                                                                                                  
                                                                                                                                                                                                          
with open(path, "r", encoding="utf-8") as f:                                                                                                                                                              
    key = f.read()                                                                                                                                                                                        
                                                                                                                                                                                                          
print("path:", salt.utils.crypt.pem_finger(path=path, sum_type="sha256"))                                                                                                                                 
print("key: ", salt.utils.crypt.pem_finger(key=key, sum_type="sha256"))                                                                                                                                   
PY                                                                                                                                                                                                        
path: 46:a4:b8:d9:79:32:71:7b:ed:f6:8c:7f:7e:84:1d:a9:3c:f1:ed:0c:f6:71:3a:57:4f:9d:e9:28:0b:66:89:9a                                                                                                     
key:  3f:75:bf:9a:91:bf:c4:d9:6d:2f:54:c0:4e:32:57:75:bf:d4:db:07:e4:5f:c8:37:73:f9:b1:20:b5:dd:cc:a9 
root@salt:~#

What do you know... The two fingerprints I saw in the minion log. Some part of the code uses key file, another uses a key string, and they get different results.

One look at the function definition and it's very evident why. With a key file, you strip the header and footer and remove all newlines. With a string key, you do none of that. Ironically enough, you also attempt to replace CRLF in the key file, but you strip newlines anyway, but not in the string key :/

In all cases, they should be handled the same way, and at the very least, minions and masters should stick to one method and not mix.

Type of salt install

Official deb

Major version

3008.x

What supported OS are you seeing the problem on? Can select multiple. (If bug appears on an unsupported OS, please open a GitHub Discussion instead)

ubuntu-24.04

salt --versions-report output

root@salt:~# salt --versions-report                                                                                                                                                                       
Salt Version:                                                                                                                                                                                             
          Salt: 3008.2                                                                                                                                                                                    
                                                                                                                                                                                                          
Python Version:
        Python: 3.14.6 (main, Jun 11 2026, 02:19:05) [GCC 11.2.0]
  
Dependency Versions:
          cffi: 2.0.0
      cherrypy: 18.10.0
  cryptography: 48.0.0
      dateutil: 2.9.0.post0
     docker-py: Not Installed
         gitdb: 4.0.12
     gitpython: 3.1.50
        Jinja2: 3.1.6
       libgit2: Not Installed
  looseversion: 1.3.0
      M2Crypto: Not Installed
          Mako: Not Installed
       msgpack: 1.1.2
  msgpack-pure: Not Installed
  mysql-python: Not Installed
     packaging: 24.0
     pycparser: 3.00
      pycrypto: Not Installed
  pycryptodome: 3.23.0
        pygit2: Not Installed
  python-gnupg: 0.5.6
        PyYAML: 6.0.3
         PyZMQ: 27.1.0
        relenv: 0.22.14
         smmap: 5.0.2
       timelib: 0.3.0
       Tornado: 6.5.7
           ZMQ: 4.3.5
  
Salt Package Information:
  Package Type: onedir
  
System Versions:
          dist: ubuntu 24.04.4 noble
        locale: utf-8
       machine: x86_64
       release: 6.8.0
        system: Linux
       version: Ubuntu 24.04.4 noble

Activity

  1. added
    bug
    on Aug 7, 2026
  2. welcome commented on Aug 7, 2026

    @welcome

    Hi there! Welcome to the Salt Community! Thank you for making your first contribution. We have a lengthy process for issues and PRs. Someone from the Core Team will follow up as soon as possible. In the meantime, here's some information that may help as you continue your Salt journey.
    Please be sure to review our Code of Conduct. Also, check out some of our community resources including:

    There are lots of ways to get involved in our community. Every month, there are around a dozen opportunities to meet with other contributors and the Salt Core team and collaborate in real time. The best way to keep track is by subscribing to the Salt Community Events Calendar.
    If you have additional questions, email us at [email protected]. We're glad you've joined our community and look forward to doing awesome things with you!

  3. self-assigned this
    on Aug 11, 2026
  4. added theissue type on Aug 11, 2026
  5. added this to the Sulphur v3006.28 milestone on Aug 11, 2026
  6. added a commit that references this issue on Aug 11, 2026
    44fd0ac
  7. added a commit that references this issue on Aug 13, 2026
    c21f76a
  8. ceisele-r commented on Oct 13, 2026

    @ceisele-r

    Hi @dwoz , we noticed this issue that salt-key -F master (executed on master) reports a different fingerprint for the .pub than the minion expects when the fingerprint is defined as master_finger in the minion config.

    It sees this issue was fixed with c21f76a and released with v3008.3 (according to the releasenotes https://docs.saltproject.io/en/3008/topics/releases/3008.3.html ), however, we are still facing this issue with a 3008.3 master and 3008.3 minion combination.

    So it seems this fix is somehow not included in 3008.3 even though it is stated in the changelog:
    https://github.com/saltstack/salt/blob/v3008.3/salt/utils/crypt.py#L91-L121 still includes

    key = b"".join([x for x in fp_.readlines() if x.strip()][1:-1])`.

    even though in your Commit c21f76a#diff-3e689b0e00c29ca3d8adb1462d86faa761e3d9e4a017c7e2b7b31b6ebde35bf8R103-R112 , the code is replaced by:

    key = fp_.read()

    Could it be that something went wrong when building the tag or was the change reverted afterwards? Actually I don't really understand why it's not included in the release... 🫤

  9. jparnzen commented on Oct 17, 2026

    @jparnzen

    I'm running into this same issue on 3008.3 LTS as @ceisele-r. I'm on AlmaLinux 9, pinned to the 3008 LTS repos, running 3008.3 master and minion. As @ceisele-r reports, neither master nor minion has the new code from Commit #c21f76a in salt/utils/crypt.py.

    Salt master info:

    [root@alma9-master ~]# salt --versions-report
    Salt Version:
              Salt: 3008.3
     
    Python Version:
            Python: 3.14.7 (main, Sep 30 2026, 03:35:11) [GCC 11.2.0]
     
    Dependency Versions:
              cffi: 2.0.0
          cherrypy: 18.10.0
      cryptography: 50.0.1
          dateutil: 2.9.0.post0
         docker-py: Not Installed
             gitdb: 4.0.12
         gitpython: Not Installed
            Jinja2: 3.1.6
           libgit2: Not Installed
      looseversion: 1.3.0
          M2Crypto: Not Installed
              Mako: Not Installed
           msgpack: 1.2.1
      msgpack-pure: Not Installed
      mysql-python: Not Installed
         packaging: 24.0
         pycparser: 3.00
          pycrypto: Not Installed
      pycryptodome: 3.23.0
            pygit2: Not Installed
      python-gnupg: 0.5.6
            PyYAML: 6.0.3
             PyZMQ: 27.1.0
            relenv: 0.22.27
             smmap: 5.0.2
           timelib: 0.3.0
           Tornado: 6.5.10
               ZMQ: 4.3.5
     
    Salt Package Information:
      Package Type: onedir
     
    System Versions:
              dist: almalinux 9.8 Olive Jaguar
            locale: utf-8
           machine: x86_64
           release: 5.14.0-687.54.1.el9_8.x86_64
            system: Linux
           version: AlmaLinux 9.8 Olive Jaguar
    

    Salt minion info:

    [root@alma9-minion ~]# salt-call --versions-report
    Salt Version:
              Salt: 3008.3
     
    Python Version:
            Python: 3.14.7 (main, Sep 30 2026, 03:35:11) [GCC 11.2.0]
     
    Dependency Versions:
              cffi: 2.0.0
          cherrypy: 18.10.0
      cryptography: 50.0.1
          dateutil: 2.9.0.post0
         docker-py: Not Installed
             gitdb: 4.0.12
         gitpython: Not Installed
            Jinja2: 3.1.6
           libgit2: Not Installed
      looseversion: 1.3.0
          M2Crypto: Not Installed
              Mako: Not Installed
           msgpack: 1.2.1
      msgpack-pure: Not Installed
      mysql-python: Not Installed
         packaging: 24.0
         pycparser: 3.00
          pycrypto: Not Installed
      pycryptodome: 3.23.0
            pygit2: Not Installed
      python-gnupg: 0.5.6
            PyYAML: 6.0.3
             PyZMQ: 27.1.0
            relenv: 0.22.27
             smmap: 5.0.2
           timelib: 0.3.0
           Tornado: 6.5.10
               ZMQ: 4.3.5
     
    Salt Package Information:
      Package Type: onedir
     
    System Versions:
              dist: almalinux 9.8 Olive Jaguar
            locale: utf-8
           machine: x86_64
           release: 5.14.0-687.54.1.el9_8.x86_64
            system: Linux
           version: AlmaLinux 9.8 Olive Jaguar
    
  10. added a commit that references this issue on Oct 27, 2026
    a09df37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug

Type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions