# Ensure rsync services are not in use

The rsync service (rsyncd) is a daemon that provides file synchronization services over the network. If misconfigured, it can expose sensitive files to unauthorized access, leading to data leakage or system compromise. Disabling or removing unnecessary services like rsync adheres to the principle of least functionality, reducing the system's attack surface and minimizing potential vulnerabilities. The audit script checks if the rsync package is installed and whether the service is enabled. The remediation script either disables the service or uninstalls the package to enforce the security policy. The 'Basic' state ensures the service is disabled, preventing it from running. The 'Moderate' state allows for either disabling the service or removing the package, providing flexibility. The 'Strict' state mandates that the package be completely uninstalled, which is the most secure configuration as it entirely removes the service and its associated binaries from the system, eliminating any risk of it being started accidentally or maliciously.

## Recommended State Configuration

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

## Audit Script Working

Bash script that checks the status of the 'rsync' service. If the 'rsync' package is not installed, the script must output 'Not Installed'. If the package is installed, it must use 'systemctl is-enabled rsyncd' to determine if the service is enabled. The script must output 'Enabled' if it is, and 'Disabled' if it is not. The output must consist of only one of these three strings.

## Remediation Script Working

Bash script that accepts a single positional argument: 'Not Installed' or 'Disabled'. If the argument is 'Not Installed', the script must use the system's package manager to uninstall the 'rsync' package. If the argument is 'Disabled', it must use 'systemctl disable --now rsyncd' to disable and stop the service. The script must return 'true' on success and 'false' on failure.

