Skip to content

Add new CIS hardening controls #552

Open
sumitmishra-spectro wants to merge 4 commits intomainfrom
cis-harden-v3
Open

Add new CIS hardening controls #552
sumitmishra-spectro wants to merge 4 commits intomainfrom
cis-harden-v3

Conversation

@sumitmishra-spectro
Copy link
Contributor

@sumitmishra-spectro sumitmishra-spectro commented Feb 26, 2026

New CIS controls added:

CIS 5.2.2, 5.2.3, 5.2.4: Sudo Hardening
• 5.2.2 (use_pty): Forces sudo to run commands in a pseudo-terminal. This prevents attackers from using sudo to run background processes that persist after the session ends, and enables better logging.
• 5.2.3 (logfile): Logs all sudo commands to /var/log/sudo.log for audit trail and forensic analysis.
• 5.2.4 (password policies): Disables targetpw, rootpw, runaspw - ensures users authenticate with their own password, not the target user's or root's password.

No risk: These are logging and auth improvements. sudo still works normally; commands just run in a PTY and get logged. Most systems already use own-password auth.

CIS 5.4.3.3: Default umask 027
Sets the default file permission mask so new files are created with:
• Owner: read/write/execute
• Group: read/execute only
• Others: no access

No risk: Only affects newly created files. Existing files unchanged. Applications that need world-readable files explicitly set permissions anyway.

Service Hardening: Disable apport and rpcbind
• apport: Ubuntu's crash reporting service - can leak sensitive information in crash dumps
• rpcbind: Required for NFS/NIS - if not using these, it's an unnecessary attack surface (port 111)

No risk: Palette/Kubernetes doesn't use NFS mounts or NIS authentication. Crash reporting to Ubuntu is not needed in production. Neither service is required for cluster operation.

CIS 1.5.x: Coredump Restrictions
Disables core dumps via systemd (Storage=none, ProcessSizeMax=0). Core dumps can contain:
• Passwords in memory
• Encryption keys
• Sensitive application data

No risk: Core dumps are only useful for debugging crashes. In production, you don't want them (security risk + disk space). Kubernetes components have their own logging; core dumps aren't needed for troubleshooting.

All new functions use idempotent patterns (file existence checks, grep guards, or file overwrites) to prevent duplicate entries.

New CIS controls added:
- CIS 5.2.2, 5.2.3, 5.2.4: Sudo hardening (pty, logging, password policies)
- CIS 5.4.3.3: Default umask 027 configuration
- Service hardening: Mask apport and rpcbind services
- CIS 1.5.x: Coredump restrictions via systemd
- CIS 2.1.x: NTP time synchronization

All new functions use idempotent patterns (file overwrites or grep guards).

Preserves all existing main branch hardening including AppArmor,
rsyslog, AIDE, kernel hardening, and SSH Level 2 controls.

Co-Authored-By: Oz <oz-agent@warp.dev>
Sumit Mishra and others added 2 commits March 2, 2026 09:49
NTP configuration should be handled externally, not in image hardening.

Co-Authored-By: Oz <oz-agent@warp.dev>
@sumitmishra-spectro sumitmishra-spectro changed the title Add new CIS hardening controls with idempotent implementations Add new CIS hardening controls Mar 2, 2026
No longer needed - using standard provider-kubeadm image.

Co-Authored-By: Oz <oz-agent@warp.dev>
Copy link

@arunbalasc arunbalasc left a comment

Choose a reason for hiding this comment

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

@sumit Mishra one question on cis changes, if the default-umask is done, then all permission problems will get fixed by default without requiring any specific code to change permissions?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants