Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Login action not working in OpenNebula Tenants module for WHMCS, when FireEdge HTTPS [WORKAROUND INCLUDED] #6879

Open
3 tasks
Franco-Sparrow opened this issue Jan 28, 2025 · 1 comment

Comments

@Franco-Sparrow
Copy link

Franco-Sparrow commented Jan 28, 2025

Description

Login action not working in OpenNebula Tenants module for WHMCS, when cloud frontend use HTTPS. A client with a service active, when execute the Login button is not getting automatically authenticated and WHMCS throws error in authtentication. The error is inside /usr/share/one/whmcs/modules/servers/OpenNebulaTenants/app/libs/OpenNebulaTenantsAPI.php, or in a production enviroment, /var/www/whmcs/modules/servers/OpenNebulaTenants/app/libs/OpenNebulaTenantsAPI.php. The curl function is not taking in count the protocol for building the URL, and when you dont specify the protocol, is assumed HTTP by default. Thats why we are getting a permanent redirect on our cloud reverse proxy and the authentication token could not be gathered. Check the reverse proxy logs below:

144.168.XX.200 - - [27/Jan/2025:20:26:00 -0800] "POST /fireedge/api/auth HTTP/1.1" 301 169 "-" "-"

We should be getting something like this:

144.168.XX.200 - - [27/Jan/2025:20:53:19 -0800] "POST /fireedge/api/auth HTTP/2.0" 200 303 "-" "-"
51.158.XX.200 - - [27/Jan/2025:20:53:20 -0800] "GET /fireedge/sunstone/?externalToken=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiIxOSIsImF1ZCI6InNlcnZlcmFkbWluOmZyYW5jb0B2aXJ0YWx1cy5jb20iLCJqdGkiOiJMZzdlYVFORm9pVkFjelFTsVVzaktmZnlVdGFFTzNaa1dVUWYzczBsbnpFbkJYK3RUQmdOQnRFWWRDTjAreHBRIn0.krZePtUgim8nKMLhqtK9a5R3TliZ_oZ4rF_65rBDZI4 HTTP/2.0" 200 2045 "https://accounts-test.mydomain.com/" "Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0"

To Reproduce

  1. Install WHMCS latest LTS version v8.11.2 (at the moment of writting this issue), following the official site procedure.
  2. Install OpenNebula Tenant module following OpenNebula documentation.
  3. Configure integration with some opennebula cloud in v6.10.2 or v6.8.2.
  4. Test the Login button for a given client with an active service.

Expected behavior

After executed the Login button, the WHMCS should redirect to the cloud frontend without ask for authentication. The SSO should works.

Workaround

As all public cloud we have are using HTTPS, the following modification will just work if your frontend is using this secured protocol.

Edit OpenNebulaTenantsAPI.php:

Change this:

/ [...]
        $curl = curl_init();
        curl_setopt($curl, CURLOPT_URL,             $this->url.'/fireedge/api/auth');
/ [...]

To this:

/ [...]
        $curl = curl_init();
        curl_setopt($curl, CURLOPT_URL,             'https://'.$this->url.'/fireedge/api/auth');
/ [...]

Restart apache2:

systemctl restart apache2

Recommendation

When Login button is executed, should not redirect to the cloud frontend of the given service on the same tab. Instead, I would recommend to open a new tab with the cloud frontend URL. On this way the client wont loose the WHMCS tab and could access to others clouds where his account is active, without the need of reopen WHMCS on a new tab.

Details

  • Affected Component: [OpenNebula Tenant module]
  • Hypervisor: [KVM]
  • Version: [6.10.2]

Additional context

Add any other context about the problem here.

Progress Status

  • Code committed
  • Testing - QA
  • Documentation (Release notes - resolved issues, compatibility, known issues)
@Franco-Sparrow Franco-Sparrow changed the title Login Action not working in OpenNebula Tenants module for WHMCS Login Action not working in OpenNebula Tenants module for WHMCS [WORKAROUND INCLUDED] Jan 28, 2025
@Franco-Sparrow Franco-Sparrow changed the title Login Action not working in OpenNebula Tenants module for WHMCS [WORKAROUND INCLUDED] Login action not working in OpenNebula Tenants module for WHMCS [WORKAROUND INCLUDED] Jan 28, 2025
@Franco-Sparrow Franco-Sparrow changed the title Login action not working in OpenNebula Tenants module for WHMCS [WORKAROUND INCLUDED] Login action not working in OpenNebula Tenants module for WHMCS, when cloud use HTTPS [WORKAROUND INCLUDED] Jan 28, 2025
@Franco-Sparrow Franco-Sparrow changed the title Login action not working in OpenNebula Tenants module for WHMCS, when cloud use HTTPS [WORKAROUND INCLUDED] Login action not working in OpenNebula Tenants module for WHMCS, when FireEdge HTTPS [WORKAROUND INCLUDED] Jan 28, 2025
@Franco-Sparrow
Copy link
Author

Franco-Sparrow commented Feb 3, 2025

Hi @tinova @rsmontero

Sorry to tag you both directly on this issue, but if you find an available time in your schedule, please check thi sone.

Cheers and thanks for your hard work. I will keep supporting your team from my side :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant