-
Notifications
You must be signed in to change notification settings - Fork 278
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
Sudo-less operation #2408
base: main
Are you sure you want to change the base?
Sudo-less operation #2408
Conversation
This change introduces sudoless operations to containerlab, leveraging the SUID bit set on the binary. The SUID-granted root privileges can optionally be gated behind a membership of the group 'clab_admins', which is set up automatically on version upgrade, adding the current Containerlab user to it.
851325f
to
b109891
Compare
Brilliant! sudoless working great on
I see Let me know if there's anything specific you want tested. |
correct, windows is not supported. Windows users should use WSL |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2408 +/- ##
==========================================
- Coverage 52.51% 52.40% -0.12%
==========================================
Files 168 168
Lines 16940 16999 +59
==========================================
+ Hits 8896 8908 +12
- Misses 7128 7172 +44
- Partials 916 919 +3
|
This PR adds sudo-less operation to Containerlab. See #2307 for more information on this feature.
Sudo-less?
The sudo-less operation is implemented via setting the SUID (or sticky) bit on the Containerlab binary. The changes include handling of SUID-based running of Containerlab, and properly grabbing the correct user for lab directory ACL/ownership management when not run with
sudo
.Security?
Root privileges are not used where they are not needed, as Containerlab immediately drops to regular user privilege on startup, and only escalates to root privilege where needed (this is currently done on a per-command granularity).
For use-cases where sudo-less operation is required (for example, Containerlab hosts and labs shared between colleagues, or in education), it is not necessarily desired for every user to be able to perform privileged operations on containerlabs, after all, being able to spin up arbitrary containers is the same as granting
sudo
rights. However, operations that don't require such privileges, such as saving configs, or creating topology graphs might still be useful for these users.This feature also includes an optional check for group membership of the
clab_admins
group:clab_admins
Unix group before escalating to root privilegesThe
clab_admins
group is created and the user running the command is added to it by default by the upgrade script, the quick install script and the post-install script.Potential breakages
groupadd/usermod
might not work on the post-install script for Alpine withoutshadow
utils installed -- this platform is not officially supported by Containerlab, but nfpm is still configured to emit anapk
file.