2.2.2 Ensure the NGINX service account is locked

Warning! Audit Deprecated

This audit has been deprecated and will be removed in a future update.

View Next Audit Version

Information

The nginx user account should have a valid password, but the account should be locked.

NOTE: If a different account is used to run nginx, that account's name should be substituted for nginx in the audit and remediation procedures.

Rationale:

As a defense-in-depth measure, the nginx user account should be locked to prevent logins and to prevent someone from switching users to nginx using the password. In general, there shouldn't be a need for anyone to have to su as nginx, and when there is a need, sudo should be used instead, which would not require the nginx account password.

Impact:

This ensures the nginx user account may not be used by a human user.

Solution

Use the passwd command to lock the nginx service account:

passwd -l '$(awk '$1~/^s*users*$/ {print $2}' /etc/nginx/nginx.conf | sed -r 's/;.*//g')'

Default Value:

The nginx user is locked by default.

See Also

https://workbench.cisecurity.org/files/4212