TMAegisBeta
More rules for linux

Linux distributions

TMA-ROCKY9-6.1.2.7

Ensure rsyslog is not configured as a log server

MediumLevel 1Automatedlinux

Description

rsyslog can be configured to receive log messages from remote hosts over the network by loading a remote-input module (imtcp, imudp, imptcp, or imrelp) and starting a listener, which makes the host act as a central log server.

How it is checked

Audit method: Shell command

shell
alt0() { o=$(bash -c '#!/usr/bin/env bash

{
   a_conf=(/etc/rsyslog.conf /etc/rsyslog.d/*.conf)
   while IFS= read -r l_inc; do
      for l_f in $l_inc; do
         [ -d "$l_f" ] && a_conf+=("$l_f"/*.conf) || a_conf+=("$l_f")
      done
   done < <(grep -Psoih -- '"'"'^\h*(?:\$IncludeConfig\h+|include\h*\(\h*file\h*=\h*"?)\K[^")\h]+'"'"' "${a_conf[@]}" 2>/dev/null)
   grep -Psi -- '"'"'^\h*module\(load="?(imtcp|imudp|imptcp|imrelp)"?\)'"'"' "${a_conf[@]}" 2>/dev/null
   grep -Psi -- '"'"'^\h*input\(type="?(imtcp|imudp|imptcp|imrelp)"?'"'"' "${a_conf[@]}" 2>/dev/null
   grep -Psi -- '"'"'^\h*\$ModLoad\h+(imtcp|imudp|imptcp|imrelp)\b'"'"' "${a_conf[@]}" 2>/dev/null
   grep -Psi -- '"'"'^\h*\$(InputTCPServerRun|UDPServerRun|InputPTCPServerRun|InputRELPServerRun) \b'"'"' "${a_conf[@]}" 2>/dev/null
}' 2>&1); [ -z "$o" ] || { echo "step1: $o" | head -c 300; return 1; }; }; if alt0; then echo compliant; fi
Expected output
compliant

How it is fixed

Fix method: Guidance or infrastructure patch

1. Should any active log server configuration be found by the audit, edit the file(s) where those directives appear - /etc/rsyslog.conf, a drop-in under /etc/rsyslog.d/, or any non-standard file identified by the audit's configuration discovery - and remove or comment out the remote-input module load, input, and run directives for all of imtcp, imudp, imptcp, and imrelp. Ensure none of the following entries are present: advanced format module(load="imtcp") module(load="imudp") module(load="imptcp") module(load="imrelp") input(type="imtcp" port="514") input(type="imudp" port="514") input(type="imptcp" port="514") input(type="imrelp" port="2514") deprecated legacy format $ModLoad imtcp $ModLoa…

Properties

Operating systems
rocky-9
Tags
cis-convertedlinux
Reference
CIS Rocky Linux 9 Benchmark v3.0.0 - 6.1.2.7

Check this host

Run this on a machine you are allowed to audit. The scan is read-only.

shell
tmaegis scan --target linux