openwrt / packages

Community maintained packages for OpenWrt. Documentation for submitting pull requests is in CONTRIBUTING.md
GNU General Public License v2.0
4.03k stars 3.5k forks source link

ddns-scripts [nsupdate]: impossible to configure nsupdate with ipv6 without (a single) forced update #17641

Open WildPenquin opened 2 years ago

WildPenquin commented 2 years ago

Maintainer: feckert Environment: 21.02.1

Description:

It is impossible to configure ddns-scripts-nsupdate for IPv6 protocol so that no forced updates happen and the ip address is till checked at intervals. Also, a client can not be configured so that it is ran once without a forced update. This is because run-once is always enabled if and only if forced_interval=0. If forced_interval!=0, there will always be forced updates at the specified unit intervals. There is actually no way to disable forced updates! See: https://openwrt.org/docs/guide-user/services/ddns/client .

This is in conflict of nsupdate terms. They are very adamant on not updating the IP address if it has not been changed; from nsupdate.info documentation:

Note: please do not “update” your IP address if it did not change. Doing so is considered abusive use of the service. All sane dyndns2 clients only send an update if the IP address has changed.

Running the forced update when IP has not changed can cause an abuse flag to be enabled for the client.

Though, I'm not sure whether this will be an issue if the client sets a forced update, say, every 31th day. For cleanness sake, there should probably be a separate setting for run-once and no forced updates, although this workaround exists. There is no workaround for users who might want or need a run-once non-forced update.

EDIT2: Clarified my wording, it was not quite what the problem is.

WildPenquin commented 2 years ago

A log snippet demonstrating a forced update when setting forced_interval=0 (also containing my configuration):

$ dog mylogsnippet.log 
 205922       : ************ ************** ************** **************
 205922  note : PID '25878' started at 2022-01-18 20:59
 205922       : ddns version  : 2.8.2-12
 205922       : uci configuration:
ddns.nspudate.cacert='/etc/ssl/certs'
ddns.nspudate.check_interval='40'
ddns.nspudate.check_unit='minutes'
ddns.nspudate.domain='[MYHOSTNAME_REDACTED]'
ddns.nspudate.enabled='1'
ddns.nspudate.force_interval='0'
ddns.nspudate.force_unit='hours'
ddns.nspudate.interface='br-lan'
ddns.nspudate.ip_interface='br-lan'
ddns.nspudate.ip_source='interface'
ddns.nspudate.lookup_host='[MYHOSTNAME_REDACTED]'
ddns.nspudate.password='***PW***'
ddns.nspudate.retry_count='10'
ddns.nspudate.retry_interval='15'
ddns.nspudate.retry_unit='minutes'
ddns.nspudate.service_name='nsupdate.info'
ddns.nspudate.use_https='1'
ddns.nspudate.use_ipv6='1'
ddns.nspudate.use_syslog='2'
ddns.nspudate.username='[MYHOSTNAME_REDACTED]'
ddns.nspudate=service
 205923       : verbose mode  : 0 - run normal, NO console output
 205924       : check interval: 2400 seconds
 205924       : force interval: 0 seconds
 205924       : retry interval: 900 seconds
 205924       : retry counter : 10 times
 205925       : No old process
 205925       : last update: 2022-01-18 18:52
 205925       : Detect registered/public IP
 205925       : #> /usr/bin/host -t AAAA [MYHOSTNAME_REDACTED]  >/var/run/ddns/nspudate.dat 2>/var/run/ddns/nspudate.err
 205926       : Registered IP '[MYIPV6PREFIX_REDACTED]::1' detected
 205926  info : Starting main loop at 2022-01-18 20:59
 205926       : Detect local IP on 'interface'
 205926       : #> ip -o addr show dev br-lan scope global >/var/run/ddns/nspudate.dat 2>/var/run/ddns/nspudate.err
 205926       : Local IP '[MYIPV6PREFIX_REDACTED]::1' detected on interface 'br-lan'
 205927       : Forced Update - L: '[MYIPV6PREFIX_REDACTED]:0000:0000:0000:0001' == R: '[MYIPV6PREFIX_REDACTED]:0000:0000:0000:0001'
 205927       : #> /usr/bin/curl -RsS -o /var/run/ddns/nspudate.dat --stderr /var/run/ddns/nspudate.err --capath /etc/ssl/certs --noproxy '*' 'https://[MYHOSTNAME_REDACTED]:***PW***@ipv6.nsupdate.info/nic/update?hostname=[MYHOSTNAME_REDACTED]&myip=[MYIPV6PREFIX_REDACTED]:0000:0000:0000:0001'
 205927       : DDNS Provider answered:
good [MYIPV6PREFIX_REDACTED]:0000:0000:0000:0001
 205927  info : Forced update successful - IP: '[MYIPV6PREFIX_REDACTED]:0000:0000:0000:0001' send
 205928       : Waiting 2400 seconds (Check Interval)
 213928       : Detect registered/public IP
 213928       : #> /usr/bin/host -t AAAA [MYHOSTNAME_REDACTED]  >/var/run/ddns/nspudate.dat 2>/var/run/ddns/nspudate.err
 213928       : Registered IP '[MYIPV6PREFIX_REDACTED]::1' detected
 213928  info : Configured to run once
 213929  note : PID '25878' exit normal at 2022-01-18 21:39

To elaborate:

Steps to reproduce: set forced_interval=0

Observed behavior: the scripts runs once with a forced update!

Expected behavior: The script should run at check intervals. Alternatively, it should run once without a forced update (i.e. not update if IP address has not changed). It should definitely not do a forced update.