Details
Description
Clients sometimes get themselves blocked from their cPanel, Plesk, etc hosting server. Usually by logging in too many times with the wrong password for SSH or email. This will allow clients to login to Blesta, click to manage their hosting service, and access a plugin management tab that allows them to unblock their own IP address.
The plugin should be compatible with cPanel, as well as other shared hosting panels that the CSF firewall plugin works for, including:
- cPanel
- DirectAdmin
The plugin would connect using the API credentials stored for cPanel (and possibly DirectAdmin) to unblock the IP via the API. See https://forums.cpanel.net/threads/minimal-permissions-for-managing-csf-through-api-token.623415/ for an example.
It would be possible to also add compatibility for other servers/panels by establishing an SSH connection to the server and executing the command:
csf -dr IPADDRESS
This could work with SSH RSA key, passwordless access, or with the root login credentials. If using keys, and the default SSH port, we should have what we need from the module row of the module if we know what we are looking for and add support for specific additional modules like: Virtualmin, Interworx, Plesk
Going to the management tab as a client, the client would see their IP address and be able to issue an UNBAN command for it. They wouldn't be able to enter just any IP.
The plugin should also register a management tab in the staff interface when managing the service, which would allow the admin to enter any IP address to unban.
There is a command called pdsh that we could execute via system or exec to execute commands on remote servers that we have SSH access too, an example command would be:
pdsh -w root@server.domain.com -R ssh "csf -dr IPADDRESS"
See https://www.rittmanmead.com/blog/2014/12/linux-cluster-sysadmin-parallel-command-execution-with-pdsh/ for usage examples.