FOSSBilling / Proxmox

Proxmox VM provisioning for FOSSBilling
GNU General Public License v3.0
35 stars 5 forks source link

[Bug] Authentication failed error when trying to delete a server #15

Closed xinomilo closed 1 year ago

xinomilo commented 1 year ago

Describe the bug tried to delete a proxmox server and got "Authentication failed" message. details are pretty much the same as this bug: https://github.com/FOSSBilling/FOSSBilling/issues/580 used to work with FOSSBilling 0.1.1, fails now with 0.2.3...

To Reproduce Steps to reproduce the behavior:

  1. Go to Configuration -> Proxmox Servers
  2. Click on 'Delete' to a proxmox server
  3. "Authentication Failed" system error, server is not removed from list.

Expected behavior remove proxmox server from list.

php_error.log

`[12-Dec-2022 20:30:59 $timezone] 2 Undefined array key "CSRFToken" /modules/Api/Controller/Client.php 302 [12-Dec-2022 20:30:59 $timezone] An exception has been thrown. Stacktrace: [12-Dec-2022 20:30:59 $timezone] /modules/Api/Controller/Client.php:317 - __construct(CSRF token invalid., , ) /modules/Api/Controller/Client.php:179 - _checkCSRFToken() /modules/Api/Controller/Client.php:92 - _apiCall(admin, serviceproxmox_server_delete, ) /modules/Api/Controller/Client.php:68 - tryCall(admin, serviceproxmox_server_delete, ) NO_FILE:NO_LINE - get_method(, admin, serviceproxmox, server_delete) /library/Box/App.php:217 - invokeArgs(, ) /library/Box/App.php:370 - executeShared(Box\Mod\Api\Controller\Client, get_method, ) /library/Box/App.php:158 - processRequest() /index.php:30 - run()

[12-Dec-2022 20:30:59 $timezone] An exception has been thrown. Stacktrace: [12-Dec-2022 20:30:59 $timezone] /modules/Api/Controller/Client.php:209 - __construct(Authentication Failed, , ) /modules/Api/Controller/Client.php:217 - getAuth() /modules/Api/Controller/Client.php:182 - _tryTokenLogin() /modules/Api/Controller/Client.php:92 - _apiCall(admin, serviceproxmox_server_delete, ) /modules/Api/Controller/Client.php:68 - tryCall(admin, serviceproxmox_server_delete, ) NO_FILE:NO_LINE - get_method(, admin, serviceproxmox, server_delete) /library/Box/App.php:217 - invokeArgs(, ) /library/Box/App.php:370 - executeShared(Box\Mod\Api\Controller\Client, get_method, ) /library/Box/App.php:158 - processRequest() /index.php:30 - run()

[12-Dec-2022 20:30:59 $timezone] Authentication Failed 206`

thanks in advance, let me know if you need any more info...

xinomilo commented 1 year ago

removed module proxmox completely, reinstalled from extensions, and now "add server" also fails with same "Authentication Failed". same message just different : _apiCall(admin, serviceproxmox_server_create, )

BelleNottelling commented 1 year ago

Hey @xinomilo temporarily to work around this, you can edit your config.php file and set CSRFPrevention to false. I'll see if I can find the error with the Proxmox module and I'll send you updated code to test once I've found it.

Thanks for the report!

BelleNottelling commented 1 year ago

@xinomilo I just tested it on my end and everything appears to be in order.. Can you please do me a favor and download this zip file and replace the existing module? https://github.com/FOSSBilling/Proxmox/archive/refs/heads/main.zip

I am suspicious your system may have re-downloaded the outdated version

xinomilo commented 1 year ago

well, you're right, after manually downloading latest zip and replacing existing proxmox extension, everything works as expected. adding/removing proxmox servers works fine! thanks!

but i think there's another bug with extension store perhaps (?)...
at first, after downloading version 0.0.2, it still showed 0.0.1 version in installed extensions (didn't notice before your comment...), so extension update didn't work.... after manually replacing with latest zip (1.0.0), i still see version 0.0.2 in extension store.. (?) and it seems extension dir isn't removed after removing extension from extensions manager..

i'll leave that for another bug/day :)

BelleNottelling commented 1 year ago

Yeah, there was a bit of confusion with the version number between the module and the extension store. We will get that sorted out. I'm glad the manual update fixed it!