saltstack / saltstack/salt

3008.x: TCP transport auth broken — 'NoneType' object has no attribute 'check_autoreject'

Open
#69,913 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
15.7k
Forks
5.6k
Avg merge
2d 44m
Merged PRs (30d)
80

Description

Description

On 3008.x with transport: tcp, minion auth fails with:

[ERROR] Task exception was never retrieved
future: <Task finished ... exception=AttributeError("'NoneType' object has no attribute 'check_autoreject'")>
Traceback ...
  File ".../salt/channel/server.py", line 647, in _auth
    return af._auth(load, sign_messages, version)
  File ".../salt/master.py", line 3173, in _auth
    ret = self._auth_impl(...)
  File ".../salt/master.py", line 3279, in _auth_impl
    auto_reject = self.auto_key.check_autoreject(load["id"])
AttributeError: 'NoneType' object has no attribute 'check_autoreject'

No minion can complete auth; every _auth request fails; salt '*' test.ping times out.

Root cause

salt/channel/server.py:638-645 constructs an AuthFuncs instance via __new__ (skipping __init__) and copies attributes from self:

af = salt.master.AuthFuncs.__new__(salt.master.AuthFuncs)
af.opts = self.opts
af.cache = self.cache
af.event = self.event
af.master_key = self.master_key
af.sessions = self.sessions
af.auto_key = getattr(self, "auto_key", None)   # <-- defaults to None
af.cache_cli = getattr(self, "cache_cli", False)
af.ckminions = getattr(self, "ckminions", None)
return af._auth(load, sign_messages, version)

self here is the channel instance. It never assigns self.auto_key anywhere, so getattr(..., None) returns None. Then AuthFuncs._auth_impl calls self.auto_key.check_autoreject(...) and crashes.

AuthFuncs.__init__ (salt/master.py:3086) does self.auto_key = salt.daemons.masterapi.AutoKey(self.opts) — but that's the init path, which the channel bypasses by using __new__ + manual attribute copy.

Same problem for ckminions: the channel copies getattr(self, "ckminions", None), but AuthFuncs.__init__ conditionally sets it based on con_cache opt.

Reproduction
# /etc/salt/master
transport: tcp
auto_accept: True
open_mode: True

Start master + one minion (also on transport: tcp). Minion loops on:

salt.exceptions.SaltClientError: Unable to sign_in to master: Attempt to authenticate with the salt master failed with timeout error

Every auth attempt raises the AttributeError on the master side and is never returned to the client.

Suggested fix

In salt/channel/server.py, the channel needs to either:

  1. Construct AuthFuncs properly via __init__ (letting it initialize auto_key, ckminions, etc. correctly), or
  2. Initialize self.auto_key = salt.daemons.masterapi.AutoKey(self.opts) and the ckminions branch in the channel's own __init__ so getattr(self, ...) finds them.

Only affects transport: tcp (and presumably transport: ws). ZMQ transport is unaffected because it goes through a different auth path.

Version: 3008.2+152.g4a10864f6a (CI RPM from PR #69908).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in salt/channel/server.py at the channel _auth path, then compare its AuthFuncs setup with AuthFuncs.init in salt/master.py. Reproduce with transport: tcp and verify that authentication completes without the NoneType error and that salt '*' test.ping succeeds.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
authentication, networking
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.