Skip to content

Disable ypserv Service

An XCCDF Rule

Description

The ypserv service, which allows the system to act as a client in a NIS or NIS+ domain, should be disabled. The ypserv service can be disabled with the following command:

$ sudo systemctl mask --now ypserv.service

Rationale

Disabling the ypserv service ensures the system is not acting as a client in a NIS or NIS+ domain. This service should be disabled unless in use.

ID
xccdf_org.ssgproject.content_rule_service_ypserv_disabled
Severity
Medium
Updated



Remediation - script:kickstart


service disable ypserv

Remediation - Ansible

- name: Disable ypserv Service - 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]
  check_mode: false

Remediation - Puppet

include disable_ypserv

class disable_ypserv {
  service {'ypserv':
    enable => false,
    ensure => 'stopped',

Remediation - OS Build Blueprint


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

Remediation - Kubernetes Patch

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

Remediation - Shell Script

# Remediation is applicable only in certain platforms
if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then

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