security: Update on CIS benchmarks#31
Open
mayankfz wants to merge 2 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the RPM-mode image hardening steps to better align with CIS benchmarks by tightening SSH configuration, blacklisting additional kernel modules, and improving log file permission hardening during image build.
Changes:
- Tighten permissions on generated
sshd_config.dsnippets and add a new CIS-focused SSH hardening drop-in (access limitation, forwarding disabled, MaxAuthTries). - Extend CIS kernel module blacklisting to include
sctpalongsidecramfs. - Add waagent service hardening (UMask drop-in) and a tmpfiles-based attempt to enforce
/var/log/azurepermissions.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
jiria
reviewed
Jul 21, 2026
jiria
reviewed
Jul 21, 2026
jiria
reviewed
Jul 21, 2026
jiria
reviewed
Jul 21, 2026
jiria
reviewed
Jul 21, 2026
Signed-off-by: Mayank Singh <mayansingh@microsoft.com>
mayankfz
force-pushed
the
mayansingh/cis_hardening_v2
branch
from
July 21, 2026 06:54
9ec157c to
dcc24f9
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
build_library/rpm/build_image_util.sh:1397
- The tmpfiles directive type
zdoes not create the path if it’s missing, so this won’t ensure/var/log/azureexists “at boot” (it only adjusts perms/label if already present). Add adentry to create the directory, then keepzto restore SELinux context/permissions.
sudo tee "${root_fs_dir}/usr/lib/tmpfiles.d/cis-logfiles.conf" > /dev/null <<'TMPFILES_LOG'
z /var/log/azure 0750 root root - -
TMPFILES_LOG
Signed-off-by: Mayank Singh <mayansingh@microsoft.com>
mayankfz
force-pushed
the
mayansingh/cis_hardening_v2
branch
from
July 21, 2026 07:00
dcc24f9 to
732768b
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
build_library/rpm/build_image_util.sh:1394
- The tmpfiles comment says it "ensures" /var/log/azure is 0750 at boot, but the
ztmpfiles directive only applies to an existing path (it won’t create the directory if missing). Also, the referenced waagent drop-in umask is documented as 0137 here, but the waagent systemd drop-in being added setsUMask=0027. Please correct the comments to match the actual behavior/setting.
# tmpfiles.d: ensure /var/log/azure dir is 0750 at boot (CIS 6.1.3.1).
# File perms handled by waagent UMask=0137 drop-in.
Comment on lines
+440
to
+442
| # The assessor requires all four directives to be present in sshd -T output. | ||
| # AllowUsers/AllowGroups * are effectively no-ops (permit everyone) but satisfy | ||
| # the check. DenyUsers/DenyGroups root block root SSH login. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
security: Update on CIS benchmarks
Doc -> https://microsoftapc-my.sharepoint.com/:w:/g/personal/mayansingh_microsoft_com/IQBPQGV0CWHsTLuKSDKsTOGfASfMARMQJnRTFUxFPwuuA6I?e=dclE6g
Change Log
Type of Change
Does this affect the image build?
Associated Issues
https://dev.azure.com/mariner-org/ACL/_workitems/edit/19664
Test Methodology
aks-e2e failures are same with/without my changes seems to be flaky behaviour.
aks-e2e -> https://dev.azure.com/mariner-org/mariner/_build/results?buildId=1161851&view=results
aks-e2e (without changes) -> https://dev.azure.com/mariner-org/mariner/_build/results?buildId=1162283&view=results
acldevel -> https://dev.azure.com/mariner-org/ACL/_build/results?buildId=1161789&view=results
Merge Checklist
All applicable boxes should be checked before merging