Skip to content

Commit

Permalink
ipa-pwd-extop: add MFA note in case of a successful LDAP bind with OTP
Browse files Browse the repository at this point in the history
In case there is a successful OTP authentication attempt, register it as
an operation note on the BIND operation in LDAP. 389-ds then will print
a multi-factor authentication note in both access and security logs
according to https://www.port389.org/docs/389ds/design/mfa-operation-note-design.html

Fixes: https://pagure.io/freeipa/issue/5169

Signed-off-by: Alexander Bokovoy <abokovoy@redhat.com>
Reviewed-By: Florence Blanc-Renaud <flo@redhat.com>
  • Loading branch information
abbra authored and flo-renaud committed Mar 12, 2024
1 parent 1d2897e commit 23b224d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
10 changes: 10 additions & 0 deletions daemons/ipa-slapi-plugins/ipa-pwd-extop/prepost.c
Original file line number Diff line number Diff line change
Expand Up @@ -1551,6 +1551,16 @@ static int ipapwd_pre_bind(Slapi_PBlock *pb)
/* Attempt to write out kerberos keys for the user. */
ipapwd_write_krb_keys(pb, discard_const(dn), entry, credentials);

#ifdef USE_OP_NOTE_MFA_AUTH
/* If it was a successful authentication with OTP required, mark it
* for access log to notice multi-factor authentication has happened
* https://www.port389.org/docs/389ds/design/mfa-operation-note-design.html
*/
if (!syncreq && otpreq) {
slapi_pblock_set_flag_operation_notes(pb, SLAPI_OP_NOTE_MFA_AUTH);
}
#endif

slapi_entry_free(entry);
slapi_sdn_free(&sdn);
return 0;
Expand Down
8 changes: 8 additions & 0 deletions server.m4
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ PKG_CHECK_MODULES([DIRSRV], [dirsrv >= 1.3.0])
# slapi-plugin.h includes nspr.h
DIRSRV_CFLAGS="$DIRSRV_CFLAGS $NSPR_CFLAGS"

bck_cflags="$CFLAGS"
CFLAGS="$CFLAGS $DIRSRV_CFLAGS"
AC_CHECK_DECL([SLAPI_OP_NOTE_MFA_AUTH], [
AC_DEFINE(USE_OP_NOTE_MFA_AUTH,1,
[Use LDAP operation note for multi-factor LDAP BIND])],
[], [[#include <dirsrv/slapi-plugin.h>]])
CFLAGS="$bck_cflags"

dnl -- sss_idmap is needed by the extdom exop --
PKG_CHECK_MODULES([SSSIDMAP], [sss_idmap])
PKG_CHECK_MODULES([SSSNSSIDMAP], [sss_nss_idmap >= 1.15.2])
Expand Down

0 comments on commit 23b224d

Please sign in to comment.