Page MenuHomeVyOS Platform

"service dns dynamic" does now honor the "use-web" statement
Closed, DuplicatePublicBUG

Description

Initial report via forum https://forum.vyos.io/t/possible-bug-in-dyndns-service/2839

set service dns dynamic interface eth0 service noip host-name foo.bar.com
set service dns dynamic interface eth0 service noip login foo
set service dns dynamic interface eth0 service noip password foo1234567
set service dns dynamic interface eth0 service noip server update.bar.com
set service dns dynamic interface eth0 use-web url https://ipinfo.io/ip

Generates

[email protected]# show service dns
 dynamic {
     interface eth0 {
         service noip {
             host-name foo.bar.com
             login foo
             password foo1234567
             server update.bar.com
         }
         use-web {
             url https://ipinfo.io/ip
         }
     }
 }

With this client configuration file:

$ cat /etc/ddclient.conf

### Autogenerated by dynamic_dns.py ###
daemon=1m
syslog=yes
ssl=yes
pid=/var/run/ddclient/ddclient.pid
cache=/var/cache/ddclient/ddclient.cache

#
# ddclient configuration for interface "eth0":
#
use=if, if=eth0


# DynDNS provider configuration for foo.bar.com
protocol=noip
max-interval=28d
login=foo
password='foo1234567'
server=update.bar.com
foo.bar.com

Details

Difficulty level
Easy (less than an hour)
Version
1.2.0-rc6
Why the issue appeared?
Design mistake

Event Timeline

c-po changed the task status from Open to In progress.Nov 11 2018, 7:09 PM
c-po claimed this task.
c-po created this task.
c-po updated the task description. (Show Details)

Looks like this was always a bug. In the old Perl implementation the if clause was the same:
https://github.com/vyos/vyatta-cfg-system/blob/9b469f3c5734c086fc30b097405ea46ec2cee725/scripts/dynamic-dns/vyatta-dynamic-dns.pl#L223-L230

if ($web_url && $web_skip) {
    $output = "use=web, web=$web_url, web-skip='".$web_skip."'\n\n\n";
} else {
    $output = "use=if, if=$interface\n\n\n";
}

compared to the JINJA2 template nowadays:

{% if interface.web_url and interface.web_skip -%}
use=web, web={{ interface.web_url}}, web-skip={{ interface.web_skip }}
{% else -%}
use=if, if={{ interface.interface }}
{% endif -%}
c-po edited projects, added VyOS 1.2 Crux (VyOS 1.2.0-rc7); removed VyOS 1.2 Crux.
c-po changed Why the issue appeared? from Will be filled on close to Design mistake.