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

Updating procedure to improve image-builder user mangement #7852

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jaradtke-aws
Copy link
Member

Issue #, if available:
The procedure for managing the image-builder user in the Operating Systems Management | Artifacts page contained unnecessary steps that modified the underlying OS. The goal is to add a user (image-builder) and configure the system to allow that user to run the image-builder process. That requires that the user can access /dev/kvm (which has permissions: crw-rw---- root:kvm) indicating that the user needs to either be the root user, or belong to the kvm group.
This PR was created for Issue #7846
#7846

Description of changes:
Update the user management procedure to be OS-specific.
Added additional configuraiton to add the image-builder user to the appropriate groups at creation time (sudo/wheel,kvm).
replaced "/home/$USER" with "${HOME}" throughout entire document.
removed suggestions to modify OS file permissions to /dev/kvm.

NOTE: there are essentially 2 procedure for creating an image (requires KVM: Bare Metal/Cloud Stack - the other methods do not)

Removed any steps demonstrating how to modify the OS

-   sudo usermod -a -G kvm $USER
-   sudo chmod 666 /dev/kvm
-   sudo chown root:kvm /dev/kvm

Updated the step to create a user to have that step include the kvm and "admin" group at that time (several examples provided here)

-   sudo adduser image-builder
+   sudo useradd -G kvm,sudo image-builder
+   sudo useradd -G kvm,wheel image-builder
+   sudo useradd -G sudo image-builder
+   sudo useradd -G wheel image-builder

If the user was created using the updated useradd command, then the usermod step is unnecessary. Therefore removed that step

-   sudo usermod -aG sudo image-builder

Testing (if applicable):
The following was run on an Ubuntu 22.04

# sudo useradd -G kvm,sudo testuser
$ groups testuser
testuser : testuser kvm
$ grep '^NAME|^VERSION' /etc/*release*
/etc/os-release:NAME="Ubuntu"
/etc/os-release:VERSION_ID="22.04"
/etc/os-release:VERSION="22.04.4 LTS (Jammy Jellyfish)"
/etc/os-release:VERSION_CODENAME=jammy

The following was run on Red Hat Enterprise Linux 8

$ sudo useradd -G kvm,wheel testuser
$ groups testuser
testuser : testuser wheel kvm
$ egrep '^NAME|^VERSION' /etc/*release*
/etc/os-release:NAME="Red Hat Enterprise Linux"
/etc/os-release:VERSION="8.9 (Ootpa)"
/etc/os-release:VERSION_ID="8.9"

Documentation added/planned (if applicable):

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@eks-distro-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign csplinter for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@eks-distro-bot eks-distro-bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Mar 15, 2024
Copy link

codecov bot commented Mar 15, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 73.39%. Comparing base (0e02f8e) to head (00cd95b).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7852   +/-   ##
=======================================
  Coverage   73.39%   73.39%           
=======================================
  Files         576      576           
  Lines       35622    35622           
=======================================
  Hits        26144    26144           
  Misses       7826     7826           
  Partials     1652     1652           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/docs Documentation documentation size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants