Dns_Module

+------------------------------------------------------------+ | apnscp | +------------------------------------------------------------+ | Copyright (c) Apis Networks | +------------------------------------------------------------+ | Licensed under Artistic License 2.0 | +------------------------------------------------------------+ | Author: Matt Saladna (msaladna@apisnetworks.com) | +------------------------------------------------------------+
extends Module\Skeleton\Standard implements Module\Skeleton\Contracts\Proxied , Opcenter\Contracts\Hookable
Methods Summary
public
# __construct( )
{{{ void __construct(void)

Overrides

public
public
# get_provider( )
Get DNS provider
public
# domain_expiration( string $domain )
Query database for domain expiration On multi-server lookups that perform DNS lookups independent, perform batch lookups and pull those records from the database A return of 0 indicates failure null indicates unknown expiration
public
# get_all_domains( )
Fetches all domains across all servers
public
# get_server_from_domain( string $domain , bool $all = false )
Get server on which a domain is hosted
public
# get_parent_domain( string $domain )
Get primary domain affiliated with account In multi-server setups query the master DB to find domains whose invoice matches the parent invoice or domains that share the same site ID
public
# get_whois_record( string $domain )
string get_whois_record (string) Query WHOIS server for record

privilege


public
# export( string|null $zone = NULL )
Export zone configuration in BIND-friendly notation
protected
# owned_zone( string $zone )
Requested domain is manageable by the account
protected
# _get_zone_information_raw( string $domain )
Unauthenticated call for get_zone_information
protected
public
# get_records_external( string $subdomain = '', string $rr = 'any', string $domain = NULL, array $nameservers = NULL )
Get DNS record(s) from a third-party nameserver When using same nameservers as hosting ns, ensure ns uses split-view
public static
# record2const( string $rr )
Translate RR into PHP constant NB Used by DNS Manager
public
# gethostbyaddr_t( string $ip , int $timeout = 1000 )
Returns the host name of the Internet host specified by $ip with timeout
public
# gethostbyname_t( string $name , int $timeout = 1000 )
Returns the IP of the Internet host specified by $host with timeout
public
# domain_hosted( string $domain , bool $ignore_on_account = false )
Check whether a domain is hosted on any server In multi-server setups, use an aggregate database to log all domains across all servers and query that DB rather than domainmap
public
# domain_on_account( string $domain )
Domain exists and is under the account on a multi-server instance Useful when doing cross-server transfers to ensure the domain to add is part of the account, which will allow the domain to be added via the aliases_add_shared_domain @{see Aliases_Module::add_shared_domain} Implementation details are available on github.com/apisnetworks/apnscp-modules
public
# domain_uses_nameservers( string $domain )
Lookup and compare nameservers for domain to host
public
# get_hosting_nameservers( )
Get configured hosting nameservers Toggled via config.ini > [dns] > hosting_ns
public
# get_authns_from_host( string $host )
Get authoritative nameservers for given hostname Example response: Array ( [0] => Array ( [host] => ns2.apisnetworks.com [type] => A [ip] => 96.126.122.82 [class] => IN [ttl] => 83137 ) )
protected
# get_authns_from_host_recursive( string $host , Net_DNS2_Resolver $resolver , string $seen = '' )
Fallback authoritative NS lookup Crawl the entire TLD hierarchy to find the last known nameserver
public
# get_pending_expirations( int $days = 30, bool $showExpired = true )
Get recently expiring domains Sample response: Array( [0] => Array( 'domain' => 'apnscp.com', 'ts' => 1469937612 ) )
public
# check_zone( $zone , array $recs = array ( ) )
public
# update( string $hostname , string $ip = NULL )
Update hostname with caller's IP4 address
public
# get_records( string $subdomain = '', string $rr = 'any', string $domain = NULL )
Get DNS record(s)
protected
# _get_records_raw( string $subdomain = '', string $rr = 'any', string $domain = NULL )
get_records() unauthenticated DNS wrapper
public
# add_record( string $zone , string $subdomain , string $rr , string $param , int $ttl = 43200 )
Add a DNS record to a domain
public
# modify_record( string $zone , string $subdomain , string $rr , string $parameter , array $newdata )
Modify a DNS record
public
# record_exists( $zone , $subdomain , $rr = 'ANY', $parameter = NULL )
public
# release_ip( $ip , $domain = NULL )
Release IP into allocation pool
protected
# __deleteIP( $ip , string $domain = NULL )
Release PTR assignment from an IP
public
public
# remove_zone( string $domain )
Remove a zone from DNS management
public
public
# add_zone( string $domain , string $ip )
public
# add_zone_backend( string $domain , string $ip )
Create DNS zone privileged mode
protected
# __addIP( string $ip , string $hostname = '' )
Add an IP address to hosting
public
public
# ip_allocated( $ip )
Check whether IP is assigned Assigned IP addresses will have PTRs. Unassigned will be empty.
protected
# __changePTR( $ip , $hostname , string $chk = '' )
Change PTR name
public
# get_records_by_rr( string $rr , string $zone = NULL )
Query hosting nameservers for DNS records of named category {@see \get_zone_information()} example: Account has two MX records assigned, first the default MX on debug.com, and a second user-created MX on debug.debug.com. debug.debug.com was designated an e-mail domain through Mail Routing {@see \Email_Module::add_virtual_transport()} apis> $c->dns_get_records_by_rr("MX"); array(2) apis> array(2) { [0]=> array(4) { ["name"]=> string(10) "debug.com." ["class"]=> string(2) "IN" ["ttl"]=> string(5) "86400" ["parameter"]=> string(18) "10 mail.debug.com." } [1]=> array(4) { ["name"]=> string(16) "debug.debug.com." ["class"]=> string(2) "IN" ["ttl"]=> string(5) "86400" ["parameter"]=> string(24) "10 mail.debug.debug.com." } }
public
# get_zone_information( string|null $domain = NULL )
array get_zone_information (string) Reads zone information for a given domain on the nameservers.
public
# import_zone( string $domain , string $nameserver , string|null $key = NULL )
Import zone data for domain, overwriting configuration on server
public
# remove_record( string $zone , string $subdomain , string $rr , string $param = NULL )
bool remove_record (string, string) Removes a record from a zone.
protected
# __reverseIP( $ip )
Reverse an IP address
public
protected
# _getInterface( )
Get interface names to use with hosting
public
# _verify_conf( Opcenter\Service\ConfigurationContext $ctx )
public
public
public
# _edit_user( string $userold , string $usernew , array $oldpwd )
Methods inherited from Module\Skeleton\Standard
__construct(), set_user_parameters(), clean_user_parameters(), set_session_id(), _invoke(), __debugInfo(), getExportedFunctions(), _reset(), get_service_names(), get_services(), get_new_services(), get_active_services(), get_config(), get_service_value(), set_config_journal(), set_config(), query(), _resetModule()
Constants Summary
public string MASTER_NAMESERVER
primary nameserver
# ''
public string AUTHORITATIVE_NAMESERVER
# '127.0.0.1'
public string RECURSIVE_NAMESERVER
# '127.0.0.1'
public int DYNDNS_TTL
# 300
public int DNS_TTL
# 43200
public string IP_ALLOCATION_BLOCK
# ''
public string HOSTS_FILE
# '/etc/hosts'
Constants inherited from Module\Skeleton\Standard
DEPENDENCY_MAP
Properties Summary
protected static string $dns_key
# ''
protected static $rec_2_const
mapping of RR types to constants
# array ( 'ANY' => 268435456, 'A' => 1, 'AAAA' => 134217728, 'MX' => 16384, 'NS' => 2, 'SOA' => 32, 'TXT' => 32768, 'CNAME' => 16, 'SRV' => 33554432, 'PTR' => 2048, 'HINFO' => 4096, 'A6' => 16777216, 'NAPTR' => 67108864, 'CAA' => 8192, )
protected static $nameservers
array of 1 or more nameservers used
# NULL
protected static array $permitted_records
Legal DNS resource records A AAAA MX CNAME DNAME HINFO TXT NS SRV
# array ( 0 => 'a', 1 => 'aaaa', 2 => 'mx', 3 => 'cname', 4 => 'dname', 5 => 'hinfo', 6 => 'txt', 7 => 'ns', 8 => 'srv', 9 => 'a6', 10 => 'naptr', 11 => 'any', 12 => 'soa', 13 => 'caa', )
Properties inherited from Module\Skeleton\Standard
$exportedFunctions, $username, $password, $domain, $user_id, $group_id, $permission_level, $session_id, $site, $site_id, $pgsql, $mysql