Disable Network File Systems (netfs)
An XCCDF Rule
Description
The netfs script manages the boot-time mounting of several types of networked filesystems, of which NFS and Samba are the most common. If these filesystem types are not in use, the script can be disabled, protecting the system somewhat against accidental or malicious changes to/etc/fstab
and against flaws in the netfs script itself.
The netfs
service can be disabled with the following command:
$ sudo systemctl mask --now netfs.service
- ID
- xccdf_org.ssgproject.content_rule_service_netfs_disabled
- Severity
- Unknown
- Updated
Remediation Templates
script:kickstart
service disable netfs
A Kubernetes Patch
apiVersion: machineconfiguration.openshift.io/v1
kind: MachineConfig
spec:
config:
ignition:
version: 3.1.0
An Ansible Snippet
- name: Disable Network File Systems (netfs) - Collect systemd Services Present in
the System
ansible.builtin.command: systemctl -q list-unit-files --type service
register: service_exists
changed_when: false
failed_when: service_exists.rc not in [0, 1]
A Puppet Snippet
include disable_netfs
class disable_netfs {
service {'netfs':
enable => false,
ensure => 'stopped',
}
}
A Shell Script
# Remediation is applicable only in certain platforms
if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then
SYSTEMCTL_EXEC='/usr/bin/systemctl'
"$SYSTEMCTL_EXEC" stop 'netfs.service'
"$SYSTEMCTL_EXEC" disable 'netfs.service'
"$SYSTEMCTL_EXEC" mask 'netfs.service'
OS Build Blueprint
[customizations.services]
masked = ["netfs"]