id: gdm-removed-check

info:
  name: Ensure GDM is Removed
  author: Th3l0newolf
  severity: medium
  description: |
    This template checks whether the GNOME Display Manager (GDM) is installed.
  remediation: |
    Remove the GDM package if it is not required:
      sudo apt remove gdm3 -y
  reference:
    - https://www.cisecurity.org/benchmark/ubuntu_linux
  tags: cis,linux,ubuntu,gdm,gdm3,package,audit
  metadata:
    verified: true

self-contained: true

code:
  - engine:
      - bash
    args:
      - "-c"
      - |
        if dpkg-query -s gdm3 &>/dev/null; then
          echo "[gdm-removed-check:Policy-Fail] [gdm3 is installed] [CIS_FAIL] [medium]"
        else
          echo "[gdm-removed-check:Policy-Pass] [gdm3 is not installed] [CIS_PASS] [medium]"
        fi

    matchers:
      - type: word
        name: policy-pass
        words:
          - "Policy-Pass"

      - type: word
        name: policy-fail
        words:
          - "Policy-Fail"
# digest: 490a00463044022004cdc95f83850e9d07aa99423acaff95f3f8d644cf673f3f6282fdb499e25cb70220500dbf49f39b14e13f1134f8c4723055f51e6147c5a0f0ca68c4e8e91987f660:922c64590222798bb761d5b6d8e72950