Project VCM Agent Context - SS67/project-docs GitHub Wiki
1 collect evidence playbooks/collect_evidence.yml
2 main roles/compliance_evidence/tasks/main.yml
3 main roles/compliance_evaluate/tasks/main.yml
4 defender windows roles/compliance_evidence/tasks/defender_windows.yml
5 defender linux roles/compliance_evidence/tasks/defender_linux.yml
6 rapid7 windows roles/compliance_evidence/tasks/rapid7_windows.yml
7 rapid7 linux roles/compliance_evidence/tasks/rapid7_linux.yml
8 sccm roles/compliance_evidence/tasks/sccm.yml
9 wsus roles/compliance_evidence/tasks/wsus.yml
10 aap roles/compliance_evidence/tasks/aap.yml
11 main roles/compliance_evidence/vars/main.yml
12 main roles/compliance_evidence/defaults/main.yml
- Rapid7 Insight Agent, Linux.
- name: Rapid7 linux probe
ansible.builtin.shell: |
set +e
INSTALLED=false
RUNNING=false
AGE=-1
[ -x {{ ce_linux.rapid7_binary }} ] && INSTALLED=true
systemctl is-active —quiet {{ ce_linux.rapid7_service }} && RUNNING=true
- name: Record rapid7 result
ansible.builtin.set_fact:
ce_result_rapid7:
installed: “{{ (ce_rapid7_lnx.stdout | trim).split(’ ’)0 | bool }}”
service_running: “{{ (ce_rapid7_lnx.stdout | trim).split(’ ’)1 | bool }}”
last_checkin_hours: >-
{{ none if ((ce_rapid7_lnx.stdout | trim).split(’ ‘)2 | float) < 0
else ((ce_rapid7_lnx.stdout | trim).split(’ ‘)2 | float) }}
probe_error: "{{ ce_rapid7_lnx.stdout | default(’’) | trim | length == 0 }}"
- SCCM client. Windows, domain joined only.
- Registration is the real test. A client can be installed, running and
- assigned to a site while never having registered with the MP.
- LastMPServerName plus a recent policy request is the health signal.
- name: SCCM probe
ansible.windows.win_shell: |
$ErrorActionPreference = ‘SilentlyContinue’
$out = [ordered]@{
installed = $false
service_running = $false
registered = $false
site_code = $null
mp_server = $null
client_version = $null
last_checkin_hours = $null
}
- Most recent successful policy request from the policy agent log.
$pl = ‘C:\Windows\CCM\Logs\PolicyAgent.log’
if (Test-Path $pl) {
$out.last_checkin_hours = [math]::Round(
((Get-Date).ToUniversalTime() – (Get-Item $pl).LastWriteTimeUtc).TotalHours, 2)
}
- name: Record sccm result
ansible.builtin.set_fact:
ce_result_sccm: >-
{{ (ce_sccm.stdout | trim | from_json)
if (ce_sccm.stdout | default(‘’) | trim | length > 0)
else { ’installed’: none, ‘service_running’: none,
‘last_checkin_hours’: none, ‘probe_error’: true } }}
- WSUS. Windows, standalone only.
- There is no agent here, so the contract keys map differently.
- installed means the policy points at a WSUS server.
- service_running means the Windows Update service is up.
- last_checkin_hours comes from the last detection time.
- name: WSUS probe
ansible.windows.win_shell: |
$ErrorActionPreference = ‘SilentlyContinue’
$out = [ordered]@{
installed = $false
configured = $false
service_running = $false
server = $null
use_wsus_server = $null
last_checkin_hours = $null
}
- name: Record wsus result
ansible.builtin.set_fact:
ce_result_wsus: >-
{{ (ce_wsus.stdout | trim | from_json)
if (ce_wsus.stdout | default(‘’) | trim | length > 0)
else { ’installed’: none, ‘service_running’: none,
‘last_checkin_hours’: none, ‘probe_error’: true } }}
- AAP onboarding.
- Circular validation guard: inventory presence alone proves nothing,
- the vSphere dynamic source adds every VM whether managed or not.
- Reachability is the part that actually means something, and we have
- already proven it by getting this far in the play.
- name: Record aap result
ansible.builtin.set_fact:
ce_result_aap:
installed: true
in_inventory: true
service_running: true
reachable: true
inventory_source: “{{ vmc_inventory_source | default(‘vsphere_dynamic’) }}”
connection_plugin: “{{ ansible_connection | default(‘unknown’) }}”
last_checkin_hours: 0
inventory_sync_age_hours: “{{ vmc_inventory_sync_age_hours | default(none) }}”
- Service and path constants. Change here, not in task files.
ce_windows:
defender_service: Sense
defender_av_service: WinDefend
defender_status_key: ‘HKLM:\SOFTWARE\Microsoft\Windows Advanced Threat Protection\Status’
rapid7_service: ir_agent
rapid7_path: ‘C:\Program Files\Rapid7\Insight Agent’
sccm_service: CcmExec
wsus_key: ‘HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate’
ce_linux:
defender_binary: /usr/bin/mdatp
defender_service: mdatp
rapid7_binary: /opt/rapid7/ir_agent/ir_agent
rapid7_service: ir_agent
- Compliance thresholds
ce_checkin_threshold_hours: 24
- Control enablement. Flip to false to skip a control entirely.
ce_controls_enabled:
defender: true
rapid7: true
sccm: true
wsus: true
aap: true
- Domain state drives SCCM vs WSUS applicability.
- Set by the calling playbook. Default assumes standalone so we never
- assert SCCM compliance on a host we have not confirmed as joined.
ce_domain_joined: false
- Where the assembled evidence lands on the controller when
- ce_write_artifact is true. Report only mode uses this.
ce_write_artifact: false
ce_artifact_dir: /var/lib/awx/vmc_reports