Hook Points

Custom hooks can be used to integrate automation of SoluteDNS with other applications. To use hook points create a file called Hooks.php in the lib/Custom folder of the SoluteDNS directory.

DNSsec Key Update:

Function: DnssecUpdate($vars)
Triggers: DNSsec Reset, DNSsec Unsecure

Parameters:

domainstring
Zone name
keysarray
DNSsec key list
dsarray
DS records list
Pre DNSsec Key Removal:

Function: PreDnssecRemoval(($vars)
Triggers: DNSsec Unsecure
Version: c1.22.001

Parameters:

domainstring
Zone name
actionstring
unset

Return:

falsebool
Continue as normal.
truebool
Stop further operations. Keys will not be removed.
Variablesarray
Return an array to postpone key removal.

queuekey
Int in seconds to have the key removal postponed.
After Zone Creation:

Function: AfterZoneCreation($vars)
Triggers: Zone Creation

Parameters:

domainstring
Zone name
typestring
Zone type (d/p/s/r)
dnssecarray
Array of DNSsec details when configured. [optional]

keysarray
DNSsec key list
dsarray
DS records list
namespace WHMCS\Module\Addon\SoluteDNS\Custom;

if (!defined("WHMCS")) {
  die("This file cannot be accessed directly");
}

class Hooks {

  public function AfterZoneCreation($vars) {	
    // Do anything you want	
  }

  public function PreDnssecRemoval($vars) {
    // Do anything you want
    return ['queue' => 3600]; // Postpone for 1 hour
  }

  public function DnssecUpdate($vars) {
    // Do anything you want
  }

}

System API

use WHMCS\Module\Addon\SoluteDNS\System\Api;
$api = new Api();

Assign Entry

Assigns a new entry to the SoluteDNS index.
$api->assign_index(string, string, int, int);

Attributes:

domainstring
Zone name
typestring
Zone type d p s r
client_idint
Client User ID [optional]
local_idint
Domain or Product/Service ID [optional]
$domain = 'example.com';
$type = 'd';
$client_id = 22;
$local_id = 1239;
boolean
Clear Entry

Clears indexed zone and all local stored (cached) information.
$api->clear_index(string);

Attributes:

domainstring
Zone name
$domain = 'example.com';
NULL
Apply Template

Applies template records to zone.
$api->apply_template(string, int, string);

Attributes:

domainstring
Zone name
idstring
Template ID or Client ID when mode is set to client.
modestring
client or null [optional]
$domain = 'example.com';
$id = '2';
$mode = NULL;
'success' => array {
  [0]=> array {
    'id' => '2315'
    'type' => 'A'
    'content' => '192.168.2.1'
    'name' => 'example.com'
    'prio' => '0'
    ttl' => '3600'
  }
}
DNS
'errors' => array {
  [0]=> array {
    'record' =>  array {
      'type' => 'A'
      'content' => '192.168.2.999'
      'name' => 'example.com'
      'prio' => '0'
      'ttl' => '3600'
    }
    'code' => 'INVALID_IPV6'
    'field' => 'content'
    'desc' => 'IPv4 address does not seem to be valid.'
  }
}

System
array {
  'error' => array {
    'code' => 3001
    'desc' => 'Zone could not be found.'
  }
}

Language Overrides

When you make customizations to included language files they’re overwritten when you update SoluteDNS. To stop this you can use override files.

In the folder: lang/override/ you need to create a file equal named to the main language file.

You can add custom language in this file. To override existing language values you can simply copy the language variable to the override file.

lang/english.php

$_ADDONLANG['client_title_permission'] = "Access denied!";

lang/override/English.php

$_ADDONLANG['client_title_permission'] = "Oops, you are not allowed to access the given zone.";

Reverse Record Management

If you wish to grant clients access to reverse records without providing access to the reverse zone you can assign reverse records to clients.

IP Assignment

You can assign/unassigned IP’s to clients by editing the following database table: mod_solutedns_reverse When adding a new assignment you are required to add data to the following columns:


Column: Type: Description:
client_id Int ID of the client.
record_id Int The record id which belongs to the IP. You can add multiple records by separating them whit a comma (,).
ip String The IP for which this hostname is reverse. You can add anything you like. This is only for simple recognition by your client.

When the row is added correctly and reverse record management for clients is enabled the client can now set a reverse hostname for its assigned IP addresses.

The Automatic Reverse IP Assignment addon module provides basic automation/management of reverse assignments. Learn More

Configuration file

To enable/disable specific features you can add an config.php file to the solutedns module directory.

Options

Column: Type: Description:
core_dir String Set a custom directory for the core’s location.
debug Boolean Enable debug modes
<?php

if (!defined("WHMCS")) {
    http_response_code(404);
}

return (object) [
    'core_dir' => 'home\solutedns\Core',
    'debug' => true,
];