salt icon indicating copy to clipboard operation
salt copied to clipboard

User.present fails to create non-standard home directory on Fedora 23

Open justinta opened this issue 10 years ago • 1 comments

Description of Issue

Creating a user with user.preset state fails due to selinux policy. I'm seeing this on all versions of salt from 2015.5 to develop.

Setup

I used this state:

/srv/salt/test.sls:
salt_test:
  user.present:
    - name: salt_test
    - home: /tmp/salt_user_home

Steps to Reproduce Issue

salt-call --local state.sls test
[INFO    ] Loading fresh modules for state activity
[INFO    ] Fetching file from saltenv 'base', ** done ** 'test.sls'
[INFO    ] Running state [salt_test] at time 19:50:30.045130
[INFO    ] Executing state user.present for salt_test
[INFO    ] Executing command ['useradd', '-m', '-d', '/tmp/salt_user_home', 'salt_test'] in directory '/root'
**[ERROR   ] Command ['useradd', '-m', '-d', '/tmp/salt_user_home', 'salt_test'] failed with return code: 12
[ERROR   ] stderr: useradd: cannot set SELinux context for home directory /tmp/salt_user_home**
[ERROR   ] retcode: 12
[ERROR   ] Failed to create new user salt_test
[INFO    ] Completed state [salt_test] at time 19:50:30.102190
local:
----------
          ID: salt_test
    Function: user.present
      Result: False
     Comment: Failed to create new user salt_test
     Started: 19:50:30.045130
    Duration: 57.06 ms
     Changes:

Summary
------------
Succeeded: 0
Failed:    1
------------
Total states run:     1

specifically these two lines:

[ERROR   ] Command ['useradd', '-m', '-d', '/tmp/salt_user_home', 'salt_test'] failed with return code: 12
[ERROR   ] stderr: useradd: cannot set SELinux context for home directory /tmp/salt_user_home

Versions Report

The host system has 2015.5.9, but this also fails on all versions of salt on Fedora 23

salt-minion --versions-report
           Salt: 2015.5.9
         Python: 2.7.10 (default, Sep  8 2015, 17:20:17)
         Jinja2: 2.8
       M2Crypto: 0.21.1
 msgpack-python: 0.4.6
   msgpack-pure: Not Installed
       pycrypto: 2.6.1
        libnacl: Not Installed
         PyYAML: 3.11
          ioflo: Not Installed
          PyZMQ: 14.7.0
           RAET: Not Installed
            ZMQ: 4.1.2
           Mako: Not Installed
        Tornado: 4.3
        timelib: Not Installed
       dateutil: 2.5.2

justinta avatar Mar 31 '16 20:03 justinta

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue.

stale[bot] avatar Apr 16 '18 23:04 stale[bot]