Closed AnTeKaPa closed 1 month ago
Hmmm, I’ll have to take a look and see if CyberPanel only allows the admin user, I don’t recall reading anything that it did. I’ll do some testing when I get off work today and see what I can find.
I’ll also take a look at the client login, not sure why it would go to an IP.
Okay, took a few minutes while still waking up and getting ready for work. When you change the username for the API user, it returns Only the administrator can use the api
This isn't coming from the server module itself, but instead CyberPanel. We would need to reach out to them to figure out why/if anything needs to be updated on the CyberPanel side to allow other users access to the API.
Hmmm, further looking into this it looks like despite what you provide the username for the "new" admin user their username also reverts to admin.
Though even doing that doesn't seem to work, this seems like a bug upstream within CyberPanel that they would need to review.
To be honest I don't know what to say, because I don't understand this at all, but if I can clarify what I mean:
I have created a new admin user in CyberPanel called fossbilling and set the ACL to admin, after that I used this account to setup Server connection in FossBilling, with your V1 of the code this works fine, but with V2 it said Only the administrator can use the api, so this is about the first issue.
For the second one, I created a normal user through FossBilling with Hosting creation and when login in FossBilling with this user and try to access the Control panel (CyberPanel) ussing the button inside the dashboard of FossBilling it not adding the port for the server and not verifying the user, but this also works correctly with your V1 of the code.
At last, I don't want to loose your time at all, so just tell me is it possible FossBilling to do anything else in CyberPanel except user creating and editing, like creating websites? If not this configuration will be absolutely useless and is no point to continuing with it.
Thanks a lot!
I have created a new admin user in CyberPanel called fossbilling and set the ACL to admin, after that I used this account to setup Server connection in FossBilling, with your V1 of the code this works fine, but with V2 it said Only the administrator can use the api, so this is about the first issue.
I understand, from the looks of it this looks like its a limitation of the new API function that they have provided. It only seems to allow the default "admin" and the error that you get about it not working and needing to be the "administrator" user is from CyberPanel itself. So it seems to be an upstream issue with them that, they would need to open the API up for other admins/resellers.
For the second one, I created a normal user through FossBilling with Hosting creation and when login in FossBilling with this user and try to access the Control panel (CyberPanel) ussing the button inside the dashboard of FossBilling it not adding the port for the server and not verifying the user, but this also works correctly with your V1 of the code.
This should now be fixed, it looks like I was using
$this->port; instead of $this->_config['port];
Thanks for your quick responce and fix, but you still not answer to my most important question, is it possible FossBilling to do something else different of create a user and change password?
I'm sure you know much more of me about both Foss and Cyberpanel, so that's why I asking you...(and no information anywhere) if I cannot create at least a website through FossBilling it is totaly useless and I only loose your time....
Thanks!
Thanks for your quick responce and fix, but you still not answer to my most important question, is it possible FossBilling to do something else different of create a user and change password?
Correct, this server module once the order is placed and paid, or placed and done if it is free. This should create the CyberPanel user in the control panel + their domain that they have provided. This is for both v1/v2. I guess the biggest difference now would also be that V2 will only allow "admin" as the username and no other reseller/user to use the API.
When you do the order, are you seeing that it isn't creating the website? As this server module allows it to create the website, suspend/unsuspend that account, etc.
It is not create a website, both version V1 and V2, only account.
Now I cannot test it again because the virtual machine which I use for this have some problem, I cannot get access to FossBilling admin panel, but anyway, I tryied this many times the last few days and always was only account, maybe I cannot configure it properly, but.... I don't know.
I will reinstall Fossbilling and will test it again and will let you know.
Thanks!
that is odd. On my end it is able to make the account + website. So it first creates the account, and then creates the website under that new user that it created. When you are attempting to create the website from Fossbilling, are you ensuring that the hosting plan/package is the same name as what is in CyberPanel?
For example, lets say you are giving a website on the default plan. FOSSBilling would need a hosting product with that name matching that of CyberPanel
I see where is the problem, I not make them with same names :D, tomorrow morrning I will reinstall the Foss and will test it.
Thanks!
Understood, okay so this gives me an idea that this server manager could be improved perhaps (for V2 only) the previous /api endpoint doesn't have anything for packages, eg creating, listing, deleting.
I've got a thought that when creating the user + website, we can grab the details of the package from FOSSBilling, and check the name and see if it exists in CyberPanel if it does we just continue to create the account + website, if it doesn't we go a different route of Create Account => Create Package with the name in FOSSBilling => Create website with the newly created plan.
This way, if the plan exists we will use it, if it doesn't we will create it once and then there after the fetching of the packages from CyberPanel it should be listed and just be able to use it.
Okay, should be good to go for testing again. Took some time today given this feedback to update the docs. They no longer reside in the README, and now are in a wiki. Per #11 if the hosting package doesn't exist it will auto create the package now and return it and continue on with creating the website (ONLY on version 2). Let me know if you have any issues. 🎉🚀
Thanks for your continued testing, and feedback regarding this! 🙇♂️🙏
Hi again.
So I just test your lates updates and it works.
I have created ONLY in FossBilling Server, Hosting and Service, then register new user account and buy the new Service. The new account, package and website was created in CyberPanel and works.
Have a bit issues:
I don't know what else I can test, if you tell me what I will do it :) . Maybe in a future when CyberPanel, make the New Docker option properly you will can add this into the API code :)
Thanks!
Thanks for the detailed report.
Okay, so far point 2 should be fixed, point 3 is getting that error because we are checking for a return on "status" but the API actually returns a "websiteStatus". None the less, the API endpoint "NONE" is reporting that there were no issues with suspending the domain, so it should have suspended, this seems like perhaps something with CyberPanel. Will have to look further and reach out to them to confirm if its a bug on their side. Either way the code has been updated to reflect that we should be checking "websiteStatus" instead of "status"
Okay, did some further testing and the suspend/un-suspend functions should be working as expected again. So all functions "should" be good to go now.
Ok, I just done some tests.
I found something else durring the test above, if I use the same USER account in Fossbilling which already have a Website/Hosting, to Order a new/another Service/Hosting it creates a NEW user in CyberPanel and hook up the new website to it, I think it should be better if can create a website and attach it to the already existing account, but I don't know is that possible at all...
Thanks!
Hmm, I'll take a look at the changing the hosting plan again.
It creating a new account is further discussed in by design in issue #2
Hmmm, so with the Version 2 API, it doesn't appear that they have a hosting package change in place. The one that we were using before was changePackageAPI
when attempting to use this with the cloudAPI we get the following:
{"status": 0, "error_message": "This function is not available in your version of CyberPanel."}
So seems like this is going to be something that will need to go to CyberPanel to see if there is another API endpoint that is "undocumented" or if they even have a hosting package change that we can use.
I see, ok is not a big problem.
Thanks!
Issue #15 has been opened to track this matter and implement any enhancements when the API endpoint becomes available. We will close this issue in favor of that one. If you have any further concerns, please feel free to reopen this issue or submit a new request for a different matter.
Describe the bug Hi, I have tested the V2 of your code and what I found so far:
Version Being Used V2.x
To Reproduce Steps to reproduce the behavior:
Expected behavior
Screenshots I will send you if is needed.
Additional context This is not exactly about the problem, but please tell me do I do something wrong or just it is what is:
I cannot find a way where Fossbilling can create a new Website inside CyberPanel, it only creates an account and this account is a bit useless, because of the way how CyberPanel works only admin can create websites..... Also of that what I see (and understand) in your code, it only have a control over the Accounts, nothing else, is that, because only this is possible between these 2 softwares or your idea of this code is different? I just not see a point of using both CyberPanel and FossBilling if they cannot communicate to each other for something else of Account creation and password changes....
BTW: I not blame you for anything, just trying to figure out how these things works.
Thanks!