id: local-login-warning-banner-configured-check

info:
  name: Ensure Local Login Warning Banner is Configured Properly
  author: Th3l0newolf
  severity: low
  description: |
    This template checks whether the local login warning banner is configured
    without exposing system information.
  remediation: |
    Edit `/etc/issue` and remove any operating system, kernel, architecture,
    or version information that could disclose system details. Configure the
    banner according to your organization's security policy.
  reference:
    - https://www.cisecurity.org/benchmark/ubuntu_linux
  tags: cis,linux,ubuntu,issue,banner,audit
  metadata:
    verified: true

self-contained: true

code:
  - engine:
      - bash
    args:
      - "-c"
      - |
        os_id=$(grep '^ID=' /etc/os-release | cut -d= -f2 | sed 's/"//g')

        if grep -E -i "(\\\v|\\\r|\\\m|\\\s|$os_id)" /etc/issue >/dev/null 2>&1; then
          echo "[local-login-warning-banner-configured-check:Policy-Fail] [/etc/issue contains system information] [CIS_FAIL] [low]"
        else
          echo "[local-login-warning-banner-configured-check:Policy-Pass] [/etc/issue is properly configured] [CIS_PASS] [low]"
        fi

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

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