Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
syno:dsm6inst [2022/09/24 21:37] – [Services and Packet Installation] Bernard Condrausyno:dsm6inst [2022/11/18 00:59] – [DDNS over Namecheap] Bernard Condrau
Line 18: Line 18:
   - To setup SSL, import __server.key__, __domain.crt__, and __domain.intermediate.crt__ through //Control Panel --> Security --> Certificate --> Add//. Right click on the new certificate, "Edit" to make it default, "Configure" to assign it to services. Detailed instructions see [[https://miketabor.com/secure-synology-nas-install-ssl-certificate/|Secure your Synology NAS, install a SSL certificate]] and [[https://www.sslshopper.com/how-to-move-or-copy-an-ssl-certificate-from-one-server-to-another.html|How to Move or Copy an SSL Certificate from one Server to Another]].   - To setup SSL, import __server.key__, __domain.crt__, and __domain.intermediate.crt__ through //Control Panel --> Security --> Certificate --> Add//. Right click on the new certificate, "Edit" to make it default, "Configure" to assign it to services. Detailed instructions see [[https://miketabor.com/secure-synology-nas-install-ssl-certificate/|Secure your Synology NAS, install a SSL certificate]] and [[https://www.sslshopper.com/how-to-move-or-copy-an-ssl-certificate-from-one-server-to-another.html|How to Move or Copy an SSL Certificate from one Server to Another]].
   - Add Two-factor-authentication to your admin user. Select **Options -> Personal** on the top right of the DSM window. Settings are saved in<code>/usr/syno/etc/preference/username/google_authenticator</code>   - Add Two-factor-authentication to your admin user. Select **Options -> Personal** on the top right of the DSM window. Settings are saved in<code>/usr/syno/etc/preference/username/google_authenticator</code>
 +
 +===== DDNS over Namecheap =====
 +  * Add the host to be accessed with DDNS to your domain's //Advanced DNS --> Dynamic DNS// in Namecheap
 +  * Make sure you installed php-curl and php-xml in your [[deb11:apache#php_installation|Apache 2.4 and PHP 7/8]] installation
 +  * Add the following script to your webserver:<code><?php
 +try {
 +        $url = 'https://dynamicdns.park-your-domain.com/update?host='.$_GET['host'].'&domain='.$_GET['domain'].'&password='.$_GET['password'].'&ip='.$_GET['ip'];
 +
 +        // with allow_url_fopen enabled
 +        $output = file_get_contents($url);
 +
 +        // with curl
 +        //$req = curl_init();
 +        //curl_setopt($req, CURLOPT_URL, $url);
 +        //curl_setopt($req, CURLOPT_RETURNTRANSFER, true);
 +        //curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-type: text/xml'));
 +        //$output = curl_exec($req);
 +        //curl_close($req);
 +
 +        $xml = new SimpleXMLElement(trim(str_replace("encoding=\"utf-16\"","",$output)));
 +        if ($xml->ErrCount > 0) {
 +                $error = $xml->errors[0]->Err1;
 +                if (strcmp($error, "Domain name not found") === 0) {
 +                        echo "nohost";
 +                } elseif (strcmp($error, "Passwords do not match") === 0) {
 +                        echo "badauth";
 +                } elseif (strcmp($error, "Passwords is empty") === 0) {
 +                        echo "badauth";
 +                } elseif (strcmp($error, "No Records updated. A record not Found;") === 0) {
 +                        echo "nohost";
 +                } else {
 +                   echo "911 [".$error."]";
 +                }
 +        } else {
 +                echo "good";
 +        }
 +} catch (Exception $e) {
 +    echo "911 [".$e->getMessage()."]";
 +}</code>
 +  * Make sure the DDNS update call is allowed by your webserver. For apache, add this to the conf:<code><RequireAny>
 +Require expr "%{QUERY_STRING} =~ /your Namecheap DDNS password/" # allow the DDNS updater to run from the changed ip address
 +Require forward-dns host.domain.tld # allow access from the DDNS domain name after updating the ip address
 +</RequireAny></code>
 +  * Create a custom DDNS updater in Synology DSM with the following //Query URL//:<code>https://vps.condrau.com/html/ddns-namecheap.php?host=__USERNAME__&domain=__HOSTNAME__&password=__PASSWORD__&ip=__MYIP__</code>
 +  * [[https://code-bude.net/2022/02/16/namecheap-com-ddns-in-synology-dsm-einrichten/|Namecheap.com DDNS in Synology DSM einrichten]]
 +  * [[https://www.namecheap.com/support/knowledgebase/article.aspx/29/11/how-to-dynamically-update-the-hosts-ip-with-an-http-request/|How to dynamically update the host's IP with an HTTP request?]]
  
 ===== Certificates ===== ===== Certificates =====