Skip to content

Disable Network File System (nfs)

An XCCDF Rule

Description

The Network File System (NFS) service allows remote hosts to mount and interact with shared filesystems on the local system. If the local system is not designated as a NFS server then this service should be disabled. The nfs-server service can be disabled with the following command:
$ sudo systemctl mask --now nfs-server.service

Rationale

Unnecessary services should be disabled to decrease the attack surface of the system.

ID
xccdf_org.ssgproject.content_rule_service_nfs_disabled
Severity
Unknown
References
Updated

Remediation Templates

A Puppet Snippet

include disable_nfs-server
class disable_nfs-server {
  service {'nfs-server':
    enable => false,
    ensure => 'stopped',
  }
}

OS Build Blueprint

[customizations.services]
masked = ["nfs-server"]

An Ansible Snippet

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

A Shell Script

# Remediation is applicable only in certain platforms
if rpm --quiet -q kernel-default; then
SYSTEMCTL_EXEC='/usr/bin/systemctl'
"$SYSTEMCTL_EXEC" stop 'nfs-server.service'
"$SYSTEMCTL_EXEC" disable 'nfs-server.service'
"$SYSTEMCTL_EXEC" mask 'nfs-server.service'