The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Run root script using the cPanel API with 2FA enabled issue

Discussion in 'General Discussion' started by kristofferR, Mar 31, 2016.

  1. kristofferR

    kristofferR Member

    Oct 20, 2012
    Likes Received:
    Trophy Points:
    cPanel Access Level:
    Root Administrator
    I enabled 2FA and for the most part it worked great, except that it broke my Letsencrypt script found here:
    [How-To] Installing SSL from Let's Encrypt

    Nevermind the script (since it's unofficial cPanel naturally won't/can't/shouldn't support it), but the authentication method it is using is directly copy-pasted from their documentation. It's using the Access Hash authentication
    Guide to API Authentication - Software Development Kit - cPanel Documentation

    It worked fine with 2FA disabled, but with 2FA enabled the output from the "print $response->content;" after it tried to install the certificate is just the html for the two-factor auth WHM page, indicating that it needs the six digit 2FA code to authenticate correctly.

    I obviously can't input the 2FA six-digit security code for a crontab script that will run automatically at set intervals, so the 2FA auth example code they have on that documentation page is a no go.

    Do I have to chose between using the cPanel API in scripts vs 2FA security or is there a way to bypass the need to input the 2FA security code for scripts accessing the cPanel API running on my server?
  2. cPanelKenneth

    cPanelKenneth cPanel Development
    Staff Member

    Apr 7, 2006
    Likes Received:
    Trophy Points:
    cPanel Access Level:
    Root Administrator
    In cPanel & WHM version 54 you have to choose between 2FA and your app. Version 56 comes with some improvements to 2FA that make it possible/easier to use with custom apps.

Share This Page