Skip to content

Commit

Permalink
Add coreos-useradd-core.service to create core user
Browse files Browse the repository at this point in the history
I'd like to change coreos-assembler to have `/var` completely
empty in the disk image, and hence all content is created consistently
via systemd-tmpfiles at boot.

This is an important preparatory step for moving away from Anaconda.

For backwards compatibility (for now) let's auto-create the `core`
user still, but via a systemd unit on boot.  The right thing
I think is to move this logic into Ignition, but this works
for now.
  • Loading branch information
cgwalters authored and dustymabe committed Nov 12, 2018
1 parent b0358b8 commit 5a0d60e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
14 changes: 14 additions & 0 deletions fedora-coreos-base.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,25 @@ postprocess:
WantedBy=multi-user.target
EOF
# See https://github.com/coreos/ignition/issues/600
# which originated from https://github.com/coreos/coreos-metadata/pull/90#discussion_r202438581
cat > /usr/lib/systemd/system/coreos-useradd-core.service <<'EOF'
[Unit]
ConditionFirstBoot=true
Before=sshd.service
[Service]
ExecStart=/usr/bin/sh -c 'if !getent passwd core &>/dev/null; then /usr/sbin/useradd -G wheel,sudo,adm,systemd-journal core; fi'
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target
EOF
cat >/usr/lib/systemd/system-preset/42-coreos.preset << EOF
# Presets here that eventually should live in the generic fedora presets
# This one is from https://github.com/dustymabe/ignition-dracut
enable coreos-firstboot-complete.service
enable coreos-growpart.service
enable coreos-useradd-core.service
EOF
# Let's have a non-boring motd, just like CL (although theirs is more subdued
Expand Down
3 changes: 0 additions & 3 deletions image.ks
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ keyboard us
timezone --utc Etc/UTC
selinux --enforcing
rootpw --lock --iscrypted locked
# create core user for now
# https://github.com/openshift/os/issues/96
user --name=core --groups='wheel,sudo,adm,systemd-journal'

# Explicitly disable firewall since cloud providers generally provide
# higher level firewall constructs (i.e. security groups).
Expand Down

0 comments on commit 5a0d60e

Please sign in to comment.