id: avahi-daemon

info:
  name: Ensure Avahi Daemon Service is Not Installed
  author: Th3l0newolf
  severity: info
  description: |
    The avahi-daemon package provides mDNS/DNS-SD service discovery on local networks.In secure environments, it should only be installed when explicitly required, as it may expose unnecessary services.
  remediation: |
    - Ensure the `avahi-daemon` package is not installed unless explicitly required.
    - To remove the package, run: sudo apt-get remove avahi-daemon -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 avahi-daemon &>/dev/null; then
          echo "[avahi-daemon-check:Policy-Fail] [avahi-daemon is installed] [CIS_FAIL]"
        else
          echo "[avahi-daemon-check:Policy-Pass] [avahi-daemon is not installed] [CIS_PASS]"
        fi

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

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