Dns_Module

+------------------------------------------------------------+ | apnscp | +------------------------------------------------------------+ | Copyright (c) Apis Networks | +------------------------------------------------------------+ | Licensed under Artistic License 2.0 | +------------------------------------------------------------+ | Author: Matt Saladna (msaladna@apisnetworks.com) | +------------------------------------------------------------+
extends Module_Support_Dns uses NamespaceUtilitiesTrait
Methods Summary
public
# __construct( )
{{{ void __construct(void)

Overrides

public
# _proxy( )
Provider loader
public
# get_provider( )
Get DNS provider
public
# uuid( )
Get DNS UUID for host
public
# uuid_name( )
Get DNS UUID record name
public
# configured( )
DNS is configured for account
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 Used in multi-server layouts
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 )
Query WHOIS server for record
public
# zone_exists( string $zone )
DNS zone exists
public
# export( string $zone = NULL )
Export zone configuration in BIND-friendly notation
public
# permitted_records( )
Get permitted records for DNS provider
protected
# owned_zone( string $zone )
Requested domain is manageable by the account
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( string $domain = NULL )
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( string $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
protected
# canonicalizeRecord( string & $zone , string & $subdomain , string & $rr , string & $param , int & $ttl = NULL )
Fixup a DNS record before submitting
public
# modify_record( string $zone , string $subdomain , string $rr , string $parameter , array $newdata )
Modify a DNS record
protected
# atomicUpdate( string $zone , Opcenter\Dns\Record $old , Opcenter\Dns\Record $newdata )
Perform an atomic update of a record allowing reversion on failure
public
# record_exists( string $zone , string $subdomain , string $rr = 'ANY', string $parameter = NULL )
DNS record exists
public
# add_zone( string $domain , string $ip )
Add zone to DNS server
public
# add_zone_backend( string $domain , string $ip )
Create DNS zone privileged mode
public
# remove_zone( string $domain )
Remove a zone from DNS management
public
# remove_zone_backend( string $domain )
Remove zone from nameserver
public
# ip_allocated( $ip )
Check whether IP is assigned Assigned IP addresses will have PTRs. Unassigned will be empty.
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 $domain = NULL )
array get_zone_information (string) Reads zone information for a given domain on the nameservers.
public
# import_from_ns( string $domain , string $nameserver , string|null $key = NULL )
Import zone data for domain, overwriting configuration on server
public
# import( string $domain , string $axfr )
Import raw AXFR records into zone
public
# remove_record( string $zone , string $subdomain , string $rr , string $param = NULL )
bool remove_record (string, string) Removes a record from a zone.
public
# release_ip( string $ip )
protected
# get_zone_data( string $domain )
Get all zone records parsed
public
# get_default( string $key )
Get module default
protected
# zoneAxfr( string $domain )
Perform a full zone transfer
protected
# hasCnameApexRestriction( )
Abides by DNS RFC that restricts DNS records from having an apex CNAME See also RFC 1034 section 3.6.2
public
# provisioning_records( string $zone )
Get provisioning DNS records to setup automatically
protected
# __deleteIP( string $ip , string $domain = NULL )
Release PTR assignment from an IP
protected
# __addIP( string $ip , string $hostname = '' )
Add an IP address to hosting
protected
# __changePTR( string $ip , string $hostname , string $chk = '' )
Change PTR name
public
# _delete( )
public
# _create( )
public
# _edit( )
protected static
# createRecord( string $zone , array $data = array ( ) )
Create a record using appropriate driver
public
# _verify_conf( Opcenter\Service\ConfigurationContext $ctx )
public
# _create_user( string $user )
public
# _delete_user( string $user )
public
# _edit_user( string $userold , string $usernew , array $oldpwd )
Methods inherited from Module_Support_Dns
addCache(), getCacheKey(), getZoneId(), getRecordId()
Methods inherited from Module\Skeleton\Standard
__construct(), __wakeup(), autoloadModule(), setUserParameters(), cleanUserParameters(), setSessionId(), _invoke(), __debugInfo(), getExportedFunctions(), _reset(), getServices(), getNewServices(), getActiveServices(), getConfig(), getServiceValue(), setConfigJournal(), setConfig(), query(), _resetModule()
Methods used from NamespaceUtilitiesTrait trait
getNamespace() getBaseClassName() appendNamespace()
Constants Summary
public array DEPENDENCY_MAP
# array ( 0 => 'siteinfo', )
protected boolean HAS_ORIGIN_MARKER
apex markers are marked with @
# false
public string MASTER_NAMESERVER
primary nameserver
# ''
public string AUTHORITATIVE_NAMESERVER
# '127.0.0.1'
public array RECURSIVE_NAMESERVER
# array ( 0 => '127.0.0.1', )
public string UUID_RECORD
# '_apnscp_uuid'
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_Support_Dns
DEPENDENCY_MAP
Constants inherited from Module\Skeleton\Standard
DEPENDENCY_MAP
Properties Summary
protected static array $zoneExistsCache
# array ( )
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 permitted by provider 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_Support_Dns
$zoneCache
Properties inherited from Module\Skeleton\Standard
$exportedFunctions, $username, $password, $domain, $user_id, $group_id, $permission_level, $session_id, $site, $site_id, $pgsql, $mysql
Properties used from NamespaceUtilitiesTrait