Skip to content

vmcheck: chcon sync'ed executables to install_exec_t - #953

Closed
jlebon wants to merge 5 commits into
coreos:masterfrom
jlebon:pr/fix-labeling
Closed

jlebon wants to merge 5 commits into
coreos:masterfrom
jlebon:pr/fix-labeling

Conversation

@jlebon

@jlebon jlebon commented Aug 25, 2017

Copy link
Copy Markdown
Member

Let's make SELinux and atomic-host-tests happy with trees we concoct
ourselves with a measured sprinkle of bash brace expansion.

Comment thread tests/vmcheck/overlay.sh Outdated
if [ -d $INSTTREE/etc ]; then # on CentOS, the dbus service file is in /usr
rsync -rlv $INSTTREE/etc/ vmcheck/usr/etc/
fi
chcon -t install_exec_t vmcheck/usr/{bin/{rpm-,}ostree,libexec/rpm-ostreed}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think what we really need here is ostree commit --selinux-label.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Agreed, that makes sense. I opened ostreedev/ostree#1113.

@cgwalters

Copy link
Copy Markdown
Member

WDYT about reworking this to use ostreedev/ostree#1114 ?

@jlebon

jlebon commented Aug 25, 2017

Copy link
Copy Markdown
Member Author

Yup, sounds good. Done above. ⬆️
Let's just hold this until we get a FAHC and CAHC build rather than building from git.

@jlebon

jlebon commented Aug 28, 2017

Copy link
Copy Markdown
Member Author

bot, retest this please

jlebon added a commit to jlebon/ostree that referenced this pull request Aug 30, 2017
The new --selinux-policy added in [0] exposed a subtle issue in the way
we handle labeling during commit. The CI system in rpm-ostree hit this
when trying to make use of it[1].

Basically, because of the way we use a GVariant to represent xattrs, if
a file to be committed already has an SELinux label, the xattr object
ends up with *two* label entries. This of course throws off fsck later
on, since the checksum will have gone over both entries, even though the
on-disk file will only have a single label (in which the second entry
wins).

I confirmed that the `fsck` added in the installed test fails without
the rest of this patch.

[0] ostreedev#1114
[1] coreos/rpm-ostree#953
@jlebon

jlebon commented Aug 30, 2017

Copy link
Copy Markdown
Member Author

Requires ostreedev/ostree#1121.

rh-atomic-bot pushed a commit to ostreedev/ostree that referenced this pull request Aug 31, 2017
The new --selinux-policy added in [0] exposed a subtle issue in the way
we handle labeling during commit. The CI system in rpm-ostree hit this
when trying to make use of it[1].

Basically, because of the way we use a GVariant to represent xattrs, if
a file to be committed already has an SELinux label, the xattr object
ends up with *two* label entries. This of course throws off fsck later
on, since the checksum will have gone over both entries, even though the
on-disk file will only have a single label (in which the second entry
wins).

I confirmed that the `fsck` added in the installed test fails without
the rest of this patch.

[0] #1114
[1] coreos/rpm-ostree#953

Closes: #1121
Approved by: cgwalters
@cgwalters

Copy link
Copy Markdown
Member

@rh-atomic-bot r+ e839a35

@rh-atomic-bot

Copy link
Copy Markdown

⌛ Testing commit e839a35 with merge 0f88a87...

rh-atomic-bot pushed a commit that referenced this pull request Aug 31, 2017
We shouldn't need this anymore.

Closes: #953
Approved by: cgwalters
rh-atomic-bot pushed a commit that referenced this pull request Aug 31, 2017
Let's make SELinux and atomic-host-tests happy with trees we concoct
ourselves by using the new --selinux-policy. (Specifically, we want our
sync'ed binaries to have install_exec_t).

Closes: #953
Approved by: cgwalters
@rh-atomic-bot

Copy link
Copy Markdown

💔 Test failed - status-atomicjenkins

@cgwalters

cgwalters commented Aug 31, 2017 •

Copy link
Copy Markdown
Member

error: Rejected send message, 2 matched rules; type="method_call", sender=":1.27" (uid=1000 pid=1388 comm="rpm-ostree pkg-add foo " label="unconfined_u:system_r:install_t:s0-s0:c0.c1023") interface="org.projectatomic.rpmostree1.Sysroot" member="RegisterClient" error name="(unset)" requested_reply="0" destination=":1.12" (uid=0 pid=1091 comm="/usr/bin/rpm-ostree start-daemon " label="system_u:system_r:install_t:s0")

Hmm...

@rh-atomic-bot

Copy link
Copy Markdown

☔ The latest upstream changes (presumably 7fbf9f3) made this pull request unmergeable. Please resolve the merge conflicts.

@jlebon

jlebon commented Sep 1, 2017

Copy link
Copy Markdown
Member Author

Heh, that was a tricky one. Rebased and fixup added! ⬆️

I had meant for this to be in the other PR#968. I originally did both
`make` and `make install` there, but now it only does `make install`, so
let's just rename it to make that more obvious.
We shouldn't need this anymore.
Let's make SELinux and atomic-host-tests happy with trees we concoct
ourselves by using the new --selinux-policy. (Specifically, we want our
sync'ed binaries to have install_exec_t).
Comment thread tests/vmcheck/overlay.sh
rsync -rlv $INSTTREE/etc/ vmcheck/usr/etc/
fi

# ✀✀✀ BEGIN hack to get --selinux-policy (https://github.com/ostreedev/ostree/pull/1114) ✀✀✀

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe only do this if we don't detect --selinux-policy in the target, i.e. if ! ostree commit --help | grep -q -e --selinux-policy?

Comment thread tests/vmcheck/overlay.sh Outdated

ostree refs --delete vmcheck || true
ostree commit -b vmcheck -s '' --tree=dir=vmcheck --link-checkout-speedup
ostree commit -b vmcheck --selinux-policy vmcheck -s '' \

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Let's say --selinux-policy=vmcheck to be really clear we're pulling the policy from there?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

(And while we're here drop -s '' since it's not required nowadays?)

@jlebon

jlebon commented Sep 5, 2017

Copy link
Copy Markdown
Member Author

Fixups! ⬆️

@cgwalters

Copy link
Copy Markdown
Member

@rh-atomic-bot r+ 7aea042

@rh-atomic-bot

Copy link
Copy Markdown

⌛ Testing commit 7aea042 with merge b0c75ae...

rh-atomic-bot pushed a commit that referenced this pull request Sep 7, 2017
We shouldn't need this anymore.

Closes: #953
Approved by: cgwalters
rh-atomic-bot pushed a commit that referenced this pull request Sep 7, 2017
Let's make SELinux and atomic-host-tests happy with trees we concoct
ourselves by using the new --selinux-policy. (Specifically, we want our
sync'ed binaries to have install_exec_t).

Closes: #953
Approved by: cgwalters
@rh-atomic-bot

Copy link
Copy Markdown

☀️ Test successful - status-atomicjenkins
Approved by: cgwalters
Pushing b0c75ae to master...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants