A session time-out lock is a temporary action taken when a user stops work and moves away from the immediate physical vicinity of the information system but does not log out because of the temporary nature of the absence. Rather than relying on the user to manually lock their operating system session prior to vacating the vicinity, operating systems need to be able to identify when a user's session has idled and take action to initiate the session lock. The screen package allows for a session lock to be implemented and configured.
### Rationale
You can use the lock function of the screen to lock the current terminal and prevent the current session from exiting due to timeout.
### Aduit
Verify the operating system has the screen package installed. Check to see if the screen package is installed with the following command:
```
# dpkg -s screen | grep '^Status: install'
```
### Remediation
Install the screen program (if it is not on the system) with the following command:
```
# apt-get install screen
```
The console can now be locked with the following key combination: ctrl+a x
All uses of the ssh-keysign command must be audited.
### Rationale
Reconstruction of harmful events or forensic analysis is not possible if audit records do not contain enough information. At a minimum, the organization must audit the full-text recording of privileged ssh commands. The organization must maintain audit trails in sufficient detail to reconstruct events to determine the cause and impact of compromise.
### Aduit
Verify the operating system generates audit records when successful/unsuccessful attempts to use the "ssh-keysign" command occur. Check for the following system call being audited by performing the following command to check the file system rules in "/etc/audit/audit.rules":
If the command does not return any output, this is a finding.
### Remediation
Configure the operating system to generate audit records when successful/unsuccessful attempts to use the "ssh-keysign" command occur. Add or update the following rule in "/etc/audit/rules.d/audit.rules":
All uses of the open_by_handle_at command must be audited.
### Rationale
Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter).
### Aduit
Verify the operating system generates audit records when successful/unsuccessful attempts to use the "open_by_handle_at" command occur. Check the file system rules in "/etc/audit/audit.rules" with the following commands:
If there are no audit rules defined for the open_by_handle_at syscall, this is a finding. If the output does not produce a rule containing -F exit=-EPERM, this is a finding. If the output does not produce a rule containing -F exit=-EACCES, this is a finding.
### Remediation
Configure the operating system to generate audit records when successful/unsuccessful attempts to use the "open_by_handle_at" command occur. Add or update the following rule in "/etc/audit/rules.d/audit.rules":
Reconstruction of harmful events or forensic analysis is not possible if audit records do not contain enough information. At a minimum, the organization must audit the full-text recording of privileged password commands. The organization must maintain audit trails in sufficient detail to reconstruct events to determine the cause and impact of compromise.
Verify the operating system generates audit records when successful/unsuccessful attempts to use the "privileged-passwd" commands occur. Check the file system rule in "/etc/audit/audit.rules" with the following command:
Configure the operating system to generate audit records when successful/unsuccessful attempts to use the "privileged-passwd" commands occur. Add or update the following rule in "/etc/audit/rules.d/audit.rules":
## 8.1.22 Recored Events that privileged-priv-change command usage (Scored)
### Profile Applicability
Level 4
### Description
All uses of the privileged-priv-change command must be audited.
### Rationale
Reconstruction of harmful events or forensic analysis is not possible if audit records do not contain enough information. At a minimum, the organization must audit the full-text recording of privileged access commands. The organization must maintain audit trails in sufficient detail to reconstruct events to determine the cause and impact of compromise.
### Aduit
Verify the operating system generates audit records when successful/unsuccessful attempts to use the "privileged-priv-change" commands occur. Check for the following system call being audited by performing the following command to check the file system rules in "/etc/audit/audit.rules":
If the command does not return any output, this is a finding.
### Remediation
Configure the operating system to generate audit records when successful/unsuccessful attempts to use the "privileged-priv-change" commands occur. Add or update the following rule in "/etc/audit/rules.d/audit.rules":
Without cryptographic integrity protections, system command and files can be altered by unauthorized users without detection. Cryptographic mechanisms used for protecting the integrity of information include, for example, signed hash functions using asymmetric cryptography enabling distribution of the public key to verify the hash information while maintaining the confidentiality of the key used to generate the hash.
The "retry" option sets the number of attempt password times. Check for the value of the "retry" option in "/etc/pam.d/common-password" with the following command:
## 9.2.2 Set password creation requirement Parameters Using pam_cracklib: minlen option (scored)
### Profile Applicability
Level 2
### Description
Passwords must be a minimum of 14 characters in length.
### Rationale
The shorter the password, the lower the number of possible combinations that need to be tested before the password is compromised. Password complexity, or strength, is a measure of the effectiveness of a password in resisting attempts at guessing and brute-force Passwords are one factor of several that helps to determine strength and how long it takes to crack a password. Use of more characters in a password helps to exponentially increase the time and/or resources required to compromise the password.
### Aduit
Verify the operating system enforces a minimum 14-character password length. The "minlen" option sets the minimum number of characters in a new password. Check for the value of the "minlen" option in "/etc/pam.d/common-password " with the following command:
If the command does not return a "minlen" value of 14 or greater, this is a finding.
### Remediation
Configure operating system to enforce a minimum 14-character password length. Add the following line to "/etc/pam.d/common-password" (or modify the line to have the required value):
## 9.2.3 Set password creation requirement Parameters Using pam_cracklib: dcredit option (scored)
### Profile Applicability
Level 2
### Description
When passwords are changed or new passwords are assigned, the new password must contain at least one numeric character.
### Rationale
Use of a complex password helps to increase the time and resources required to compromise the password. Password complexity, or strength, is a measure of the effectiveness of a password in resisting attempts at guessing and brute-force attacks. Password complexity is one factor of several that determines how long it takes to crack a password. The more complex the password, the greater the number of possible combinations that need to be tested before the password is compromised.
### Aduit
The value to require a number of numeric characters to be set is expressed as a negative number in "/etc/pam.d/common-password ". Check the value for "dcredit" in "/etc/pam.d/common-password" with the following command:
If the value of "dcredit" is not set to a negative value, this is a finding.
### Remediation
Configure the operating system to enforce password complexity by requiring that at least one numeric character be used by setting the "dcredit" option. Add the following line to /etc/pam.d/common-password (or modify the line to have the required value):
## 9.2.4 Set password creation requirement Parameters Using pam_cracklib: ucredit option (scored)
### Profile Applicability
Level 2
### Description
When passwords are changed or new passwords are established, the new password must contain at least one upper-case character.
### Rationale
Use of a complex password helps to increase the time and resources required to compromise the password. Password complexity, or strength, is a measure of the effectiveness of a password in resisting attempts at guessing and brute-force attacks. Password complexity is one factor of several that determines how long it takes to crack a password. The more complex the password, the greater the number of possible combinations that need to be tested before the password is compromised.
### Aduit
The value to require a number of upper-case characters to be set is expressed as a negative number in "/etc/pam.d/common-password". Check the value for "ucredit" in "/etc/pam.d/common-password" with the following command:
## 9.2.5 Set password creation requirement Parameters Using pam_cracklib: ocredit option (scored)
### Profile Applicability
Level 2
### Description
When passwords are changed or new passwords are assigned, the new password must contain at least one special character.
### Rationale
Use of a complex password helps to increase the time and resources required to compromise the password. Password complexity, or strength, is a measure of the effectiveness of a password in resisting attempts at guessing and brute-force attacks. Password complexity is one factor of several that determines how long it takes to crack a password. The more complex the password, the greater the number of possible combinations that need to be tested before the password is compromised.
### Aduit
Verify the operating system enforces password complexity by requiring that at least one special character be used. Note: The value to require a number of special characters to be set is expressed as a negative number in "/etc/pam.d/common-password". Check the value for "ocredit" in "/etc/pam.d/common-password" with the following command:
## 9.2.6 Set password creation requirement Parameters Using pam_cracklib: lcredit option (scored)
### Profile Applicability
Level 2
### Description
When passwords are changed or new passwords are established, the new password must contain at least one lower-case character.
### Rationale
Use of a complex password helps to increase the time and resources required to compromise the password. Password complexity, or strength, is a measure of the effectiveness of a password in resisting attempts at guessing and brute-force attacks. Password complexity is one factor of several that determines how long it takes to crack a password. The more complex the password, the greater the number of possible combinations that need to be tested before the password is compromised.
### Aduit
The value to require a number of lower-case characters to be set is expressed as a negative number in "/etc/pam.d/common-password ". Check the value for "lcredit" in "/etc/pam.d/common-password " with the following command:
## 9.2.7 Set password creation requirement Parameters Using pam_cracklib: difok option (scored)
### Profile Applicability
Level 2
### Description
When passwords are changed a minimum of eight of the total number of characters must be changed.
### Rationale
Use of a complex password helps to increase the time and resources required to compromise the password. Password complexity, or strength, is a measure of the effectiveness of a password in resisting attempts at guessing and brute-force attacks. Password complexity is one factor of several that determines how long it takes to crack a password. The more complex the password, the greater the number of possible combinations that need to be tested before the password is compromised.
### Aduit
The "difok" option sets the number of characters in a password that must not be present in the old password. Check for the value of the "difok" option in "/etc/pam.d/common-password" with the following command:
## 9.2.8 Set password creation requirement Parameters Using pam_cracklib: minclass option (scored)
### Profile Applicability
Level 2
### Description
When passwords are changed a minimum of four character classes must be changed.
### Rationale
Use of a complex password helps to increase the time and resources required to compromise the password. Password complexity, or strength, is a measure of the effectiveness of a password in resisting attempts at guessing and brute-force attacks. Password complexity is one factor of several that determines how long it takes to crack a password. The more complex the password, the greater the number of possible combinations that need to be tested before the password is compromised.
### Aduit
The "minclass" option sets the minimum number of required classes of characters for the new password (digits, upper-case, lower-case, others). Check for the value of the "minclass" option in "/etc/pam.d/common-password" with the following command:
If the value of "minclass" is set to less than "4", this is a finding.
### Remediation
Configure the operating system to require the change of at least four character classes when passwords are changed by setting the "minclass" option. Add the following line to "/etc/pam.d/common-password" (or modify the line to have the required value):
## 9.2.9 Set password creation requirement Parameters Using pam_cracklib: maxrepeat option (scored)
### Profile Applicability
Level 2
### Description
When passwords are changed the number of repeating consecutive characters must not be more than three characters.
### Rationale
Use of a complex password helps to increase the time and resources required to compromise the password. Password complexity, or strength, is a measure of the effectiveness of a password in resisting attempts at guessing and brute-force attacks. Password complexity is one factor of several that determines how long it takes to crack a password. The more complex the password, the greater the number of possible combinations that need to be tested before the password is compromised.
The "maxrepeat" option sets the maximum number of allowed same consecutive characters in a new password. Check for the value of the "maxrepeat" option in "/etc/pam.d/common-password" with the following command:
If the value of "maxrepeat" is set to more than "3", this is a finding.
### Remediation
Configure the operating system to require the change of the number of repeating consecutive characters when passwords are changed by setting the "maxrepeat" option. Add the following line to "/etc/pam.d/common-password" (or modify the line to have the required value):
## 9.2.10 Set password creation requirement Parameters Using pam_cracklib: maxclassrepeat option (scored)
### Profile Applicability
Level 2
### Description
When passwords are changed the number of repeating characters of the same character class must not be more than four characters.
### Rationale
Use of a complex password helps to increase the time and resources required to compromise the password. Password complexity, or strength, is a measure of the effectiveness of a password in resisting attempts at guessing and brute-force attacks. Password complexity is one factor of several that determines how long it takes to crack a password. The more complex the password, the greater the number of possible combinations that need to be tested before the password is compromised.
The "maxclassrepeat" option sets the maximum number of allowed same consecutive characters in the same class in the new password. Check for the value of the "maxclassrepeat" option in "/etc/pam.d/common-password" with the following command:
If the value of "maxclassrepeat" is set to more than "4", this is a finding.
### Remediation
Configure the operating system to require the change of the number of repeating characters of the same character class when passwords are changed by setting the "maxclassrepeat" option. Add the following line to "/etc/pam.d/common-password" conf (or modify the line to have the required value):
The PAM system service must be configured to store only encrypted representations of passwords.
### Rationale
Passwords need to be protected at all times, and encryption is the standard method for protecting passwords. If passwords are not encrypted, they can be plainly read (i.e., clear text) and easily compromised. Passwords encrypted with a weak algorithm are no more protected than if they are kept in plain text.
### Aduit
Verify the PAM system service is configured to store only encrypted representations of passwords. The strength of encryption that must be used to hash passwords for all accounts is SHA512. Check that the system is configured to create SHA512 hashed passwords with the following command:
## 9.2.14 Check auth config is not blank or null passwords using pam_unix (scored)
### Profile Applicability
Level 2
### Description
The system must not have accounts configured with blank or null passwords.
### Rationale
If an account has an empty password, anyone could log on and run commands with the privileges of that account. Accounts with empty passwords should never be used in operational environments.
### Aduit
To verify that null passwords cannot be used, run the following command:
```
# grep nullok /etc/pam.d/common-auth
# grep nullok_secure /etc/pam.d/common-auth
```
If this produces any output, it may be possible to log on with accounts with empty passwords. If null passwords can be used, this is a finding.
### Remediation
If an account is configured for password authentication but does not have an assigned password, it may be possible to log on to the account without authenticating. Remove any instances of the "nullok" option in "/etc/pam.d/common-auth" to prevent logons with empty passwords.
```
# sed -ie "s/nullok//" /etc/pam.d/common-auth
# sed -ie "s/nullok_secure//" /etc/pam.d/common-auth
The shadow file must be configured to store only encrypted representations of passwords.
### Rationale
Passwords need to be protected at all times, and encryption is the standard method for protecting passwords. If passwords are not encrypted, they can be plainly read (i.e., clear text) and easily compromised. Passwords encrypted with a weak algorithm are no more protected than if they are kept in plain text.
Verify the system's shadow file is configured to store only encrypted representations of passwords. The strength of encryption that must be used to hash passwords for all accounts is SHA512. Check that the system is configured to create SHA512 hashed passwords with the following command:
```
# grep -i encrypt /etc/login.defs
ENCRYPT_METHOD SHA512
```
If the "/etc/login.defs" configuration file does not exist or allows for password hashes other than SHA512 to be used, this is a finding.
### Remediation
Configure the operating system to store only SHA512 encrypted representations of passwords. Add or update the following line in "/etc/login.defs":
## 10.1.5 Set accounts minimum password lifetime (Scored)
### Profile Applicability
Level 3
### Description
Passwords must be restricted to a 24 hours/1 day minimum lifetime.
### Rationale
Enforcing a minimum password lifetime helps to prevent repeated password changes to defeat the password reuse or history enforcement requirement. If users are allowed to immediately and continually change their password, the password could be repeatedly changed in a short period of time to defeat the organization's policy regarding password reuse.
### Aduit
Check whether the minimum time period between password changes for each user account is one day or greater.
```
# awk -F: '$4 < 1 {print $1}' /etc/shadow
```
If any results are returned that are not associated with a system account, this is a finding.
### Remediation
Configure non-compliant accounts to enforce a 24 hours/1 day minimum password lifetime:
```
# chage -m 1 [username]
```
## 10.1.6 Set accounts maximum password lifetime (Scored)
### Profile Applicability
Level 3
### Description
Existing passwords must be restricted to a 60-day maximum lifetime.
### Rationale
Any password, no matter how complex, can eventually be cracked. Therefore, passwords need to be changed periodically. If the operating system does not limit the lifetime of passwords and force users to change their passwords, there is the risk that the operating system passwords could be compromised.
### Aduit
Check whether the maximum time period for existing passwords is restricted to 60 days.
```
# awk -F: '$5 > 60 {print $1}' /etc/shadow
```
If any results are returned that are not associated with a system account, this is a finding.
### Remediation
Configure non-compliant accounts to enforce a 60-day maximum password lifetime restriction.
## 10.1.7 Remove(Replace) NOPASSWD to PASSWD in the sudoers config file (Scored)
### Profile Applicability
Level 3
### Description
Users must provide a password for privilege escalation.
### Rationale
Without re-authentication, users may access resources or perform tasks for which they do not have authorization. When operating systems provide the capability to escalate a functional capability, it is critical the user re-authenticate.
### Aduit
If passwords are not being used for authentication, this is Not Applicable. Verify the operating system requires users to supply a password for privilege escalation. Check the configuration of the "/etc/sudoers" and "/etc/sudoers.d/*" files with the following command:
```
# grep -i nopasswd /etc/sudoers /etc/sudoers.d/*
```
If any uncommented line is found with a "NOPASSWD" tag, this is a finding.
### Remediation
Replace any occurrences of "NOPASSWD" tags to "PASSWD" tags in the file.
## 10.1.8 Remove(Replace) not authenticate(!authenticate) to authenticate in the sudoers config file (Scored)
### Profile Applicability
Level 3
### Description
Users must re-authenticate for privilege escalation.
### Rationale
Without re-authentication, users may access resources or perform tasks for which they do not have authorization. When operating systems provide the capability to escalate a functional capability, it is critical the user reauthenticate.
### Aduit
Verify the operating system requires users to reauthenticate for privilege escalation. Check the configuration of the "/etc/sudoers" and "/etc/sudoers.d/*" files with the following command:
The delay between logon prompts following a failed console logon attempt must be at least four seconds.
### Rationale
Configuring the operating system to implement organization-wide security implementation guides and security checklists verifies compliance with federal standards and establishes a common security baseline across DoD that reflects the most restrictive security posture consistent with operational requirements. Configuration settings are the set of parameters that can be changed in hardware, software, or firmware components of the system that affect the security posture and/or functionality of the system. Security-related parameters are those parameters impacting the security state of the system, including the parameters required to satisfy other security control requirements. Security-related parameters include, for example, registry settings; account, file, and directory permission settings; and settings for functions, ports, protocols, services, and remote connections.
Verify the operating system enforces a delay of at least four seconds between console logon prompts following a failed logon attempt. Check the value of the "delay" parameter in the "/etc/pam.d/login" file with the following command:
Configure the operating system to enforce a delay of at least four seconds between logon prompts following a failed console logon attempt. Modify the "/etc/pam.d/login" file to set the "delay" parameter to "4000000" or greater:
All local interactive user accounts, upon creation, must be assigned a home directory.
### Rationale
If local interactive users are not assigned a valid home directory, there is no place for the storage and control of files they should own.
### Aduit
Verify all local interactive users on the system are assigned a home directory upon creation. Check to see if the system is configured to create home directories for local interactive users with the following command:
```
# grep -i create_home /etc/login.defs
CREATE_HOME yes
```
If the value for "CREATE_HOME" parameter is not set to "yes", the line is missing, or the line is commented out, this is a finding.
### Remediation
Configure the operating system to assign home directories to all new local interactive users by setting the "CREATE_HOME" parameter in "/etc/login.defs" to "yes" as follows.