Skip to content

Hardcoded, undocumented reference to /var/cache/salt/master/queues #45854

Closed

Description

@viq

Description of Issue/Question

I'm trying to run salt-master as unprivileged user in a dir from pip to test something. Even with cachedir set to a different location, master was still failing to start complaining about lack of access to /var/cache/salt/master/queues. Quick looking through sources found https://github.com/saltstack/salt/blob/develop/salt/queues/sqlite_queue.py whereas there are no mentions of that setting at https://docs.saltstack.com/en/latest/ref/configuration/master.html

Setup

Saltfile:

salt-master:
  config_dir: .
  log_level: debug
  log_file: ./master.log

./master.d/master.conf:

pki_dir: /tmp/pki
cachedir: /tmp/saltcache
sock_dir: /tmp/salt/sock
conf_file: ./master.d/master.conf

Steps to Reproduce Issue

Starting salt-master with above config results in:

$ salt-master
[DEBUG   ] Configuration file path: ./master.d/master.conf
Failed to create directory path "/var/cache/salt/master/queues" - [Errno 13] Permission denied: '/var/cache/salt/master'

Adding sqlite_queue_dir: /tmp/saltcache/queues to master config makes it start

Versions Report

Salt Version:
           Salt: 2017.7.3
 
Dependency Versions:
           cffi: Not Installed
       cherrypy: Not Installed
       dateutil: Not Installed
      docker-py: Not Installed
          gitdb: Not Installed
      gitpython: Not Installed
          ioflo: Not Installed
         Jinja2: 2.10
        libgit2: Not Installed
        libnacl: Not Installed
       M2Crypto: Not Installed
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.5.2
   mysql-python: Not Installed
      pycparser: Not Installed
       pycrypto: 2.6.1
   pycryptodome: Not Installed
         pygit2: Not Installed
         Python: 2.7.14 (default, Jan  5 2018, 10:41:29)
   python-gnupg: Not Installed
         PyYAML: 3.12
          PyZMQ: 16.0.4
           RAET: Not Installed
          smmap: Not Installed
        timelib: Not Installed
        Tornado: 4.5.3
            ZMQ: 4.1.6
 
System Versions:
           dist:   
         locale: UTF-8
        machine: x86_64
        release: 4.14.15-1-hardened
         system: Linux
        version: Not Installed

Activity

  1. viq commented on Feb 3, 2018

    @viq
    ContributorAuthor

    And even with sqlite_queue_dir defined, there's a lot of logs like:

    Traceback (most recent call last):
      File "/home/viq/.local/share/virtualenvs/slacktest-LFEwWtLb/lib/python2.7/site-packages/salt/utils/process.py", line 663, in _run
        return self._original_run()
      File "/home/viq/.local/share/virtualenvs/slacktest-LFEwWtLb/lib/python2.7/site-packages/salt/master.py", line 934, in run
        self.key,
      File "/home/viq/.local/share/virtualenvs/slacktest-LFEwWtLb/lib/python2.7/site-packages/salt/master.py", line 1681, in __init__
        self.local = salt.client.get_local_client(self.opts['conf_file'])
      File "/home/viq/.local/share/virtualenvs/slacktest-LFEwWtLb/lib/python2.7/site-packages/salt/client/__init__.py", line 104, in get_local_client
        auto_reconnect=auto_reconnect)
      File "/home/viq/.local/share/virtualenvs/slacktest-LFEwWtLb/lib/python2.7/site-packages/salt/client/__init__.py", line 160, in __init__
        self.key = self.__read_master_key()
      File "/home/viq/.local/share/virtualenvs/slacktest-LFEwWtLb/lib/python2.7/site-packages/salt/client/__init__.py", line 193, in __read_master_key
        self.skip_perm_errors)
      File "/home/viq/.local/share/virtualenvs/slacktest-LFEwWtLb/lib/python2.7/site-packages/salt/utils/verify.py", line 401, in check_path_traversal
        raise SaltClientError(msg)
    SaltClientError: Could not access /var/cache/salt/master. Path does not exist.
    
  2. gtmanfred commented on Feb 5, 2018

    @gtmanfred
    Contributor

    When you fixed the sqlite_queue_dir, did you remove the cachedir configuration?

    Because the line where that error originates from is looking to verify that the cachedir exists and is owned by the correct user.

            # Make sure all key parent directories are accessible
            salt.utils.verify.check_path_traversal(self.opts['cachedir'],
                                                   key_user,
                                                   self.skip_perm_errors)
    
  3. added
    needs-more-info
    on Feb 5, 2018
  4. added this to the Blocked milestone on Feb 5, 2018
  5. added
    documentation
    and removed
    needs-more-info
    on Feb 5, 2018
  6. modified the milestones: Blocked, Approved on Feb 5, 2018
  7. viq commented on Feb 5, 2018

    @viq
    ContributorAuthor

    No, cachedir is still there.

  8. gtmanfred commented on Feb 5, 2018

    @gtmanfred
    Contributor

    So, the problem here is that the master config file does not exist in your config_dir.

    If you touch $PWD/master This will all work.

    This is the same issue as #45315

    And when I get time to just double check #45330 it will be fixed.

    Daniel

  9. added
    Duplicate
    and removed
    documentation
    on Feb 5, 2018
  10. modified the milestones: Approved, Blocked on Feb 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Duplicate

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions