# Ensure nis server services are not in use

Necessity: The Network Information Service (NIS), also known as Yellow Pages (YP), is an outdated and insecure client-server directory service protocol for distributing system configuration data. It transmits sensitive information, including password hashes, across the network with weak or no encryption, making it highly vulnerable to eavesdropping and man-in-the-middle attacks. Running an NIS server exposes the system to significant security risks and increases its attack surface unnecessarily. Modern, secure alternatives like SSSD or LDAP with Kerberos should be used instead. The risk of misconfiguration is the exposure of user credentials and system information over the network.

Auditing and Remediation: The audit script verifies whether the 'ypserv' package, which provides the NIS server functionality, is installed on the system. The remediation script completely removes this package using the system's package manager ('yum'), thereby eliminating the service and its associated vulnerabilities from the host.

Recommended State Rationale: The recommended state for Basic, Moderate, and Strict security levels is uniformly 'Not Installed'. Due to the inherent security flaws of the NIS protocol, there is no configuration that can be considered secure by modern standards. Even a disabled NIS server can pose a risk if it is accidentally enabled. Therefore, the only acceptable security posture is the complete removal of the 'ypserv' package to ensure the system is not exposed to the protocol's vulnerabilities.

## Recommended State Configuration

| Security Level | Value |
|----------------|-------|
| **Basic** | `['Not Installed']` |
| **Moderate** | `['Not Installed']` |
| **Strict** | `['Not Installed']` |
| **Type** | `ENUM` |

## Audit Script Working

bash script that checks if the 'ypserv' package is installed. The script should use 'rpm -q ypserv'. If the package is installed, the script must output the string 'Installed'. If it is not installed, it must output 'Not Installed'. The script must not return any other text or formatting.

## Remediation Script Working

bash script that accepts a single positional argument representing the desired state. If the argument is 'Not Installed', the script must use the 'yum remove -y ypserv' command to uninstall the package. The script must return 'true' if the package is successfully removed or was already not present, and 'false' if the removal process fails.

