Blesta module
Install the HF Panel module in Blesta to create, suspend, upgrade and cancel hosting accounts, with a Control Panel sign-in button.
The HF Panel module for Blesta manages HF Panel hosting accounts from your Blesta installation. Blesta creates the account when a service is activated, suspends and unsuspends it, moves it to another package and deletes it when the service is cancelled. Customers open their Control Panel from the service's Control Panel tab.
The module talks to the token API with an API token. It uses the same calls as the Billing integration page describes.
What you need
- Blesta 5 with PHP 8.1 or newer and the PHP cURL extension
- HF Panel 1.0.0 or newer
- a Read & change API token from Server Admin, or from the Reseller Panel to sell as a reseller
1. Download and install the module
- Download Blesta module from the Integrations part of the install page:
https://hostfog.io/download/#integrations. - Unzip it into your Blesta folder. The files go to
components/modules/hfpanel/. - In Blesta, open Settings › Modules › Available, find HF Panel and click Install.
2. Make an API token in HF Panel
- Sign in to Server Admin (or the Reseller Panel).
- Open your name at the top right › Password & security › API tokens.
- In Name, type
Blesta, and choose Read & change. - In Allowed IPs, type your Blesta server's IP address.
- Type your password and click Create token, then click Copy token. It is not shown again.
3. Add the server in Blesta
Open Settings › Modules › Installed, click Manage next to HF Panel, then Add Server.
| Field | What to enter |
|---|---|
| Server label | a name you recognise, for example Main |
| API host name | api.yourdomain.com. On a server without the separate API address, type the panel's address, panel.yourdomain.com |
| Port | 2087, or 8443 for the panel's address |
| Use HTTPS (recommended) | ticked. HF Panel answers only HTTPS, and the module checks the server's certificate |
| API token | the token, hf_…. Blesta stores it encrypted |
Click Add Server. Blesta checks the token straight away (GET /v1/me): the server is saved only when the token
works and has Read & change access. Otherwise the reason is shown under API token.
To spread customers over several HF Panel servers, click Add Server Group and put the servers in it.
4. Make a package
- Open Packages › Browse and click Create Package.
- Under Module Options, choose HF Panel as the module and pick the server or server group.
- Choose the HF Panel package. The list comes from your HF Panel server, so make the packages first under Server Admin › Accounts › Packages.
- Tick Also send HF Panel's welcome email if HF Panel should also email the customer their sign-in details.
- Add the pricing and click Create Package.
When ordering, the customer types the Domain. When an administrator adds a service, they can also set the Username and Password; left empty, the username is made from the domain and HF Panel makes a strong random password.
5. Test it
- Add a service for a test client with the package, and tick Provision using the HF Panel module.
- Check that the account appears in Server Admin under Accounts.
- On the service, open the HF Panel tab and click Log in to Control Panel.
- Try Suspend, Unsuspend and a package change, then cancel the service to clean up.
Every call is written to Blesta's module log (Tools › Logs › Module). The token and passwords are masked.
What each action does
| Blesta action | What happens in HF Panel | API call |
|---|---|---|
| Activate a service | makes the hosting account with the package and the domain | POST /v1/accounts |
| Suspend | suspends the account: its websites, email and logins stop | POST /v1/accounts/{username}/suspend |
| Unsuspend | switches the account back on | POST /v1/accounts/{username}/unsuspend |
| Cancel | deletes the account with all its websites, email and databases | DELETE /v1/accounts/{username} |
| Change package | moves the account to the new package's HF Panel package | POST /v1/accounts/{username}/package |
| New password (service edit or tab) | sets the password for the Control Panel and SFTP | POST /v1/accounts/{username}/password |
| Log in to Control Panel | opens the customer's Control Panel, signed in, with a one-time link that works for 2 minutes | POST /v1/accounts/{username}/login |
| The tabs' usage | shows disk space used and allowed, and this month's bandwidth | GET /v1/accounts/{username}/usage |
| Saving a server | checks the token and its access | GET /v1/me |
The tabs
- HF Panel (admin): the account's status, package and usage, Log in to Control Panel and Change password.
- Control Panel (client): usage, Log in to Control Panel and Change password.
The new password must be 8–128 characters, without quotes ('), backslashes or control characters. Blesta keeps the
service's stored password in step.
Troubleshooting
| Message | What to do |
|---|---|
Could not connect with this token: Unknown or deleted token. |
Paste the token again, or make a new one if it was deleted. |
This token is read-only. Make a "Read & change" token. |
Make a Read & change token and use it instead. |
This token cannot be used from <address>. |
Add that address to the token's Allowed IPs. |
Too many failed attempts from this IP. Try again in 15 minutes. |
A wrong token was tried too often. Fix the token, then wait 15 minutes. |
HF Panel did not answer with JSON (HTTP 403). |
The host name or port is wrong: use api.yourdomain.com with port 2087, or the panel's address with port 8443. |
Could not reach HF Panel at … |
Check the host name, the port and that your Blesta server may connect to it. A certificate error means the server's certificate is not valid yet. |
Could not load the packages: … |
The package form could not reach the server. Fix the server's settings, then open the package again. |
That username is taken. |
Choose another username for the service. |
No such account. |
The service's username is not on the server, or belongs to a customer the token may not manage. |
This needs another administrator's approval first. … |
Deleting accounts needs a second administrator. Delete the account in HF Panel, then cancel the service in Blesta without the module. |
The control panel licence needs attention: … |
Renew or fix the HF Panel licence. |