# Ensure access to /etc/issue.net is configured

Necessity: The `/etc/issue.net` file contains a message or system identification banner that is displayed to users connecting over a network before the login prompt appears. Ensuring its integrity is crucial for legal and security reasons. If unauthorized users can modify this file, they could remove mandatory legal notices, display misleading information to trick users (social engineering), or deface the banner. Proper ownership and permissions prevent such unauthorized modifications, preserving system integrity and ensuring compliance with organizational policies.

Auditing and Remediation: The audit script checks the current ownership and permission settings of the `/etc/issue.net` file, comparing them against a desired secure state. The remediation script corrects any deviations by using `chown` to set the owner and group to `root` and `chmod` to apply the correct octal permissions, thereby securing the file against unauthorized access.

Recommended State Rationale:
- Basic: `['644 root:root']` This is the standard recommended state (CIS Benchmark). Ownership by `root:root` ensures only the superuser can modify the file. Permissions of `644` allow the owner (`root`) to read and write, while the group and all other users can only read it, which is necessary for network services to display the banner.
- Moderate: `['640 root:root']` This state increases security by removing read permissions for 'others'. It adheres more strictly to the principle of least privilege, ensuring only `root` and members of the `root` group can view the banner's content directly from the filesystem. This is a more hardened configuration.
- Strict: `['640 root:root']` This is the same as the moderate recommendation, as it provides the strongest practical security for this file. Further restricting permissions (e.g., to `600`) is generally not necessary and could potentially interfere with legitimate services that need to read the file.

## Recommended State Configuration

| Security Level | Value |
|----------------|-------|
| **Basic** | `['644 root:root']` |
| **Moderate** | `['640 root:root']` |
| **Strict** | `['640 root:root']` |
| **Type** | `ENUM` |

## Audit Script Working

Bash script that checks the permissions and ownership of the `/etc/issue.net` file. The script must use the `stat` command to retrieve the access rights in octal format and the User/Group owner, formatted as 'permissions owner:group' (e.g., '644 root:root'). The script should only output this string value and nothing else.

## Remediation Script Working

Bash script that takes a single command-line argument specifying the desired state for the `/etc/issue.net` file. The argument must be a string in the format 'permissions owner:group' (e.g., '644 root:root'). The script should parse this argument and use the `chmod` and `chown` commands to set the file's permissions and ownership accordingly. The script must return `true` upon successful application of the settings, and `false` otherwise.

