12.2 Security, Access Denial, PAM & SELinux Troubleshooting

Key Takeaways

  • Check identity, path and ACLs, mount options, attributes, and the applicable mandatory access controls.

  • An immutable flag prevents file changes on supported filesystems. An append-only flag permits append-mode writes and can block edits that truncate or replace the file.

  • Correlate an SELinux AVC with the failed request. Compare the current label and policy mapping before restoring a context or changing a boolean.

  • A faillock reset clears the configured PAM failure tally. Password locks, account expiration and SSH access controls require separate investigation.

  • Validate the certificate, intended hostname and trust configuration. Check package build and repository provenance when verifying a security update.

Last updated: November 2026

12.2 Security, Access Denial, PAM & SELinux Troubleshooting

Start with the exact denied operation, the process identity, the resource, and the system that issued the error. Being unable to authenticate, list a directory, modify a file, listen on a port, or establish TLS requires different evidence. Preserve the original policy while you locate the failing check.

Diagnose DAC, POSIX ACLs & File Attributes

CheckEvidence and interpretation
Identity and pathid, stat, and namei -l PATH help identify the relevant user, ownership and path permissions. Use the identity of the failing process. A service may run as a different user or see a different mount namespace from your shell.
Parent directoryA process normally needs search permission on each path component. Removing a name generally requires write and search rights on its parent. A sticky directory further restricts removal or rename to the file owner, directory owner, or a suitably privileged process.
ACLgetfacl PATH reports extended entries. A named-user or group-class entry can be limited by the ACL mask. ACL checks are part of discretionary access control (DAC).
Mount and attributesInspect the active mount with findmnt -T PATH; a read-only filesystem cannot be made writable by changing a file's mode. On supported filesystems, lsattr PATH reports attributes such as immutable and append-only.
Mandatory access controlInspect SELinux enforcement, labels and audit evidence, or the active AppArmor profile on platforms that use it. A denial at one control does not establish how all kernel checks are ordered.

Worked example: the ACL mask

A report has a named-user ACL entry for jdoe and a mask of r-x:

user::rw-
user:jdoe:rwx                   #effective:r-x
group::r--
group:auditors:r-x
mask::r-x
other::---

The effective permission for jdoe is r-x, so this entry cannot grant write access. The mask also limits the owning group and other named entries. If a write grant is intended, inspect those entries and review any mask adjustment for unintended grants before applying it. Verify access as the affected identity afterward.

Immutable and append-only files

On filesystems that implement these attributes, +i prevents modifying file data, removing or renaming the file, or creating a hard link to it. Ordinary privileged writes can still be refused. Only suitable privilege, such as the capability documented by chattr, permits clearing the flag. The +a flag permits writing in append mode; it can block truncation or an editor that tries to replace the file. Confirm why a flag was set before changing it. For example, on an authorized lab system, chattr -i /srv/lab/settings.conf clears immutability on that regular file. Inspect a managed symlink such as /etc/resolv.conf and its configuration owner before treating it as an editable regular file.

SELinux Troubleshooting Workflows

On a RHEL 9 system using SELinux, check the current mode with getenforce. Enforcing applies the policy. Permissive allows operations SELinux would deny and can log those policy decisions. Other access checks still apply. Use the available audit or journal data; a log path depends on the system's logging setup, and absence of a record alone does not rule out SELinux.

For example, suppose the web service can read neighboring content but returns HTTP 403 for one relocated file. The audit data shows a denied file read from httpd_t to a file labeled user_home_t. Compare current labels with the expected policy:

ausearch -m AVC,USER_AVC -ts recent
ls -Z /var/www/html/index.html
matchpathcon -V /var/www/html/index.html

An AVC record identifies the source and target contexts, object class and requested permission. Correlate the event with the failed request. A move that keeps an inode on the same filesystem also keeps its label. The destination already has the correct policy mapping and user_home_t is not a customizable type in this example. Run restorecon -v /var/www/html/index.html to restore the expected type. For an already labeled file, ordinary restorecon changes only the type portion. Customizable types have separate relabeling rules. If a nonstandard path needs an approved persistent mapping, define it with semanage fcontext and apply it with restorecon. Verify the label and retest access.

Use getsebool and the relevant policy documentation when a legitimate feature appears to be controlled by a boolean. Inspect the boolean's scope before choosing a runtime or an approved persistent change; setsebool -P persists the setting. Tools such as sealert and audit2why can suggest explanations. Investigate path labels, expected service behavior and existing policy before considering a custom reviewed rule. Keep unrelated denials and enforcement controls in place.

Authentication, PAM & Remote Access

Distinguish failure before an SSH connection, failed authentication, and a session or account restriction after credentials are accepted. Check the daemon's listener, service log, account status and the PAM service's actual configuration. For example, journalctl -u sshd can show OpenSSH service events on a RHEL installation. Some systems route authentication entries to files such as /var/log/secure or /var/log/auth.log; use the configured source. An sshd -t check can validate candidate daemon configuration before a planned change.

On a host whose PAM stack uses pam_faillock, faillock --user devuser displays the user's records. Confirm whether the configured threshold and interval account for the incident. Investigate unexpected attempts, correct any stale client credentials, and check whether the service specifies a nondefault tally location. If an authorized reset is needed, faillock --user devuser --reset clears that tally. It does not remove password locks, expiration dates, SSH allow-list restrictions, or other PAM rules. Test the intended account path under the actual service configuration. On managed RHEL systems, check the active authselect profile before changing generated PAM files.

Certificates, Protocols & Cryptographic Policy

A TLS client can fail because the name differs, a certificate is expired or not yet valid, the system clock is wrong, the server omits an intermediate, or the client cannot build trust through its approved anchors. A negotiated connection and a valid peer identity are separate checks.

openssl x509 -in server.crt -noout -dates -subject -issuer -ext subjectAltName
openssl s_client -connect web.example.test:443 -servername web.example.test \
  -verify_hostname web.example.test -verify_return_error \
  -verifyCAfile approved-ca.pem -showcerts

This OpenSSL 3 example uses the test hostname and a PEM file that supplies the server verification trust store. The -servername argument supplies Server Name Indication (SNI); -verify_hostname supplies the expected identity. The -showcerts list contains certificates sent by the server, so examine the verification result separately. Use the same trust configuration as the failing application when reproducing its error.

SSH failures can state which algorithm categories did not overlap, such as host-key signatures, key exchange or ciphers. OpenSSH's ssh-rsa signature scheme uses SHA-1. A compatible RSA key can also sign with RSA/SHA-2 if both sides support it. Prefer a maintained configuration that offers mutually supported modern algorithms. On RHEL, update-crypto-policies --show identifies the current system-wide profile. Check the applicable release and application backend; a policy name does not establish that the whole deployment satisfies a compliance certification.

Exposed Services, Updates & Package Repositories

Compare listening addresses and ports with intended exposure, then inspect the applicable firewall zone or rule and the service's authenticated access. A loopback listener has different exposure from a wildcard binding. Close or restrict an unintended listener through the owning service and verify from the relevant network.

The upstream version string alone can mislead. A vendor such as Red Hat may have backported a fix into an older upstream version. Verify the full installed package build against the vendor advisory. When an update is missing or fails signature verification, inspect enabled repositories, repository configuration, the intended release, key provenance and the error. On a RHEL 9 host use tools such as dnf repolist and dnf repoinfo. Restore the authorized repository and trust configuration, then verify the installed build; disabling signature verification does not correct a trust problem.

Test Your Knowledge

An administrator on an authorized lab system confirms that /srv/lab/settings.conf is a regular file on a writable ext4 mount, has the immutable flag, and has no independent access restriction. Which command clears the flag after approval?

A

chmod 777 /srv/lab/settings.conf

B

setfacl -m u:root:rwx /srv/lab/settings.conf

C

restorecon -v /srv/lab/settings.conf

D

chattr -i /srv/lab/settings.conf

Test Your Knowledge

On RHEL 9, an AVC confirms that httpd_t cannot read a single document with a wrong, non-customizable SELinux type. The file was moved within the same filesystem to /var/www/html/index.html, which already has the correct default policy mapping. Which command repairs just that file?

A

chmod 777 /var/www/html/index.html

B

restorecon -v /var/www/html/index.html

C

Enable an unrelated CGI boolean

D

chown -R apache:apache /var/www/html

Test Your Knowledge

An authorized administrator has already viewed the failure records. The SSH service uses pam_faillock with its default tally directory and the tally is the confirmed cause of the lockout. Which command clears it for devuser?

A

passwd -u devuser

B

faillock --user devuser

C

faillock --user devuser --reset

D

usermod -U devuser

Sections you finish are checked off in the contents.