-
Notifications
You must be signed in to change notification settings - Fork 572
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
Dracut: Update Dracut overlay module to correctly locate 'chcon' #11986
Conversation
+allow ssh_keygen_t var_t:dir { write add_name remove_name }; | ||
+allow ssh_keygen_t var_t:file { getattr setattr create open read write rename }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
var_t
typically isn't used for files, since it is extremely generic, policy-wise. What dir(s)/file(s) are created?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looked into it further, it turns out we're moving the ssh key file location from /etc/ to /var/etc:
/var/etc/ssh/ssh_host_rsa_key.pub
/var/etc/ssh/ssh_host_rsa_key
/var/etc/ssh/ssh_host_ecdsa_key.pub
/var/etc/ssh/ssh_host_ecdsa_key
/var/etc/ssh/ssh_host_ed25519_key.pub
/var/etc/ssh/ssh_host_ed25519_key
This change is necessary for when verity is enabled and the etc location is read-only with a volatile overlay.
I'll drop the policy changes from the PR based on that. Thanks Chris.
4585c1e
to
4573bf6
Compare
adee260
to
f482913
Compare
The logic in LiveOS ISO checks the Dracut version installed on the image to be customized. If it is below a certain version, it will always disable SELinux since it knows SELinux is not supported for that version and the image will not boot. However, if it is at or higher, it leave SELinux as-is. The problem is that this version is not set at 102-8, which has a known bug blocking booting LiveOS ISO images when SELinux is enabled. This change updates the version to a new Dracut package that has the fix necessary for booting LiveOS ISO image with SELinux enabled. See corresponding dracut change here: microsoft/azurelinux#11986 <!-- Description: Please provide a summary of the changes and the motivation behind them. --> --- ### **Checklist** - [ ] Tests added/updated - [ ] Documentation updated (if needed) - [x] Code conforms to style guidelines
The logic in LiveOS ISO checks the Dracut version installed on the image to be customized. If it is below a certain version, it will always disable SELinux since it knows SELinux is not supported for that version and the image will not boot. However, if it is at or higher, it leave SELinux as-is. The problem is that this version is not set at 102-8, which has a known bug blocking booting LiveOS ISO images when SELinux is enabled. This change updates the version to a new Dracut package that has the fix necessary for booting LiveOS ISO image with SELinux enabled. See corresponding dracut change here: microsoft/azurelinux#11986 <!-- Description: Please provide a summary of the changes and the motivation behind them. --> --- ### **Checklist** - [ ] Tests added/updated - [ ] Documentation updated (if needed) - [x] Code conforms to style guidelines
The logic in LiveOS ISO checks the Dracut version installed on the image to be customized. If it is below a certain version, it will always disable SELinux since it knows SELinux is not supported for that version and the image will not boot. However, if it is at or higher, it leave SELinux as-is. The problem is that this version is not set at 102-8, which has a known bug blocking booting LiveOS ISO images when SELinux is enabled. This change updates the version to a new Dracut package that has the fix necessary for booting LiveOS ISO image with SELinux enabled. See corresponding dracut change here: microsoft/azurelinux#11986 <!-- Description: Please provide a summary of the changes and the motivation behind them. --> --- ### **Checklist** - [ ] Tests added/updated - [ ] Documentation updated (if needed) - [x] Code conforms to style guidelines
The logic in LiveOS ISO checks the Dracut version installed on the image to be customized. If it is below a certain version, it will always disable SELinux since it knows SELinux is not supported for that version and the image will not boot. However, if it is at or higher, it leave SELinux as-is. The problem is that this version is not set at 102-8, which has a known bug blocking booting LiveOS ISO images when SELinux is enabled. This change updates the version to a new Dracut package that has the fix necessary for booting LiveOS ISO image with SELinux enabled. See corresponding dracut change here: microsoft/azurelinux#11986 <!-- Description: Please provide a summary of the changes and the motivation behind them. --> --- ### **Checklist** - [ ] Tests added/updated - [ ] Documentation updated (if needed) - [x] Code conforms to style guidelines
The logic in LiveOS ISO checks the Dracut version installed on the image to be customized. If it is below a certain version, it will always disable SELinux since it knows SELinux is not supported for that version and the image will not boot. However, if it is at or higher, it leave SELinux as-is. The problem is that this version is not set at 102-8, which has a known bug blocking booting LiveOS ISO images when SELinux is enabled. This change updates the version to a new Dracut package that has the fix necessary for booting LiveOS ISO image with SELinux enabled. See corresponding dracut change here: microsoft/azurelinux#11986 <!-- Description: Please provide a summary of the changes and the motivation behind them. --> --- ### **Checklist** - [ ] Tests added/updated - [ ] Documentation updated (if needed) - [x] Code conforms to style guidelines
The logic in LiveOS ISO checks the Dracut version installed on the image to be customized. If it is below a certain version, it will always disable SELinux since it knows SELinux is not supported for that version and the image will not boot. However, if it is at or higher, it leave SELinux as-is. The problem is that this version is not set at 102-8, which has a known bug blocking booting LiveOS ISO images when SELinux is enabled. This change updates the version to a new Dracut package that has the fix necessary for booting LiveOS ISO image with SELinux enabled. See corresponding dracut change here: microsoft/azurelinux#11986 <!-- Description: Please provide a summary of the changes and the motivation behind them. --> --- ### **Checklist** - [ ] Tests added/updated - [ ] Documentation updated (if needed) - [x] Code conforms to style guidelines
…ate 'chcon' We now use the full path of 'chcon' to ensure we always find it regardless of the contents of initrd.
f482913
to
d88a7cb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Merge Checklist
All boxes should be checked before merging the PR (just tick any boxes which don't apply to this PR)
*-static
subpackages, etc.) have had theirRelease
tag incremented../cgmanifest.json
,./toolkit/scripts/toolchain/cgmanifest.json
,.github/workflows/cgmanifest.json
)./LICENSES-AND-NOTICES/SPECS/data/licenses.json
,./LICENSES-AND-NOTICES/SPECS/LICENSES-MAP.md
,./LICENSES-AND-NOTICES/SPECS/LICENSE-EXCEPTIONS.PHOTON
)*.signatures.json
filessudo make go-tidy-all
andsudo make go-test-coverage
passSummary
LiveOS ISO utilizes an overlay file system that consists of a read-only full OS rootfs (lower dir) and an in-memory read-write file system (upper dir).
When selinux is enabled, the final root (
/
) must be labeledroot_t
. Given that the final root (/
) is constructed from the lower dir and the upper dir, both should also be marked as such (i.e. withroot_t
). The read-only full OS rootfs is already labeled as such during build time. The in-memory file system is new, however, and still need to be labeled.A fix was merged in December to achieve that by calling selinux
chcon
utility. At the time, the labeling was done correctly, and selinux did not report any violations in our private testing.However, this bug report alerted us that
chcon
is not being found on the path as tested by Brian, and as a result, the labeling is not taking place, and the liveos iso does not boot when selinux is enabled.This fix changes the dracut module responsible for the labeling to explicitly specify the full path of the
chcon
utility. This guarantees that regardless of the contents of the initrd, the command always succeeds.When doing root cause analysis for the regression, the most likely reason it did not not show in the private testing is that the initrd had a copy of
chcon
, and it was on the path. This hid the problem that would arise if the contents of the initrd changed.Change Log
Does this affect the toolchain?
Associated issues
Links to CVEs
Test Methodology
Validation
Automation
Note While we've put in automation to catch this kind of failures in the future, the downloaded images in the test are the public one which do not have the fixed Dracut package. However, once the Dracut package is published, the test will automatically pick it up and verify it boots.