Two Factor Authentication Invalid Code Error

Michael Smith

Registered
Sep 10, 2016
4
1
3
United Kingdom
cPanel Access Level
Root Administrator
Hey guys,

Last week n a bit ive been having issues with the 2 factor on WHM.

When i set the 2 factor up the code works. It will continue to work for a few hours then it will start saying invalid code. I then have to login to ssh and action

whmapi1 twofactorauth_disable_policy

login and set it up again.

at first i thought it was system time thing however we have other software on the server using 2 factor auth that works fine. So tried a different device to generate the codes and the same thing happens.

Is there any way i can diagnose this better ? a log that shows why it failed ??

Thanks in advanced
 

cPanelMichael

Technical Support Community Manager
Staff member
Apr 11, 2011
47,911
2,233
363
cPanel Access Level
DataCenter Provider
Twitter
Hello,

Could you let us know the version of cPanel installed on the system? Also, do you notice any output to /usr/local/cpanel/logs/error_log when this happens?

Thank you.
 

cetiner

Active Member
Dec 24, 2018
26
3
3
turkey
cPanel Access Level
Root Administrator
[2019-10-12 09:03:41 +0200] info [securitypolicy] Security Policy Failed: ['TwoFactorAuth'], User: ['root'], Appname: ['whostmgrd'], IP: ['XX.XX.XX.X'], Error: ['The security code is invalid.']

Hello dear @cPanelMichael ,
Same error message like on the frontend.

Can't use it.
Bevore it was activated successfully activated but login with 2FA always failed.
Removed/deactivated 2FA via command line and tried to reconfigure it - no chance....

Removed the deactivated user root in frontend and tried to reconfigure it - failed.