Pack Install Doesn't Honor System user, running as root
See original GitHub issueIf you attempt to perform a pack install from a git repo it uses root ssh keys.
From docs:
For SSH (URLs starting with git@) auth you have to create a deploy key, and require the system user running the command (stanley or root, depending on your configuration) to have a private key. Deploy keys are more secure than personal access tokens and can be configured on the per-repo basis.
However since we clone from python action and python action is shelled out as root
and not system user
this action will always use the root keys.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:3
- Comments:10 (6 by maintainers)
Top Results From Across the Web
Issue #720 · jwiegley/use-package · GitHub
:ensure-system-package doesn't honour system-packages-use-sudo. This means that on systems where sudo is needed to install packages, ...
Read more >System users in StackStorm deployment: st2, stanley and root
There seem to be some inconsistency between different packs. We observed that most packs are run as root, while checking $(id) with core....
Read more >Can't run Chef as root - Stack Overflow
Tutorial excerpt: sudo is required because this command installs a package and therefore must be run with root privileges. If you're running as...
Read more >NSO System install with non-root user - Cisco Community
Solved: The documentation states: Use System Install --system-install option for production and system-wide deployment in a central location. You need root ...
Read more >How do I allow non-root access to /ttyUSB0? - Ask Ubuntu
The device is most likely attached to user group dialout . To find out which user group the device is attached to: stat...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Adding a specific identity file to the global ssh_config for our restricted domain works, too.
Add
to
/etc/ssh/ssh_config
(rhel7)
The reason
pack install
runs as root, is because all actions run as root, becauseactionrunner
runs as root.So,
actionrunner
runs as root because of https://github.com/StackStorm/st2-packages/pull/195 and https://github.com/StackStorm/st2-packages/pull/205Of course, then the various install methods (one liner and ansible at least) add
stanley
with passwordless sudo (skippable with some ansible vars). And then, we get all sorts of side effects of running as root instead of another user.Now I’m seeing root owned files all over the place as my actions edit or modify files. A file owned by root has many potential actors (any service running as root). But
stanley
is a stackstorm user, so looking at StackStorm’s history is a good way to see why something may have been edited versus reviewing other logs first to see if it was some other service. It may not be more secure to run as stanley, but it is slightly more auditable.Especially problematic is when an action edits a file that happens to be on our NFS v3 NAS. See, all users have the same access to the NAS as a system mounted drive except root who has special NFS permissions. All other users get mapped to a single NAS user, but root is root. So suddenly, files that are supposed to be world readable/writable are suddenly locked and only root can edit them. It can take a bit to reset those permissions so that they are again accessible correctly over both NFS (and to complicate it even further, through CIFS).
And then, there’s all of the sshconfig that I have to add to the root user. Yes, there’s passwordless sudo on that special system user, but I would rather not attach all of that config to the root user.
So, maybe
actionrunner
can continue running as root, but it should drop into a user (configured in st2.conf) to actually run the actions. That user could default tostanley
. Or there needs to be a documented/supported way to configureactionrunner
to run asstanley
. The PR I found is from 2016, there might be other newer reasons (that I’m unware of) thatactionrunner
needs to run asroot
. I don’t know if there is anything else that will break if I, for example, drop in a systemd unit conf file that overrides the user for the actionrunner service.In sum, I have two conflicting suggestions to fix this:
actionrunner
run users as a non-root user by default (like stanley), but keep running actionrunner as root.