Skip to content

[BUG] 3004.1 broke syndication #61868

Closed
Closed

Description

@ebusto

Description
After upgrading both the syndication master and other masters to 3004.1, I can no longer interact with the masters through the syndication master.

The masters have the following in /var/log/salt/syndic:

2022-03-28 14:04:36,269 [salt.pillar      :245 ][ERROR   ][16055] Pillar payload signature failed to validate.
2022-03-28 14:04:36,270 [salt.minion      :3444][ERROR   ][16055] Error while bringing up syndic for multi-syndic. Is the master at dc6-unix-salt-syndic-dev-01.nvidia.com responding?
2022-03-28 14:04:39,074 [salt.minion      :3490][ERROR   ][16055] Unable to call _fire_master on dc6-unix-salt-syndic-dev-01.nvidia.com, that syndic is not connected
2022-03-28 14:04:39,074 [salt.minion      :3501][CRITICAL][16055] Unable to call _fire_master on any masters!

Versions Report

root@dc6-unix-salt-syndic-dev-01:~# salt-master --versions-report
Salt Version:
          Salt: 3004.1
 
Dependency Versions:
          cffi: 1.15.0
      cherrypy: 18.6.0
      dateutil: 2.6.1
     docker-py: Not Installed
         gitdb: 2.0.3
     gitpython: 2.1.8
        Jinja2: 2.10
       libgit2: 0.26.0
      M2Crypto: 0.31.0
          Mako: Not Installed
       msgpack: 0.5.6
  msgpack-pure: Not Installed
  mysql-python: Not Installed
     pycparser: 2.21
      pycrypto: 2.6.1
  pycryptodome: 3.4.7
        pygit2: 0.26.2
        Python: 3.6.9 (default, Mar 15 2022, 13:55:28)
  python-gnupg: 0.4.1
        PyYAML: 3.12
         PyZMQ: 17.1.2
         smmap: 2.0.3
       timelib: Not Installed
       Tornado: 4.5.3
           ZMQ: 4.2.5
 
System Versions:
          dist: ubuntu 18.04 Bionic Beaver
        locale: UTF-8
       machine: x86_64
       release: 4.15.0-140-generic
        system: Linux
       version: Ubuntu 18.04 Bionic Beaver
root@dc6-unix-salt-dev-01:~# salt-syndic --versions-report
Salt Version:
          Salt: 3004.1
 
Dependency Versions:
          cffi: 1.14.5
      cherrypy: 18.6.1
      dateutil: 2.6.1
     docker-py: Not Installed
         gitdb: 2.0.3
     gitpython: 2.1.8
        Jinja2: 2.10
       libgit2: 1.1.0
      M2Crypto: 0.31.0
          Mako: Not Installed
       msgpack: 0.5.6
  msgpack-pure: Not Installed
  mysql-python: Not Installed
     pycparser: 2.20
      pycrypto: 2.6.1
  pycryptodome: 3.9.8
        pygit2: 1.5.0
        Python: 3.6.9 (default, Mar 15 2022, 13:55:28)
  python-gnupg: 0.4.1
        PyYAML: 3.12
         PyZMQ: 17.1.2
         smmap: 2.0.3
       timelib: Not Installed
       Tornado: 4.5.3
           ZMQ: 4.2.5
 
Salt Extensions:
        SSEAPE: 8.4.2+4
 
System Versions:
          dist: ubuntu 18.04 Bionic Beaver
        locale: UTF-8
       machine: x86_64
       release: 4.15.0-140-generic
        system: Linux
       version: Ubuntu 18.04 Bionic Beaver

Activity

  1. added
    bug
    on Mar 28, 2022
  2. mguegan commented on Mar 29, 2022

    @mguegan

    I have the same issue on 3003.4.
    Additional logs on the syndic:

     During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/usr/lib/python3.6/site-packages/salt/utils/templates.py", line 262, in render_tmpl
        output = render_str(tmplstr, context, tmplpath)
      File "/usr/lib/python3.6/site-packages/salt/utils/templates.py", line 507, in render_jinja_tmpl
        raise SaltRenderError("Jinja variable {}{}".format(exc, out), buf=tmplstr)
    salt.exceptions.SaltRenderError: Jinja variable 'dict object' has no attribute 'kernel'
    2022-03-29 09:49:11,271 [salt.pillar      :900 ][CRITICAL][18851] Rendering SLS 'common.operatingsystems' failed, render error:
    Jinja variable 'dict object' has no attribute 'kernel'
    Traceback (most recent call last):
      File "/usr/lib/python3.6/site-packages/salt/utils/templates.py", line 500, in render_jinja_tmpl
        output = template.render(**decoded_context)
      File "/usr/lib/python3.6/site-packages/jinja2/environment.py", line 1090, in render
        self.environment.handle_exception()
      File "/usr/lib/python3.6/site-packages/jinja2/environment.py", line 832, in handle_exception
        reraise(*rewrite_traceback_stack(source=source))
      File "/usr/lib/python3.6/site-packages/jinja2/_compat.py", line 28, in reraise
        raise value.with_traceback(tb)
      File "<template>", line 1, in top-level template code
    jinja2.exceptions.UndefinedError: 'dict object' has no attribute 'kernel'
    

    It seems pillar rendering is broken

    salt versions:

    Salt Version:
              Salt: 3003.4
    
    Dependency Versions:
              cffi: Not Installed 
          cherrypy: Not Installed 
          dateutil: Not Installed 
         docker-py: Not Installed 
             gitdb: Not Installed 
         gitpython: Not Installed 
            Jinja2: 2.11.1
           libgit2: Not Installed 
          M2Crypto: 0.35.2
              Mako: Not Installed 
           msgpack: 0.6.2
      msgpack-pure: Not Installed 
      mysql-python: Not Installed 
         pycparser: Not Installed 
          pycrypto: Not Installed 
      pycryptodome: Not Installed 
            pygit2: Not Installed 
            Python: 3.6.8 (default, Nov 16 2020, 16:55:22)
      python-gnupg: Not Installed 
            PyYAML: 6.0
             PyZMQ: 17.0.0
             smmap: Not Installed 
           timelib: Not Installed 
           Tornado: 4.5.3
               ZMQ: 4.1.4
    
    System Versions:
              dist: centos 7 Core 
            locale: UTF-8
           machine: x86_64
           release: 3.10.0-1160.53.1.el7.x86_64
            system: Linux
           version: CentOS Linux 7 Core
    
  3. added
    Regression
    severity-high
    and removed on Mar 29, 2022
  4. added this to the Approved milestone on Mar 29, 2022
  5. waynew commented on Mar 29, 2022

    @waynew
    Contributor

    I looked into this for a while yesterday afternoon but didn't come up with anything definitive. Digging into it more now.

  6. waynew commented on Mar 29, 2022

    @waynew
    Contributor

    I'm pretty sure this is due to the minion signing issue. I was seeing this error in my syndic logs:

    FileNotFoundError: [Errno 2] No such file or directory: '/etc/salt/pki/minion/minion_master.pub'
    

    I didn't have a minion_master.pub file in that directory, because the relationship is actually a syndic<-->master. Looks like it should be possible to workaround this by creating a symlink.

    cd /etc/salt/pki/minion
    ln -s syndic_master.pub minion_master.pub
    

    @ebusto @mguegan could you see if that workaround... works?

  7. 7meis commented on Mar 29, 2022

    @7meis

    @waynew, it works. Many thanks! But you must first move the old minion_master.pub to another folder.

  8. waynew commented on Mar 29, 2022

    @waynew
    Contributor

    The minion_master might be necessary if you're running a minion on the same box as the syndic. I'll be working on finding a correct fix for this.

  9. mguegan commented on Mar 29, 2022

    @mguegan

    Indeed, I am running a minion on the same box as the syndic.

    ls -l /etc/salt/pki/minion/
    total 16
    -rw-r--r--. 1 root root  450 Feb 25  2020 minion_master.pub
    -r--------. 1 root root 1678 Feb 25  2020 minion.pem
    -rw-r--r--. 1 root root  450 Feb 25  2020 minion.pub
    -rw-r--r--. 1 root root  451 Jan 29  2021 syndic_master.pub
    
  10. czarni commented on Mar 29, 2022

    @czarni

    We had a strange issue with this. We tried the work around with a symlink but that didn't work. Deleting the symlink and restoring the minion_master.pb fixed our issue.
    We also did two environments at the same time and that caused our MOM to throw logs of a possible "replay attack" on all minions of that environment. We needed to do one at a time. Hope this helps track it down.

  11. 6 remaining items

  12. tsaridas commented on May 2, 2022

    @tsaridas
    Contributor

    I'm not quite sure what is the purpose of the code if config option verify_master_pubkey_sign and always_verify_signature is already enabled. Unfortunately adding the extra lines of code didn't remove the error for me and I had to remove all that part of the code. I'll wait for a proper fix to add it again.

  13. tarcisiomiranda commented on May 11, 2022

    @tarcisiomiranda

    I'm pretty sure this is due to the minion signing issue. I was seeing this error in my syndic logs:

    FileNotFoundError: [Errno 2] No such file or directory: '/etc/salt/pki/minion/minion_master.pub'
    

    I didn't have a minion_master.pub file in that directory, because the relationship is actually a syndic<-->master. Looks like it should be possible to workaround this by creating a symlink.

    cd /etc/salt/pki/minion
    ln -s syndic_master.pub minion_master.pub
    

    @ebusto @mguegan could you see if that workaround... works?

    Work for me, i am using 3004.1

    mv minion_master.pub minion_master.pub_bkp
    ln -s syndic_master.pub minion_master.pub
    

    salt-syndic -l debug

    [DEBUG   ] Connecting the Minion to the Master URI (for the return server): tcp://192.168.29.24:4506
    [DEBUG   ] Trying to connect to: tcp://192.168.29.24:4506
    [INFO    ] Syndic successfully connected to 192.168.29.24
    

    @waynew waynew Thx man

  14. mguegan commented on May 31, 2022

    @mguegan

    @waynew do you know if you plan to release an official fix / package about this issue ?

  15. TheSushiChef commented on Jun 1, 2022

    @TheSushiChef

    Just as a note, this also affects 3003.4 instances. Performing the workaround from #61868 (comment) worked for us. However, unless this issue isn't going away and the recommended approach is to do the hotfix, we don't want to implement a workaround that will then need to be removed when an official patch is released.

  16. nicholasmhughes commented on Jun 6, 2022

    @nicholasmhughes
    Contributor

    Is there a general multi-master issue? We are experiencing that 3004.1 multi-masters setup with https://docs.saltproject.io/en/latest/topics/tutorials/multimaster_pki.html that 3004.1 minions are only able to connect to one master.

    @sastorsl did you ever get this issue resolved? We're seeing it on a multi-master setup as well.

  17. kriss-s commented on Jun 20, 2022

    @kriss-s

    Is there a general multi-master issue? We are experiencing that 3004.1 multi-masters setup with https://docs.saltproject.io/en/latest/topics/tutorials/multimaster_pki.html that 3004.1 minions are only able to connect to one master.

    @sastorsl did you ever get this issue resolved? We're seeing it on a multi-master setup as well.

    @nicholasmhughes We ended up having to use the same key on both masters in each of our pairs, as we use/abuse salt a bit here. The minions have to be able to communicate with both "at the same time". With different keys they could only ever talk to one master at a time, so when the second master (the one the minion did not authenticate and connect to on startup) asked the minion to perform a task it refused to return properly.

    Different keys for the masters in a pair (with key verify/sign) where both masters could send/receive tasks worked up until 3004.1.

  18. lomeroe commented on Jun 22, 2022

    @lomeroe
    Contributor

    this seems to be fixed in 3003.5 and 3004.2

  19. mguegan commented on Jun 24, 2022

    @mguegan

    tested version 3003.5 with success 👍

  20. szjur commented on Sep 28, 2022

    @szjur

    It doesn't work in 3003.5 - still "Pillar payload signature failed to validate." error appears. It can't possibly work with multiple masters having different public/private key pairs if the key is just saved to the same syndic_master.pub file.

    We have a setup with multiple masters and syndics, used master_sign key to sign the keys of masters and syndic masters but never used the exact same keys on all masters (or syndic masters). Apparently versions up to 3000 did not care about checking that key much and indeed that piece of code does not exist in crypted_transfer_decode_dictentry().

    It works fine with 1 master. With 2+ syndic_master.pub is overwritten with the pub key of the last master the syndic connected to and for all others it starts spitting that "Pillar payload signature failed to validate." error. It just can't possibly work, it's common sense.

    UPDATE
    But I guess it must be all down to what https://docs.saltproject.io/en/latest/topics/tutorials/multimaster.html says - There is only one requirement when preparing a redundant master, which is that masters share the same private key.. Funnily enough different master keys were not an issue up till Salt 3000 in the multiple hot master mode (the default master_type: str). It doesn't seem impossible to save the received master pub keys in separate files but I guess there is not that much advantage of having them different anyway, so why bother.

    With identical master.pub/pem on all masters unsurprisingly that works fine (as it did on Salt 3000).

  21. dmurphy18 commented on Nov 9, 2022

    @dmurphy18
    Contributor

    @waynew if this is down as fixed in Salt 3004.2 release notes

    Make sure the correct key is being used when verifying or validating communication, eg. when a Salt syndic is involved use syndic_master.pub and when a Salt minion is involved use minion_master.pub. (#61868)
    

    Should this be closed, unable to find PR associated with it.

  22. dmurphy18 commented on Nov 10, 2022

    @dmurphy18
    Contributor

    Closing this mentioned as fixed in the Salt 3004.2 release notes.
    Must have missed closing it when Salt 3004.2 was released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

RegressionSalt-SyndicVMwarebugseverity-high

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions