DirectAdmin
Create, suspend and remove DirectAdmin users automatically from a reseller account. Not yet tested against a live server.
The DirectAdmin plugin creates a user on your DirectAdmin server when an invoice is paid, then suspends, unsuspends, changes the package of and removes it as the service changes.
This plugin was written from DirectAdmin's published API documentation and has not been tested against a live DirectAdmin server yet. A few calls (package change, password reset and the one-time login link) are not in the official reference and follow forum and staff posts; they are listed below. Try it on a test server first.
What it does#
| In Tidemark Billing | In DirectAdmin |
|---|---|
| Invoice paid, service activated | Creates the user (CMD_API_ACCOUNT_USER) with the package, an IP and a generated password |
| Service suspended / unsuspended | dosuspend / dounsuspend through CMD_API_SELECT_USERS |
| Service terminated | Deletes the user through CMD_API_SELECT_USERS |
| Product or plan changed | CMD_API_MODIFY_USER with action=package |
| Log in to DirectAdmin | A one-time login URL, or the normal login page (see below) |
| Reset password | CMD_API_USER_PASSWD; the new password appears on the service page |
Customers and staff both get Log in to DirectAdmin and Reset password.
Credentials#
Use a reseller or admin account on the server. Requests use HTTP Basic authentication on port 2222.
- Username: the reseller's login.
- Password / API token: its password or, better, a Login Key from DirectAdmin's Login Keys page.
A Login Key must allow these commands: CMD_API_ACCOUNT_USER, CMD_API_SELECT_USERS, CMD_API_MODIFY_USER, CMD_API_PACKAGES_USER, CMD_API_SHOW_RESELLER_IPS and CMD_API_USER_PASSWD. Do not restrict the key by IP address unless the address of the Tidemark Billing server is allowed.
Set it up#
- Open Plugins and press Enable on DirectAdmin.
- Open Servers → Add server and choose the module DirectAdmin.
- In Connection fill in Hostname, Port (blank means 2222), Username and Password / API token, and set Use HTTPS and Verify certificate to match the server.
- In the DirectAdmin options card you can set:
- Shared IP address: where new shared accounts are created. Blank uses the first shared or server IP the reseller owns.
- Max username length: blank means 10. DirectAdmin's default is 10 and
max_username_lengthindirectadmin.confcan be 8 to 14, so match your server. - Nameserver 1 and Nameserver 2: shown to customers on their service page.
- Save, then press Test connection on the Servers list.
- Open a product, set Module to DirectAdmin and fill in:
- User package (required): the exact name of a user package owned by the reseller (Reseller Level → Manage User Packages).
- IP address: Shared or Dedicated (next free IP).
The service label is the domain#
The user's domain is the service's Label, for example example.com. An invalid label fails provisioning with a clear message; fix it and press Retry. The username is derived from the domain: lowercase letters and digits, starting with a letter, up to the maximum length, with a digit added if the name is taken.
Login button limits#
Log in to DirectAdmin asks DirectAdmin for a one-time login URL by acting as reseller|user. DirectAdmin requires the reseller's current password for that, so it only works when the server's Password / API token is the reseller's password. With a Login Key (which would also need CMD_API_LOGIN_KEYS), the button opens the panel's normal login page instead.
Calls that are not in the official reference#
These follow DirectAdmin staff and forum posts. Verify them on your server:
- Package change: the reference documents only
action=customizeforCMD_API_MODIFY_USER; the plugin sendsaction=package. - Password reset:
CMD_API_USER_PASSWDis undocumented. If the account's password is stored, the plugin calls it as the account; otherwise as the reseller. Replies can be empty or unreliable, so success means "no error returned". - One-time login URL: parameters for
CMD_API_LOGIN_KEYScome from a forum thread.