Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

salt-master should not run as root anymore #5249

Closed
karlp opened this issue May 24, 2013 · 9 comments
Closed

salt-master should not run as root anymore #5249

karlp opened this issue May 24, 2013 · 9 comments
Labels
Feature new functionality including changes to functionality and code refactors, etc.

Comments

@karlp
Copy link

karlp commented May 24, 2013

We're up to 0.15.1, and the PPA at least still ships a config that runs salt-master as root.
The docs at https://salt.readthedocs.org/en/latest/topics/nonroot.html say it's been available since 0.91.

Tagging @kb1jwq because he wanted to be involved

@aboe76
Copy link
Contributor

aboe76 commented May 24, 2013

This is also possible with archlinux package:
I could modify the package to use a create a system user salt
and add a conf file in /etc/salt/master.d/salt-user.conf with the content:

user: salt

only addition to the salt PKGBUILD would be 1 file and one line in PKGBUILD
salt.install (this script will take care of creating and deleting the salt system user.)
and setting the directory permissions.

I have a PKGBUILD ready with these changes.

@aboe76
Copy link
Contributor

aboe76 commented May 24, 2013

Only issue so far running salt under a system user other than root is a message about dmidecode permissions.
and you need to be aware that all files in /srv/salt (salt root) can be read by the system user.

I have investigated the dmidecode message in salt master log, and I think it is not a problem
as long as the salt-minion daemon runs under root privileges.

@thatch45
Copy link
Contributor

The dmidecode error is not a real issue and can probably be changed to an info log message. I agree that running the master as non-root is a good, but since @kb1jwq is involved I will need to deny all requests.....

In seriousness though, I think that the package is where this change should be, since the package should also be responsible for setting up the user and any initial permissions

@thatch45
Copy link
Contributor

I have reached out to the packagers and let them know about this, but I don't think it is a salt specific bug, I think that we should change the dmidecode to be less severe of a warning here though

@QuinnyPig
Copy link
Contributor

Not to mention that dmidecode warnings are rampant on MacOS, given that dmidecode doesn't exist on that platform. Downgrading this would be swell.

@karlp
Copy link
Author

karlp commented May 29, 2013

So, where exactly is this tracked now? Are there xxxx bugs filed in all the packages? Have you got links to those?

@basepi
Copy link
Contributor

basepi commented May 29, 2013

Actually, I'm not sure that there's an open issue for it, I think Tom just notified the packagers directly. If you'd like to keep track of it, please create a new issue, and make it obvious that it's related to Ubuntu packaging, something like "Ubuntu package should not run Salt as root". That way it doesn't get forgotten. Thanks!

@aboe76
Copy link
Contributor

aboe76 commented May 31, 2013

With the Suse packages salt-master is running under it's own system user 'salt'

@aboe76
Copy link
Contributor

aboe76 commented Jun 2, 2013

@thatch45 and @KB1JWQ can you guyes take look into this:

I Found another issue with running salt-master as is own user instead of root.
The external_auth pam module can't verify the user without running as root.

Digged a little deeper and found on the jenkins/hudson mailing list an explanation because of the same issue:
http://jenkins-ci.361315.n4.nabble.com/Using-UNIX-PAM-authentication-from-a-non-root-user-td378559.html

apparently pam authentication can only be done as root or opening up a whole lot of security issues.

But testing further with other authentication methods:
external_auth with the ldap does not have this issue...so it is only related to pam check passwd.
salt-api daemon as root and using salt-ui can check authentication (because of root permissions for salt-api)

So running salt-master as privileged user not as root can be done, but you lose pam external authentication on cli.
This information I think needs to be added to the documentation of external_auth.

F30 added a commit to F30/salt that referenced this issue Feb 19, 2017
"Although 'dmidecode' was found in path, the current user cannot execute
it" is a frequent annoyance when running Salt as non-root
user. [1] [2] [3] [4]
This is more of an ugly hack, but fixing the underlying problem would
probably require major refactoring of the whole function.

[1] saltstack#2494 (comment)
[2] https://groups.google.com/d/topic/salt-users/aM11D1mIV4c/discussion
[3] saltstack#5249 (comment)
[4] saltstack#39184
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature new functionality including changes to functionality and code refactors, etc.
Projects
None yet
Development

No branches or pull requests

5 participants