Skip to content
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
19 changes: 19 additions & 0 deletions src/man/pam_sss.8.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@
<arg choice='opt'>
<replaceable>require_cert_auth</replaceable>
</arg>
<arg choice='opt'>
<replaceable>allow_chauthtok_by_root</replaceable>
</arg>
</cmdsynopsis>
</refsynopsisdiv>

Expand Down Expand Up @@ -249,6 +252,22 @@ auth sufficient pam_sss.so allow_missing_name
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>allow_chauthtok_by_root</option>
</term>
<listitem>
<para>
By default the chauthtok PAM action will short-circuit to
returning PAM_SUCCESS when pam_sss.so is invoked by root
user.
</para>
<para>
This option disables this behavior allowing to change
auth tokens when running as root.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>

Expand Down
4 changes: 3 additions & 1 deletion src/sss_client/pam_sss.c
Original file line number Diff line number Diff line change
Expand Up @@ -2472,6 +2472,8 @@ static void eval_argv(pam_handle_t *pamh, int argc, const char **argv,
}
} else if (strcmp(*argv, "quiet") == 0) {
*quiet_mode = true;
} else if (strcmp(*argv, "allow_chauthtok_by_root") == 0) {
*flags |= PAM_CLI_FLAGS_ALLOW_CHAUTHTOK_BY_ROOT;
} else if (strcmp(*argv, "ignore_unknown_user") == 0) {
*flags |= PAM_CLI_FLAGS_IGNORE_UNKNOWN_USER;
} else if (strcmp(*argv, "ignore_authinfo_unavail") == 0) {
Expand Down Expand Up @@ -2756,7 +2758,7 @@ static int get_authtok_for_password_change(pam_handle_t *pamh,
}

if (pam_flags & PAM_PRELIM_CHECK) {
if (getuid() == 0 && !exp_data )
if (!(flags & PAM_CLI_FLAGS_ALLOW_CHAUTHTOK_BY_ROOT) && getuid() == 0 && !exp_data )
return PAM_SUCCESS;

if (flags & PAM_CLI_FLAGS_USE_2FA
Expand Down
1 change: 1 addition & 0 deletions src/sss_client/sss_cli.h
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,7 @@ enum pam_item_type {
#define PAM_CLI_FLAGS_PROMPT_ALWAYS (1 << 7)
#define PAM_CLI_FLAGS_TRY_CERT_AUTH (1 << 8)
#define PAM_CLI_FLAGS_REQUIRE_CERT_AUTH (1 << 9)
#define PAM_CLI_FLAGS_ALLOW_CHAUTHTOK_BY_ROOT (1 << 10)

#define SSS_NSS_MAX_ENTRIES 256
#define SSS_NSS_HEADER_SIZE (sizeof(uint32_t) * 4)
Expand Down