Cost: $$$ (included with Enterprise Agreement) Complexity: High Best for: Large Windows environments
- Comprehensive patch management
- Third-party patching support
- Detailed reporting
- Phased deployments
- Automatic deployment rules
# Create automatic deployment rule for critical updates
$DeploymentRule = @{
Name = "Critical and Security Updates"
CollectionName = "All Workstations"
DeploymentPackageName = "Monthly Updates"
EnabledAfterCreate = $true
RunType = "RunTheRuleAfterAnySoftwareUpdatePointSynchronization"
}
New-CMSoftwareUpdateAutoDeploymentRule @DeploymentRuleCost: $$ (per user/month) Complexity: Medium Best for: Cloud-managed devices
# Configure Windows Update for Business rings
$UpdateRing = @{
DisplayName = "Production Ring"
DeferQualityUpdatesPeriodInDays = 7
DeferFeatureUpdatesPeriodInDays = 30
AutomaticUpdateMode = "AutoInstallAtMaintenanceTime"
}
New-IntuneDeviceConfigurationPolicy @UpdateRingCost: Free (Windows Server role) Complexity: Medium Best for: ML1-ML2 Windows environments
# Install WSUS role
Install-WindowsFeature -Name UpdateServices -IncludeManagementTools
# Configure WSUS
$wsus = Get-WsusServer
$wsusConfig = $wsus.GetConfiguration()
$wsusConfig.TargetingMode = "Client"
$wsusConfig.Save()
# Create automatic approval rule
$rule = $wsus.CreateInstallApprovalRule("AutoApprove-Critical")
$rule.SetCategories("Critical Updates")
$rule.SetComputerTargetGroups("Workstations")
$rule.Enabled = $true
$rule.Save()Cost: Free (Red Hat Ansible = $$) Complexity: Medium Best for: Linux/Unix environments
---
- name: Patch Management Playbook
hosts: all
become: yes
tasks:
- name: Update package cache (Debian/Ubuntu)
apt:
update_cache: yes
when: ansible_os_family == "Debian"
- name: Upgrade all packages (Debian/Ubuntu)
apt:
upgrade: dist
autoremove: yes
autoclean: yes
when: ansible_os_family == "Debian"
- name: Update all packages (RHEL/CentOS)
yum:
name: '*'
state: latest
when: ansible_os_family == "RedHat"
- name: Check if reboot required
stat:
path: /var/run/reboot-required
register: reboot_required
- name: Reboot if required
reboot:
msg: "Reboot initiated by Ansible for kernel updates"
when: reboot_required.stat.existsCost: Free (Enterprise = $$$) Complexity: High Best for: Large-scale automation
class patch_management {
# Schedule updates
schedule { 'maintenance_window':
period => weekly,
range => '2:00 - 4:00',
repeat => 1,
}
# Ensure packages are updated
exec { 'apt-update':
command => '/usr/bin/apt-get update',
schedule => 'maintenance_window',
}
exec { 'apt-upgrade':
command => '/usr/bin/apt-get upgrade -y',
require => Exec['apt-update'],
schedule => 'maintenance_window',
}
}Cost: $ (per instance) Complexity: Medium Best for: AWS environments
import boto3
ssm = boto3.client('ssm')
# Create patch baseline
baseline = ssm.create_patch_baseline(
Name='ML2-Baseline',
OperatingSystem='WINDOWS',
ApprovalRules={
'PatchRules': [{
'PatchFilterGroup': {
'PatchFilters': [
{'Key': 'CLASSIFICATION', 'Values': ['Critical', 'Security']},
{'Key': 'SEVERITY', 'Values': ['Critical', 'Important']}
]
},
'ApproveAfterDays': 0,
'EnableNonSecurity': False
}]
}
)
# Create maintenance window
window = ssm.create_maintenance_window(
Name='PatchingWindow',
Schedule='cron(0 2 ? * SUN *)',
Duration=4,
Cutoff=1
)Cost: $ (per node) Complexity: Low Best for: Azure/Hybrid environments
{
"type": "Microsoft.Automation/automationAccounts/softwareUpdateConfigurations",
"apiVersion": "2019-06-01",
"name": "[concat(parameters('automationAccountName'), '/ML2-Updates')]",
"properties": {
"updateConfiguration": {
"operatingSystem": "Windows",
"windows": {
"includedUpdateClassifications": "Critical, Security",
"rebootSetting": "IfRequired"
},
"duration": "PT2H"
},
"scheduleInfo": {
"frequency": "Week",
"interval": 1,
"timeZone": "UTC",
"advancedSchedule": {
"weekDays": ["Sunday"]
}
}
}
}Cost: $$ (per device) Complexity: Low Best for: Third-party Windows applications
Supported Applications:
- Adobe products
- Chrome, Firefox
- Java, .NET
- 700+ applications
Cost: $$$ (per device) Complexity: Medium Best for: Enterprise environments
Features:
- Cross-platform support
- Virtual patching
- Automated testing
- Rollback capabilities
import requests
from datetime import datetime, timedelta
class VulnerabilityPatcher:
def __init__(self, nessus_url, patch_system):
self.nessus = nessus_url
self.patcher = patch_system
def get_critical_vulns(self):
# Query Nessus for critical vulnerabilities
response = requests.get(f"{self.nessus}/scans/latest")
vulns = response.json()['vulnerabilities']
critical = [v for v in vulns if v['severity'] >= 9.0]
return critical
def create_patch_job(self, vulns):
patches = []
for vuln in vulns:
if vuln['solution']:
patches.append({
'cve': vuln['cve'],
'patch_id': vuln['solution']['patch_id'],
'priority': 'CRITICAL',
'deadline': datetime.now() + timedelta(hours=48)
})
return self.patcher.schedule_patches(patches)graph LR
A[Canary: 1%] --> B[Pilot: 10%]
B --> C[UAT: 25%]
C --> D[Production: 100%]
#!/bin/bash
# Patch validation script
# Apply patches to test environment
ansible-playbook -i test-inventory patch.yml
# Run automated tests
pytest tests/system_tests.py
pytest tests/application_tests.py
# Validate services
for service in httpd mysql nginx; do
systemctl is-active $service || exit 1
done
# Check system stability
uptime | grep -q "load average: [0-9]" || exit 1
# If all tests pass, approve for production
if [ $? -eq 0 ]; then
echo "Patches validated - approving for production"
ansible-playbook -i prod-inventory patch.yml
fi# Generate patch compliance report
$computers = Get-ADComputer -Filter * | Select -ExpandProperty Name
$report = @()
foreach ($computer in $computers) {
$updates = Get-HotFix -ComputerName $computer -ErrorAction SilentlyContinue
$lastPatch = $updates | Sort InstalledOn -Descending | Select -First 1
$report += [PSCustomObject]@{
ComputerName = $computer
LastPatchDate = $lastPatch.InstalledOn
DaysSinceLastPatch = (New-TimeSpan -Start $lastPatch.InstalledOn).Days
TotalPatches = $updates.Count
Compliant = (New-TimeSpan -Start $lastPatch.InstalledOn).Days -le 30
}
}
$report | Export-Csv "PatchCompliance.csv" -NoTypeInformation- Manual approval process
- Monthly maintenance windows
- Basic reporting
- Test on non-critical systems
- Automated approval for critical patches
- Ring deployment model
- Automated testing
- Integration with vulnerability scanning
- Fully automated pipeline
- Continuous deployment
- Virtual patching for gaps
- Real-time compliance monitoring
- Assess - Determine affected systems
- Mitigate - Apply virtual patches/WAF rules
- Test - Validate patch in isolated environment
- Deploy - Emergency change approval
- Verify - Confirm successful remediation