diff options
Diffstat (limited to 'packages')
-rw-r--r-- | packages/tinydns/tinydns.inc | 21 | ||||
-rw-r--r-- | packages/tinydns/tinydns_domains.xml | 17 |
2 files changed, 32 insertions, 6 deletions
diff --git a/packages/tinydns/tinydns.inc b/packages/tinydns/tinydns.inc index 7a27ca4c..97b30fd5 100644 --- a/packages/tinydns/tinydns.inc +++ b/packages/tinydns/tinydns.inc @@ -279,7 +279,7 @@ function tinydns_create_zone_file() { log_error("tinydns_get_backup_record returned $ipaddress "); } } - $record_data = tinydns_get_rowline_data($ipaddress, $domain['recordtype'], $ttl, $hostname); + $record_data = tinydns_get_rowline_data($ipaddress, $domain['recordtype'], $ttl, $hostname, $domain['rdns']); if($record_data) { fwrite($fd, $record_data . "\n"); } @@ -313,7 +313,8 @@ function tinydns_create_zone_file() { } /* formats data as a tinydns data row item */ -function tinydns_get_rowline_data($recordip, $recordtype, $ttl, $hostname) { +/* A full description of the data format is available at 'man tinydns-data' */ +function tinydns_get_rowline_data($recordip, $recordtype, $ttl, $hostname,$rdns) { if($ttl) $ttl_string = ":{$ttl}"; else @@ -325,15 +326,25 @@ function tinydns_get_rowline_data($recordip, $recordtype, $ttl, $hostname) { case "MX": $record_data = "@{$hostname}:{$recordip}::{$ttl_string}"; break; - case "A": - $record_data = "+{$hostname}:{$recordip}{$ttl_string}"; - break; case "PTR": + /* "^" creates "PTR" record only to allow reverse DNS */ + $record_data = "^{$hostname}:{$recordip}{$ttl_string}"; + break; + case "A": + /* "=" creates both "A" and "PTR" records to allow both forward and reverse DNS */ + if($rdns) $record_data = "={$hostname}:{$recordip}{$ttl_string}"; + else + /* "+" creates "A" records only to allow forward DNS */ + $record_data = "+{$hostname}:{$recordip}{$ttl_string}"; break; case "CNAME": $record_data = "C{$hostname}:{$recordip}{$ttl_string}"; break; + case "TXT": + /* "'" creates "TXT" record that can be used for SPF */ + $record_data = "'{$hostname}:{$recordip}{$ttl_string}"; + break; } return $record_data; } diff --git a/packages/tinydns/tinydns_domains.xml b/packages/tinydns/tinydns_domains.xml index acb39e8b..48466b8d 100644 --- a/packages/tinydns/tinydns_domains.xml +++ b/packages/tinydns/tinydns_domains.xml @@ -32,11 +32,19 @@ <fielddescr>Record type</fielddescr> <fieldname>recordtype</fieldname> </columnitem> + <columnitem> + <fielddescr>rDNS</fielddescr> + <fieldname>rdns</fieldname> + </columnitem> + <columnitem> + <fielddescr>IP Address</fielddescr> + <fieldname>ipaddress</fieldname> + </columnitem> </adddeleteeditpagefields> <fields> <field> <fieldname>hostname</fieldname> - <fielddescr>Domain name. Example: www.exampledomain.com</fielddescr> + <fielddescr>FQDN or Hostname www.exampledomain.com</fielddescr> <description>Enter the domain name that you would like to serve dns records for.</description> <required/> <type>input</type> @@ -59,6 +67,12 @@ </options> </field> <field> + <fielddescr>Automatic PTR entry</fielddescr> + <fieldname>rdns</fieldname> + <description>Create a reverse DNS (PTR) entry for this A record?</description> + <type>checkbox</type> + </field> + <field> <fieldname>ipaddress</fieldname> <fielddescr>IP Address or hostname that record points to</fielddescr> <description>Enter the IP Address that this record will point to (primary). The only exception is for NS type records where we expect a complete hostname to point to a A record.</description> @@ -129,3 +143,4 @@ tinydns_setup_ping_items(); </custom_php_resync_config_command> </packagegui> + |