id: dns-server

info:
  name: Ensure DNS Server Service is Not Installed
  author: Th3l0newolf
  severity: info
  description: |
    The bind9 package provides a DNS server for name resolution services.Running a DNS server on systems not designated for that purpose may expose them to unnecessary risks.
  remediation: |
    - Ensure the `bind9` package is not installed unless explicitly required.
    - To remove the package, run: sudo apt-get remove bind9 -y
  reference:
    - https://www.cisecurity.org/benchmark/ubuntu_linux
  metadata:
    verified: true
  tags: cis,local,cisecurity,audit,linux,ubuntu

self-contained: true

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

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

      - type: word
        name: policy-fail
        words:
          - "Policy-Fail"
# digest: 4a0a00473045022079762241d32803af268579ee2dbc0f109db253b5709ae57a79216a73d7c16fd10221009978493f411a9e4b7a4a019d640a19e03c4cf7380d39000f10276f9367c3674d:922c64590222798bb761d5b6d8e72950