id: dhcp-server

info:
  name: Ensure DHCP Server Service is Not Installed
  author: Th3l0newolf
  severity: info
  description: |
    The isc-dhcp-server package provides DHCP services for automatic IP address assignment.Running a DHCP server on non-designated systems may introduce security risks and unwanted network behavior.
  remediation: |
    - Ensure the isc-dhcp-server package is not installed unless explicitly required.
    - To remove the package, run: sudo apt-get remove isc-dhcp-server -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 isc-dhcp-server &>/dev/null; then
          echo "[dhcp-server-check:Policy-Fail] [isc-dhcp-server is installed] [CIS_FAIL]"
        else
          echo "[dhcp-server-check:Policy-Pass] [isc-dhcp-server is not installed] [CIS_PASS]"
        fi

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

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