6.3.3 Use pam_deny.so to Deny Services - auth requisite pam_deny.so /etc/pam.d/sshd

Information

Adding pam_deny.so as a requisite to a PAM aware service allows you to quickly disable the service. The requisite tag on the auth line tells PAM that authentication must fail if the name module returns a failure. Since pam_deny.so always returns failure, authentication will always fail for this service. This mechanism can be applied to any other PAM aware service on the system.

Rationale:

While there are other ways to disable a service, adding pam_deny.so allows you to disable the service for new users without affecting current users of the service.

Solution

Edit PAM aware services as shown below. For example the sshd service would be modified by editing the /etc/pam.d/sshd file as shown:

auth requisite pam_deny.so

Note: Perform this action for every service that provides authentication and supports PAM.

Default Value:

OS Default: N/A

See Also

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