Please contact me if you can't get it working.  There are a lot of steps, I
may have forgotten something. ron@vnetworx.net

 1. Create a new DNS zone in PowerDNS
-------------------------------------------------------------------------------
 It is highly advised you create a new DNS zone for your dynamic DNS service.
 If your domain name is example.com, dyn.example.com would be a good choice.
 PowerDynDNS should be given exclusive use of this DNS Zone.
   
 Create this zone as you normally would, except do not add any records to it
 yet, and do not add it to any secondary nameservers yet.

 You should not set up this zone any further until after configuring
 PowerDynDNS and running powerdyndns-control --change-soa-format .


 2. Installing PowerDynDNS
-------------------------------------------------------------------------------
 Make sure you meet the technical requirements for PowerDynDNS.  First, and
 foremost, you need to be using PowerDNS, and the zone you intend to use with
 PowerDynDNS needs to be served from a MySQL/MariaDB database.

 You need PHP that is at least version 7.3.  It needs to be available as both
 CLI, and to a Web server that can execute PHP scripts.  Both versions need to
 have PHP-PCRE available (virtually all do).  The CLI version also needs
 PHP-Sockets, and PHP-PCNTL.

 If you want to decouple the dynamic DNS service from the DNS zone's primary
 PowerDNS server and/or database, you should first install the PowerDNS Simple
 API, which can be found at https://gothamcode.com/pdns-api  You will then need
 to generate an API key that is authorized to modify the DNS zone you're going
 to use with PowerDynDNS.

 Then run: ./install.sh webusername /path/to/web/site

 webusername is the user the PHP script runs as.  This user needs to have write
 access to /path/to/web/site/cache in order to cache the compiled Web templates.
 Caching is not required but greatly improves performance.

 This copies the PowerDynDNS web application to /path/to/web/site, and copies
 powertinydyndns and powerdyndns-users to /usr/local/sbin .  It will also
 create /etc/powerdyndns and copy powerdyndns.conf-sample.php to
 /etc/powerdyndns/powerdyndns.conf.php if that file does not already exist.


 3. Configure PowerDynDNS
-------------------------------------------------------------------------------
 Edit /etc/powerdyndns/powerdyndns.conf.php

 The standard ports for POP3 are 110 (insecure and starttls), and 995 (tls).
 To activate the insecure port, set $insecure to TRUE.  If you don't define a
 port number for the insecure port, it will default to port 110.

 To activate STARTTLS on the insecure port, set $starttls to TRUE.

 To activate the TLS port, set $tls to TRUE.  If you don't define a port number
 for the TLS port, it will default to port 995.

 To activate the service on all network interfaces, use $address 0.0.0.0

 $debug Controls debugging messages. (TRUE or FALSE).

 $syslog Controls logging to syslog (TRUE or FALSE).

 $logfile  TRUE or FALSE or pathname, if TRUE, defaults to:
    /var/log/powerdyndns/powerdyndns-YYYY-MM.log

 $register Controls whether public registration is open. (TRUE or FALSE)

 $dynzone Is the domain name the dynamic hosts are created in, 
 ie: for "name.dyn.example.com", "dyn.example.com" is the $dynzone.

 $servicedomain Is the domain name PowerDynDNS or PowerTinyDynDNS is
 reachable at.

 $serviceurl Is any additional URL beyond $servicedomain PowerDynDNS is
 found at.

 $mailfrom Is the email address mail from the service is sent by.

 $dbhost Is the MySQL/MariaDB host.

 $dbuser Is the MySQL/MariaDB username.

 $dbname Is the MySQL/MariaDB database name of PowerDynDNS and PowerTinyDynDNS.

 $dbpass Is the MySQL/MariaDB user's password.

 $usertable Is the MySQL/MariaDB dynamic DNS users table.

 $policytable Is the MySQL/MariaDB dynamic DNS policy table.

 $tokentable Is the MySQL/MariaDB dynamic DNS authorization tokens table.

 $soaformat should be set to 'epoch' for best results.

 $dnsaccess is either 'db' or 'api'.  Using the API allows you to decouple the
 dynamic DNS service from direct access to the PowerDNS primary server, but 
 requires the use of the PowerDNS Simple API.  Default: db

 $pdnsapikey Is a PowerDNS Simple API token.  If used, this token needs
 authorization to modify the dynamic DNS zone.

 $pdnsapiurl If used, is the URL the PowerDNS Simple API is found at.

 $checkip Is a URL to a service that returns the user's current public IP
 address, and nothing more.

 $logpw Logs all passwords used.  This should only be used for debugging.

 $logpwfail Logs all failed passwords.  This should only be used for debugging.

 $verbose TRUE or FALSE, controls verbose output when running PowerTinyDynDNS
 in the foreground.

 $maxclients is the maximum number of clients that can be simultaneously
 connected.  This number should be relatively small, as clients are only
 conected long enough to log in, be told there is no mail, and immediately
 log out.

 $daemonize Controls daemonization of PowerTinyDynDNS, TRUE or FALSE. FALSE is
 the appropriate setting when running PoweTinyDynDNS under systemd.

 $hostname Hostname used by TinyDynDNS default: system hostname

 $address Address PowerTinyDynDNS listens on, default: 0.0.0.0 (all interfaces)

 $insecure Whether or not PowerTinyDynDNS opens an unencrypted port.
 TRUE or FALSE. default: FALSE

 $starttls Whether or not PowerTinyDynDNS uses STARTTLS on an insecure port.
 TRUE or FALSE. default: FALSE

 $tls Whether or not PowerTinyDynDNS opens a TLS port. default: FALSE

 $insecureport Port number PowerTinyDynDNS uses for an insecure port.
 default: 110

 $secureport Port number PowerTinyDynDNS uses for a TLS port.  default: 995

 $sslkey Pathname to the key file PowerTinyDynDNS uses for TLS.

 $sslcert Pathname to the full certificate chain PowerTinyDynDNS uses for TLS.

 $runasuser PowerTinyDynDNS needs to start as the superuser/root, in order to
 open privileged ports, but then drops to this unprivileged user.

 $socktimeout is the number of seconds PowerTinyDynDNS waits for a socket
 connection to complete.

 $sesstimeout is the number of seconds of idle time PowerTinyDynDNS waits
 before a session is automatically terminated.

 EXAMPLE:
   <?php
   $debug = TRUE;
   $syslog = TRUE;
   $logfile = TRUE;
   $register = TRUE;
   $dynzone = 'dyn.vnetworx.net';
   $servicedomain = 'dyn.vnetworx.net';
   $serviceurl = '/';
   $mailfrom = 'service@dyn.vnetworx.net';
   $dbhost = '127.0.0.1';
   $dbuser = 'pdns';
   $dbname = 'pdns';
   $dbpass = 'password';
   $usertable = 'dynusers';
   $hosttable = 'dynhosts';
   $policytable = 'dynpolicy';
   $tokentable = 'dyntokens';
   $dnsaccess = 'api'; // db or api, default db
   $pdnsapikey = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';
   $pdnsapiurl = 'https://dns.example.com/powerdnsapi';
   $checkip = 'https://dyn.example.com/checkip';
   $logpw = FALSE;
   $logpwfail = FALSE;

   ############ PowerTinyDynDNS-specific settings ############

   $verbose = TRUE;
   $maxclients = 15;
   $daemonize = FALSE;
   $hostname = $dynzone;
   $address = '0.0.0.0';
   $insecure = TRUE;
   $starttls = TRUE;
   $tls = TRUE;
   $insecureport = 110;
   $secureport = 995;
   $sslkey = '/etc/ssl/dehydrated/example.com/privkey.pem';
   $sslcert = '/etc/ssl/dehydrated/example.com/fullchain.pem';
   $runasuser = 'nobody';
   $socktimeout = 10;
   $sesstimeout = 60;


 4. Changing your SOA record's serial number format
-------------------------------------------------------------------------------
 Many things that were a reasonable idea 40 years ago, aren't still today.
 The commonly used SOA serial format of YYYYMMDDVV is one such thing.
 
 YYYY is the year, MM the month, and VV is the version number.  This limits you
 to a maximum of 99 updates per-day, very unsuitable for a dynamic DNS service.

 PowerDynDNS automatically detects which of the common serial formats is 
 in-use, and continues using it.  But it is highly recommended that you change
 the SOA serial format for your dynamic DNS service to use the Unix Epoch.

 To change the format used for your dynamic DNS zone, do this on the zone 
 primary PowerDNS server:

    powerdyndns-control --change-soa-format
    pdnsutil set-meta dyn.example.com SOA-EDIT EPOCH

Changing to the recommended 'epoch' format (or 'serial') for a pre-existing
zone is likely to cause zone transfers for your dynamic DNS zone to stop,
one reason why it is highly suggested you create a new zone.

If you absolutely must use an existing zone, to remedy this, issue the
following command on each of your PowerDNS secondary servers for the
zone:

    pdns_control retrieve dyn.example.com


 5. Complete configuring zone if you created a new one
-------------------------------------------------------------------------------
If as advised, you created a new zone for your dynamic DNS service, you should
now finish configuring it, by adding name server records and PowerDNS secondary
servers.


 6. Create database (if needed) and create PowerDynDNS tables
-------------------------------------------------------------------------------
 If you are not using the PowerDNS database direcly, you'll need to create a
 database for PowerDynDNS to use.  You'll also need to create the PowerDynDNS
 tables if they don't already exist.

 Create the database and database user, grant the user all privileges to the
 database.  Then run:

    powerdyndns-control --database-setup

 This will create the tables if they don't exist, and update the tables for
 this version of PowerDynDNS if the tables need updating.
 

 7. Create PowerDynDNS users
-------------------------------------------------------------------------------
 You can now create PowerDynDNS users using powerdyndns-users.  You can view
 the man page or run powerdyndns-users --help for more information on how to
 do this.


 8. Start PowerTinyDynDNS (optional)
-------------------------------------------------------------------------------
 If you plan to use PowerTinyDynDNS, you can start it now.  A sample cron file
 and a sample systemd service file are included for your use.


 9. Try it out
-------------------------------------------------------------------------------
 PowerDynDNS (and PowerTinyDynDNS if used) should now be operational.


10. Edit templates if desired
-------------------------------------------------------------------------------
 All output intended for users from PowerDynDNS is stored in template files in
 the templates folder.  You can translate them into other languages if desired,
 but PowerDynDNS only supports the use of a single set of templates at this
 time.

 The template system is Star Templates.  For documentation about Star Templates
 please visit: https://gothamcode.com/star

See TEMPLATES for more information.
