Description of problem:
If 2FA(password + otp) is enabled for IPA user it cannot perform kinit.
kinit fails with:
$ kinit testuser
kinit: Preauthentication failed while getting initial credentials
Version-Release number of selected component (if applicable):
Latest version of IPA and sssd
Steps to Reproduce:
1. As admin, create a new user with password.
2. Enable OTP authentication for this user.
3. Create an either TOTP or HOTP token for this user.
4. Run kinit as this user.
$ kinit testuser
kinit: Generic preauthentication failure while getting initial credentials
kinit should work for 2FA(password + otp) enabled IPA user
This is clone of upstream ticket https://pagure.io/freeipa/issue/4411
Workaround is available as per: http://www.freeipa.org/page/V4/OTP#kinit_Method
kinit, to use 2 factor authentication, requires a so called FAST channel. This channel can be obtained by kiniting as different principal. E.g. admin as showed in "workaround" in comment 2.
Alternative is to use SSSD which has access to host keytab and can thus establish the FAST channel automatically for the user - e.g. during authentication to the host.
But for users who have access to only their Kerberos credential and no keytab and need to use kinit directly there is one alternative: anonymous PKINIT.
IdM on RHEL 7.4 introduced support for anonymous PKINIT.
Design page: https://www.freeipa.org/page/V4/Kerberos_PKINIT
How to use: https://www.freeipa.org/page/V4/Kerberos_PKINIT#How_to_Use
To paste it here:
ARMOR_CCACHE=$(klist|grep cache:|cut -d' ' -f3-)
kinit -T $ARMOR_CCACHE principal@REALM
(so it can be scripted)
This will only work if IPA server has pkinit enabled. That can be checked with command: