How do I force DDNS updates (cron job)?



  • When my firewall restarts, if I'm not on top of it to manually force updates, only one of my DDNS entries will work and the rest will not update.

    I managed to work around this by having a Mac execute a Python mm…IDK if it's called a script or an app that updates Cloudflare. Through policy routing the script reaches Cloudflare using the right interface. I need now to add a second address to be updated and while adding VLANs or additional addresses to macOS is very easy, telling the script which route to take is not.

    I installed the Cron package to try to edit the jobs on pfSense but I found out it doesn't exactly run a binary but more like a PHP script/code:

    #!/usr/local/bin/php-cgi -f
    <?php
    /*
     * rc.dyndns.update
     *
     * part of pfSense (https://www.pfsense.org)
     * Copyright (c) 2004-2018 Rubicon Communications, LLC (Netgate)
     * All rights reserved.
     *
     * Licensed under the Apache License, Version 2.0 (the "License");
     * you may not use this file except in compliance with the License.
     * You may obtain a copy of the License at
     *
     * http://www.apache.org/licenses/LICENSE-2.0
     *
     * Unless required by applicable law or agreed to in writing, software
     * distributed under the License is distributed on an "AS IS" BASIS,
     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     * See the License for the specific language governing permissions and
     * limitations under the License.
     */
    
    require_once("config.inc");
    require_once("gwlb.inc");
    require_once("functions.inc");
    require_once("filter.inc");
    require_once("shaper.inc");
    
    /* Interface IP address has changed */
    
    if (isset($_GET['dyndns'])) {
    	$argument = $_GET['dyndns'];
    } else {
    	$argument = trim($argv[1], " \n");
    }
    
    if (empty($argument) || $argument == "all") {
    	services_dyndns_configure();
    	services_dnsupdate_process();
    } else {
    	$interface = lookup_gateway_interface_by_name($argument);
    	if (empty($interface)) {
    		$interface = $argument;
    	}
    	services_dyndns_configure($interface);
    	services_dnsupdate_process($interface);
    }
    
    ?>*
    

    I'm not a dev so I'm not a hundred sure but it seems to be tied to some condition. This being, I think, that the interface must change address or something to allow execution. So even if I were to modify the cron job to be executed more frequently it'd still not do anything because of the condition.

    It explains a lot because I've noticed once addresses have changed it won't try again to update until the firewall is gracefully restarted and has had no interface changes (like when moving it to a new host or something like that).

    How can I access directly the thing that sends the updates to the DNS servers?

    Thanks.


Log in to reply