id: ftp-client

info:
  name: Ensure FTP Client is Not Installed
  author: Th3l0newolf
  severity: info
  description: |
    FTP clients such as ftp and tnftp use an unencrypted protocol that exposes sensitive data during transmission.These packages should only be installed when explicitly required, as their presence increases security risk.
  remediation: |
    - Ensure FTP client packages are not installed unless explicitly required.
    - To remove them, run: sudo apt-get remove ftp tnftp -y
  reference:
    - https://www.cisecurity.org/benchmark/ubuntu_linux
  metadata:
    verified: true
  tags: cis,cisecurity,audit,linux,ubuntu,ftp

self-contained: true

code:
  - engine:
      - bash

    args:
      - "-c"
      - |
        # Check if ftp or tnftp packages are installed
        if dpkg-query -W -f='${Package} ${Status}\n' ftp tnftp 2>/dev/null | grep -q "install ok installed"; then
          echo "[cis-ftp-client-check:Policy-Fail] [FTP client is installed] [CIS_FAIL]"
        else
          echo "[cis-ftp-client-check:Policy-Pass] [FTP client is not installed] [CIS_PASS]"
        fi

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

      - type: word
        name: policy-fail
        words:
          - "Policy-Fail"