Security Hardening
Overview
Hardening jobs apply CIS benchmark configurations to your servers using Ansible automation. This process modifies system settings to comply with security standards.
Warning: Hardening modifies system configurations. Always test on non-production servers first.
Hardening Profiles
| Profile | Description | Impact |
|---|---|---|
| CIS Level 1 - Server | Basic security hardening | Minimal service impact |
| CIS Level 2 - Server | Enhanced security hardening | May affect some services |
| CIS Level 1 - Workstation | Basic workstation security | For desktop systems |
| CIS Level 2 - Workstation | Enhanced workstation security | For high-security desktops |
Running a Hardening Job
Single Host
- Go to Hosts page
- Find the target host
- Click Harden button
- Select hardening profile
- Set priority (1-10, higher runs first)
- Click Start Hardening
Bulk Hardening
- Go to Hosts page
- Select multiple hosts using checkboxes
- Click Harden Selected
- Select profile and priority
- Click Start Hardening All
Job Priority
Priority determines execution order when multiple jobs are queued:
| Priority | Description |
|---|---|
| 1-3 | Low priority, runs after higher priority jobs |
| 4-6 | Normal priority |
| 7-9 | High priority, runs before lower priority jobs |
| 10 | Critical, runs immediately |
Job Status
| Status | Description |
|---|---|
| Pending | Job is queued |
| Queued | Job is waiting for worker |
| Running | Ansible playbook executing |
| Completed | Hardening finished successfully |
| Failed | Hardening encountered errors |
Viewing Jobs
Jobs Page
The Jobs page displays all hardening jobs with:
- Host name
- Profile used
- Status
- Duration
- Start time
- Completion time
Job Details
Click View Output to see:
- Job ID
- Host information
- Profile and priority
- Ansible output (full execution log)
- Error messages (if failed)
Understanding Ansible Output
The Ansible output shows:
- PLAY - Playbook execution start
- TASK - Individual configuration change
- ok - Task completed, no change needed
- changed - Task made a configuration change
- failed - Task encountered an error
- PLAY RECAP - Summary of all changes
Example Output
PLAY [Apply CIS hardening] ****************************************************
TASK [Ensure mounting of cramfs is disabled] **********************************
changed: [192.168.1.100]
TASK [Ensure mounting of freevxfs is disabled] ********************************
ok: [192.168.1.100]
PLAY RECAP ********************************************************************
192.168.1.100 : ok=95 changed=42 failed=0AI Failure Diagnosis
When a job fails, use AI diagnosis:
- Find the failed job
- Click Diagnose with AI button
- Review the AI analysis:
- Root cause identification
- Recommended fix steps
- Prevention tips
Viewing Diagnosis History
- Expand the job row
- View the AI diagnosis card
- Click View Full Diagnosis for details
Post-Hardening Steps
Verify Services
After hardening, verify critical services:
systemctl status sshd
systemctl status nginx
systemctl status your-applicationRun Compliance Scan
- Go to Compliance page
- Run a new scan on the hardened host
- Compare scores before and after
Review Changes
Check the Ansible output for:
- Configuration files modified
- Services restarted
- Packages installed/removed
Rollback
The platform does not provide automatic rollback. To reverse changes:
- Restore from backup (if available)
- Manually undo configuration changes
- Redeploy from configuration management
Best Practice: Snapshots
Before hardening:
- Create VM snapshot
- Run hardening
- Verify application works
- If issues, restore snapshot
Best Practices
Test First
- Clone production server
- Run hardening on clone
- Test all applications
- If successful, run on production
Schedule During Maintenance
- Run hardening during maintenance windows
- Have rollback plan ready
- Monitor services after completion
Document Exceptions
Some rules may conflict with application requirements:
- Document why rule is skipped
- Get security team approval
- Track in exception register
Progressive Hardening
- Start with Level 1
- Verify all services work
- Run compliance scan
- Consider Level 2 if needed
Troubleshooting
Job Stuck in Pending
- Check worker service is running
- Verify Redis connection
- Check worker logs
Job Failed
- Review Ansible output
- Check error messages
- Use AI diagnosis
- Common causes:
- SSH connection lost
- Sudo permission denied
- Package installation failed
- Disk full
Services Not Starting After Hardening
- Check systemd logs:
journalctl -u service-name - Review configuration changes
- Verify ports are not blocked
- Check if service was disabled by hardening
SSH Connection Lost After Hardening
If locked out:
- Use console access (if available)
- Boot into recovery mode
- Restore SSH configuration
- Consider excluding SSH rules next time