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

groupadd chroot (root parameter) support is broken #43131

Closed
aogier opened this issue Aug 23, 2017 · 3 comments
Closed

groupadd chroot (root parameter) support is broken #43131

aogier opened this issue Aug 23, 2017 · 3 comments
Labels
Bug broken, incorrect, or confusing behavior Execution-Module P4 Priority 4 Platform Relates to OS, containers, platform-based utilities like FS, system based apps severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around
Milestone

Comments

@aogier
Copy link

aogier commented Aug 23, 2017

Description of Issue/Question

If G@kernel:Linux and root is not None, -R got appended to a command that can be:

  • gpasswd
  • usermod (suse 11)

at least on my Debian, the former requires -Q for specifying a chroot. I suspect this is broken elsewhere, currently downloading openbsd/netbsd/suse11 vagrant boxes so I can check this.

I can work on this but I'd prefer to wait for #43105 merge so I don't have to cope with conflicts given interested code lines.

Thank you !

Versions Report

2016.11

@aogier
Copy link
Author

aogier commented Aug 23, 2017

Multiple bugs confirmed. Considering that those chroot flags seems to wrap around a standard chroot(2) syscall, at least on gpasswd(1) (for you reference: it starts here, it ends here) and that we should not expect any particular behaviour when switching to a chroot other than actually switch to it, I'd try removing every "syntactic sugar" composing cmdlines, switching back to plain old:

chroot <root> <cmd> ...

this should give us maximum compatibility in any unix flavor where chroot is implemented.

What do you think ? I can definitely work on that, maybe this time for real extending a bit tests coverage :)

Ciao

@aogier aogier changed the title groupadd.deluser chroot command is broken, probably elsewhere in module groupadd chroot (root parameter) support is broken Aug 23, 2017
@Ch3LL
Copy link
Contributor

Ch3LL commented Aug 24, 2017

I think the only things we need to watch out for is ensuring backwards compatibility.

I also want to bring in anyone from @saltstack/team-core that might have other thoughts surrounding changing it to the chroot executable instead.

@Ch3LL Ch3LL added Bug broken, incorrect, or confusing behavior Execution-Module severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around P4 Priority 4 Platform Relates to OS, containers, platform-based utilities like FS, system based apps labels Aug 24, 2017
@Ch3LL Ch3LL added this to the Approved milestone Aug 24, 2017
@aplanas
Copy link
Contributor

aplanas commented Oct 25, 2018

I think that this part of the code is a mess, as even the default way in this code is to leverage gpasswd, when nowadays usermod -a (append) is used.

But for this specific issue I think that --root can be used instead of -Q or -R, as both share the same long command.

But IMHO this piece of code needs to be rewritten.

aplanas added a commit to aplanas/salt that referenced this issue Jan 30, 2019
In some places of the code gpasswd and usermod are used depending
on the plataform.  One use -Q and other use -R to indicate a
different root parameter.

This patch unify this, using --root parameter.

Partially fix saltstack#43131

(cherry picked from commit 27372ee)
aplanas added a commit to aplanas/salt that referenced this issue Dec 3, 2019
In some places of the code gpasswd and usermod are used depending
on the plataform.  One use -Q and other use -R to indicate a
different root parameter.

This patch unify this, using --root parameter.

Partially fix saltstack#43131

(cherry picked from commit 27372ee)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug broken, incorrect, or confusing behavior Execution-Module P4 Priority 4 Platform Relates to OS, containers, platform-based utilities like FS, system based apps severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around
Projects
None yet
Development

No branches or pull requests

3 participants