Skip to content

Disable Network Console (netconsole)

An XCCDF Rule

Description

The netconsole service is responsible for loading the netconsole kernel module, which logs kernel printk messages over UDP to a syslog server. This allows debugging of problems where disk logging fails and serial consoles are impractical. The netconsole service can be disabled with the following command:

$ sudo systemctl mask --now netconsole.service

Rationale

The netconsole service is not necessary unless there is a need to debug kernel panics, which is not common.

ID
xccdf_org.ssgproject.content_rule_service_netconsole_disabled
Severity
Low
References
Updated



Remediation - Puppet

include disable_netconsole

class disable_netconsole {
  service {'netconsole':
    enable => false,
    ensure => 'stopped',

Remediation - Ansible

- name: Gather the package facts
  package_facts:
    manager: auto
  tags:
  - NIST-800-53-CM-6(a)
  - NIST-800-53-CM-7(a)

Remediation - OS Build Blueprint


[customizations.services]
masked = ["netconsole"]

Remediation - Kubernetes Patch

apiVersion: machineconfiguration.openshift.io/v1
kind: MachineConfig
spec:
  config:
    ignition:
      version: 3.1.0

Remediation - script:kickstart


service disable netconsole

Remediation - Shell Script

# Remediation is applicable only in certain platforms
if rpm --quiet -q kernel; then

SYSTEMCTL_EXEC='/usr/bin/systemctl'
"$SYSTEMCTL_EXEC" stop 'netconsole.service'
"$SYSTEMCTL_EXEC" disable 'netconsole.service'