Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PAM: don't set PR_SET_DUMPABLE #7791

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/man/sssd.conf.5.xml
Original file line number Diff line number Diff line change
Expand Up @@ -712,6 +712,14 @@
leaking plain text passwords. See man page
prctl:PR_SET_DUMPABLE for details.
</para>
<para>
Take a note that this setting has no effect
for 'ldap_child', 'krb5_child' and 'sssd_pam'
as those privileged binaries can have a copy
of a host keytab data in a memory and their
behavior in this regards is governed by
/proc/sys/fs/suid_dumpable system setting.
</para>
<para>
Default: true
</para>
Expand Down
39 changes: 24 additions & 15 deletions src/util/server.c
Original file line number Diff line number Diff line change
Expand Up @@ -729,21 +729,30 @@ int server_setup(const char *name, bool is_responder,
}
}

ret = confdb_get_bool(ctx->confdb_ctx,
CONFDB_MONITOR_CONF_ENTRY,
CONFDB_MONITOR_DUMPABLE,
true, /* default value */
&dumpable);
if (ret != EOK) {
DEBUG(SSSDBG_FATAL_FAILURE, "Failed to determine "CONFDB_MONITOR_DUMPABLE"\n");
return ret;
}
ret = prctl(PR_SET_DUMPABLE, dumpable ? 1 : 0);
if (ret != 0) {
DEBUG(SSSDBG_CRIT_FAILURE, "Failed to set PR_SET_DUMPABLE\n");
return ret;
} else if (!dumpable) {
DEBUG(SSSDBG_IMPORTANT_INFO, "Core dumps are disabled!\n");
/* Don't touch PR_SET_DUMPABLE for sssd_pam as it
* handles host keytab.
* Rely on system settings instead: this flag "is reset to the
* current value contained in the file /proc/sys/fs/suid_dumpable"
* when "the process executes a program that has file capabilities".
*/
if (strcmp(name, "pam") != 0) {
ret = confdb_get_bool(ctx->confdb_ctx,
CONFDB_MONITOR_CONF_ENTRY,
CONFDB_MONITOR_DUMPABLE,
true, /* default value */
&dumpable);
if (ret != EOK) {
DEBUG(SSSDBG_FATAL_FAILURE,
"Failed to determine "CONFDB_MONITOR_DUMPABLE"\n");
return ret;
}
ret = prctl(PR_SET_DUMPABLE, dumpable ? 1 : 0);
if (ret != 0) {
DEBUG(SSSDBG_CRIT_FAILURE, "Failed to set PR_SET_DUMPABLE\n");
return ret;
} else if (!dumpable) {
DEBUG(SSSDBG_IMPORTANT_INFO, "Core dumps are disabled!\n");
}
}

sss_chain_id_setup(ctx->event_ctx);
Expand Down
Loading