Skip to content

Commit 5a0d60e

Browse files
cgwaltersdustymabe
authored andcommitted
Add coreos-useradd-core.service to create core user
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.
1 parent b0358b8 commit 5a0d60e

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

fedora-coreos-base.yaml

+14
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,25 @@ postprocess:
100100
WantedBy=multi-user.target
101101
EOF
102102
103+
# See https://github.com/coreos/ignition/issues/600
104+
# which originated from https://github.com/coreos/coreos-metadata/pull/90#discussion_r202438581
105+
cat > /usr/lib/systemd/system/coreos-useradd-core.service <<'EOF'
106+
[Unit]
107+
ConditionFirstBoot=true
108+
Before=sshd.service
109+
[Service]
110+
ExecStart=/usr/bin/sh -c 'if !getent passwd core &>/dev/null; then /usr/sbin/useradd -G wheel,sudo,adm,systemd-journal core; fi'
111+
RemainAfterExit=yes
112+
[Install]
113+
WantedBy=multi-user.target
114+
EOF
115+
103116
cat >/usr/lib/systemd/system-preset/42-coreos.preset << EOF
104117
# Presets here that eventually should live in the generic fedora presets
105118
# This one is from https://github.com/dustymabe/ignition-dracut
106119
enable coreos-firstboot-complete.service
107120
enable coreos-growpart.service
121+
enable coreos-useradd-core.service
108122
EOF
109123
110124
# Let's have a non-boring motd, just like CL (although theirs is more subdued

image.ks

-3
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@ keyboard us
2020
timezone --utc Etc/UTC
2121
selinux --enforcing
2222
rootpw --lock --iscrypted locked
23-
# create core user for now
24-
# https://github.com/openshift/os/issues/96
25-
user --name=core --groups='wheel,sudo,adm,systemd-journal'
2623

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

0 commit comments

Comments
 (0)