Pam_krb5 from epel doesn't work with openssh and selinux (Almalinux 10)

Under AlmaLinux 10, the pam_krb5 package (from epel) works fine for local logins, but fails when trying to ssh into the computer. Selinux is preventing sshd-session from creating /tmp/krb5cc_pam_* .

hi

This may be related to the new sshd_session_t SELinux domain introduced with OpenSSH 9.8+.

Could you share the AVC denial logs from:

ausearch -m AVC -ts recent

It may require a targeted SELinux policy update rather than disabling SELinux.

thanks

Hi,

Here’s the output from ausearch -m AVC -ts recent

time->Wed Oct 28 14:08:45 2026
type=PROCTITLE msg=audit(1793210925.736:9385): proctitle=737368642D73657373696F6E3A20626B773161205B707269765D
type=SYSCALL msg=audit(1793210925.736:9385): arch=c000003e syscall=257 success=no exit=-13 a0=ffffff9c a1=555e9a1a6640 a2=c2 a3=180 items=0 ppid=2616 pid=1803585 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="sshd-session" exe="/usr/libexec/openssh/sshd-session" subj=system_u:system_r:sshd_session_t:s0-s0:c0.c1023 key=(null)
type=AVC msg=audit(1793210925.736:9385): avc: denied { create } for pid=1803585 comm="sshd-session" name="krb5cc_pam_HumMOr" scontext=system_u:system_r:sshd_session_t:s0-s0:c0.c1023 tcontext=system_u:object_r:tmp_t:s0 tclass=file permissive=0

and /var/log/secure says:

Oct 28 14:08:45 172-28-36-147 sshd-session[1803585]: pam_krb5(sshd:auth): (user me) mkstemp("/tmp/krb5cc_pam_HumMOr") failed: Permission denied

Thanks

The denial shows sshd_session_t being refused file creation on a tmp_t object, so pam_krb5 is writing its credential cache to a location the sshd domain is not allowed to use. The cleanest fix is to move the cache off /tmp, for example by setting default_ccache_name to a KEYRING or KCM type in /etc/krb5.conf, or by using a ccache directory option in the pam_krb5 line if your build supports one. As a stopgap you can generate a local module with ausearch -m avc -ts recent | audit2allow -M local_sshd_krb5, review the resulting .te file so it only allows this one create on tmp_t, and then load it with semodule -i. Since the policy should probably allow this out of the box for a packaged module, it is also worth reporting the AVC against the selinux-policy package.

Passing ccname_template=FILE:/run/user/%U/krb5cc_%p to pam_krb5.so in /etc/pam.d/sshd (or migrating to sssd-krb5, which handles KEYRING:persistent:%{uid} natively under AlmaLinux 10’s targeted SELinux policy) avoids the tmp_t creation denial without needing a custom audit2allow module. When we migrated our Linux license and CAD file servers to AlmaLinux 10 (enterprise network licensing and server setup notes), moving Kerberos credential caches into /run/user/%U resolved all sshd_session_t SELinux alerts immediately.

Hi,

Thank you for sharing the AVC logs.

I checked the upstream pam_krb5 source code and noticed an important distinction.

The failing file, /tmp/krb5cc_pam_*, is a temporary credential cache created during PAM authentication.

In the upstream implementation, this temporary cache is created using the ccache_dir setting:

dir = args->config->ccache_dir;
asprintf(&cache_name, "%s/krb5cc_pam_XXXXXX", dir);

Therefore, changing only the user’s session credential cache location may not resolve this particular AVC denial.

The logs confirm that sshd_session_t is denied permission to create a file labeled tmp_t.

Could you share the following package versions?

rpm -q pam_krb5 openssh-server selinux-policy-targeted

It may be worth investigating whether the SELinux policy needs additional support for pam_krb5 authentication under sshd_session_t.

If relocating the temporary credential cache is considered, the destination directory must have appropriate SELinux labeling and permissions.

I would avoid disabling SELinux or applying broad audit2allow rules as a permanent solution.

Upstream source:

Thanks!

Thanks. Here’s some additional information:

rpm -q pam_krb5 openssh-server selinux-policy-targeted

pam_krb5-4.11-7.el10_0.x86_64
openssh-server-9.9p1-29.el10_2.alma.1.x86_64
selinux-policy-targeted-42.1.18-4.el10_2.4.noarch

Hi,

Thanks for providing the package versions.

I confirmed that pam_krb5-4.11-7.el10_0 is the EPEL package based on the upstream source code I referenced earlier.

The AVC denial suggests a possible SELinux policy compatibility issue between pam_krb5 and the sshd_session_t domain used by OpenSSH 9.9.

Could you check whether ccache_dir is explicitly configured in your PAM configuration or /etc/krb5.conf?

Also, if setools-console is installed, could you run:

sesearch -A -s sshd_session_t -t tmp_t -c file -p create

This would help determine whether the current SELinux policy includes an allow rule for this operation.

As a possible workaround, we could investigate relocating the temporary Kerberos credential cache using ccache_dir, provided the destination has appropriate SELinux labeling and permissions.

If the policy is missing the required permissions, I think this issue should be reported to the EPEL pam_krb5 maintainers and the SELinux policy maintainers.

Thanks!

ccache_dir isn’t configured in /etc/krb5.conf.

sesearch -A -s sshd_session_t -t tmp_t -c file -p create shows nothing.

Check also files in /etc/krb5.conf.d/ as those augment or override the config.

Nothing in /etc/krb5.conf.d is setting ccache_dir .