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

Administrator
Staff member
Apr 11, 2011
47,909
2,228
463
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
32
4
8
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.
 

Dansk

Registered
Jun 23, 2018
1
0
0
London, UK
cPanel Access Level
Root Administrator
Greetings,

Same issue here. This only started within the last couple months after an update to WHM.

What error messages in the error log would I be looking for exactly? cPanel version is 84.0.16.

Kind thanks