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

Use supermin in unprivileged environments #190

Merged
merged 7 commits into from
Nov 6, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion coreos-assembler
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,19 @@ set -euo pipefail
# Currently this just wraps the two binaries we have today
# under a global entrypoint with subcommands.

# docker/podman don't run through PAM, but we want this set
# docker/podman don't run through PAM, but we want this set for the privileged
# (non-virtualized) path
export USER=${USER:-$(id -nu)}

# When trying to connect to libvirt we get "Failed to find user record
# for uid" errors if there is no entry for our UID in /etc/passwd.
# This was taken from 'Support Arbitrary User IDs' section of:
# https://docs.openshift.com/container-platform/3.10/creating_images/guidelines.html
if ! whoami &> /dev/null; then
# We need to make sure we set $HOME in the /etc/passwd file because
# if we don't libvirt will try to use `/` and we will get permission
# issues
export HOME="/var/tmp/${USER_NAME:-default}" && mkdir -p $HOME
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dustymabe I slightly modified your patch here to put it in /var/tmp instead of /tmp since the former is less likely to be on tmpfs.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sounds good

if [ -w /etc/passwd ]; then
echo "${USER_NAME:-default}:x:$(id -u):0:${USER_NAME:-default} user:${HOME}:/sbin/nologin" >> /etc/passwd
fi
Expand Down