saltstack / saltstack/salt

Salt can't manage user's password via user.present in ALT Linux (Simply Linux)

Open
#65,597 6 comments 0 reactions 1 assignee View on GitHub

@Akm0d is already working on this.

Since Mar 26, 2024.

bug Grains needs-triage Platform
Dominant language
Python
Stars
15.7k
Forks
5.6k
Avg merge
2d 44m
Merged PRs (30d)
80

Description

Description

ALT Linux uses tcb mechanism that stores user password in /etc/tcb/<username>/shadow file instead of /etc/shadow.
As far as I understand after looking into salt/modules/linux_shadow.py file, Salt checks if os grain equals to ALT to determine if it should use tcb or classic shadow scheme.
But os grain not always equals to ALT in ALT Linux distros. E.g. in Simply Linux (which also belongs to ALT Linux family and uses tcb) os == "Simply Linux" so Salt tries to use /etc/shadow instead of tcb.
I tried to look into Salt source code to understand how Salt determines os grain but my Python knowledge is poor.

Setup

test-user.sls:

user_test-user:
  user.present:
    - name: test-user
    - password: ...
    - optional_groups:
        - wheel

Steps to Reproduce the behavior

$ salt test-minion state.apply test-user

Output:

ID: user_test-user
Function: user.present
Name: test-user
Result: False
Comment: User test-user created but failed to set password to XXX-REDACTED-XXX
Started: 09:14:37.397189
Duration: 140.739 ms

After state completes, user password appears in /etc/shadow instead of /etc/tcb.

Expected behavior

Salt should use tcb for password management in Simply Linux.

Versions Report

salt-call --versions-report (Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)
Salt Version:
          Salt: 3006.3

Python Version:
        Python: 3.9.16 (main, Mar 21 2023, 10:12:38)

Dependency Versions:
          cffi: 1.14.5
      cherrypy: 18.6.0
      dateutil: Not Installed
     docker-py: Not Installed
         gitdb: Not Installed
     gitpython: Not Installed
        Jinja2: 3.0.1
       libgit2: Not Installed
  looseversion: 1.2.0
      M2Crypto: Not Installed
          Mako: Not Installed
       msgpack: 1.0.2
  msgpack-pure: Not Installed
  mysql-python: Not Installed
     packaging: 23.0
     pycparser: 2.20
      pycrypto: Not Installed
  pycryptodome: 3.9.9
        pygit2: Not Installed
  python-gnupg: Not Installed
        PyYAML: 5.4.1
         PyZMQ: 22.1.0
        relenv: Not Installed
         smmap: Not Installed
       timelib: Not Installed
       Tornado: 4.5.3
           ZMQ: 4.2.5

System Versions:
          dist: altlinux 10.2 Captain Finn
        locale: utf-8
       machine: x86_64
       release: 5.10.199-std-def-alt2
        system: Linux
       version: Simply Linux 10.2 Captain Finn

Additional context

Link to Simply Linux iso:
https://mirror.yandex.ru/altlinux/p10/images/simply/x86_64/slinux-10.2-x86_64.iso

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.