From 5889adf0cd50a54c02b781c8db97ddca93be6be5 Mon Sep 17 00:00:00 2001 From: Brian <165865819+brianshea2@users.noreply.github.com> Date: Wed, 1 Jan 2025 23:47:24 -0500 Subject: [PATCH 1/3] add myaddr.tools dynamic dns service --- README.md | 1 + ddclient.conf.in | 7 ++++++ ddclient.in | 64 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 72 insertions(+) diff --git a/README.md b/README.md index 22db499..f517737 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,7 @@ Dynamic DNS services currently supported include: * [Infomaniak](https://faq.infomaniak.com/2376) * [INWX](https://www.inwx.com/) * [Loopia](https://www.loopia.se) + * [Myaddr](https://myaddr.tools) * [Mythic Beasts](https://www.mythic-beasts.com/support/api/dnsv2/dynamic-dns) * [NameCheap](https://www.namecheap.com) * [NearlyFreeSpeech.net](https://www.nearlyfreespeech.net/services/dns) diff --git a/ddclient.conf.in b/ddclient.conf.in index dd4189e..d760826 100644 --- a/ddclient.conf.in +++ b/ddclient.conf.in @@ -228,6 +228,13 @@ pid=@runstatedir@/ddclient.pid # record PID in file. # password=my-token # myhost.example.com +## +## Myaddr (myaddr.tools) +## +# protocol=myaddr +# password=key +# name-used-for-logging-only + ## ## MyOnlinePortal (http://myonlineportal.net) ## diff --git a/ddclient.in b/ddclient.in index a834b16..776d885 100755 --- a/ddclient.in +++ b/ddclient.in @@ -1142,6 +1142,15 @@ our %protocols = ( 'script' => setv(T_STRING, 0, '/nic/update', undef), }, ), + 'myaddr' => ddclient::Protocol->new( + 'update' => \&nic_myaddr_update, + 'examples' => \&nic_myaddr_examples, + 'cfgvars' => { + %{$cfgvars{'protocol-common-defaults'}}, + 'login' => undef, + 'server' => setv(T_FQDNP, 0, 'myaddr.tools', undef), + }, + ), 'mythicdyn' => ddclient::Protocol->new( 'update' => \&nic_mythicdyn_update, 'examples' => \&nic_mythicdyn_examples, @@ -5623,6 +5632,61 @@ sub nic_henet_update { } } +###################################################################### +## nic_myaddr_examples +###################################################################### +sub nic_myaddr_examples { + my $self = shift; + return <<"EoEXAMPLE"; +o 'myaddr' + +The 'myaddr' protocol is used by the DNS service offered by myaddr.tools. + +Configuration variables applicable to the 'myaddr' protocol are: + protocol=myaddr + password=key ## the private key corresponding to the domain to + ## update + name-used-for-logging-only ## a name (not used by the service; the above key + ## uniquely identifies the domain to update) + +Example ${program}.conf file entries: + protocol=myaddr, \\ + password=6bcf18a592bbc85bcee439e1e42def483ff3ef632a84df7ece5ff072f72887c1, \\ + myname.myaddr.tools + +EoEXAMPLE +} + +###################################################################### +## nic_myaddr_update +###################################################################### +sub nic_myaddr_update { + my $self = shift; + for my $group (group_hosts_by(\@_, qw(password server wantipv4 wantipv6))) { + local $_l = pushlogctx(join(',', @{$group->{hosts}})); + my $key = $group->{cfg}{password}; + my $server = $group->{cfg}{server}; + for my $v (4, 6) { + delete $config{$_}{"wantipv$v"} for @{$group->{hosts}}; + my $ip = $group->{cfg}{"wantipv$v"}; + next if !$ip; + info("setting IPv$v address to $ip"); + my $reply = geturl( + proxy => opt('proxy'), + url => "https://$server/update?key=$key&ip=$ip", + ); + next if !header_ok($reply); + # a 200 response indicates success + for my $h (@{$group->{hosts}}) { + $recap{$h}{mtime} = $now; + $recap{$h}{"ipv$v"} = $ip; + $recap{$h}{"status-ipv$v"} = 'good'; + } + success("IPv$v address set to $ip"); + } + } +} + ###################################################################### ## nic_mythicdyn_examples ## From 3c70c18c06a3e31a93bc4021429c78bdca393cc3 Mon Sep 17 00:00:00 2001 From: Brian <165865819+brianshea2@users.noreply.github.com> Date: Thu, 9 Jan 2025 23:17:58 -0500 Subject: [PATCH 2/3] myaddr: add ChangeLog entry --- ChangeLog.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ChangeLog.md b/ChangeLog.md index 579f686..bcec842 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -16,6 +16,11 @@ repository history](https://github.com/ddclient/ddclient/commits/main). special characters are preserved literally. [#766](https://github.com/ddclient/ddclient/pull/766) +### New features + + * `myaddr`: New `protocol` option for updating [myaddr](https://myaddr.tools/) + records. [#785](https://github.com/ddclient/ddclient/pull/785) + ## 2025-01-07 v4.0.0-rc.2 ### Breaking changes From f4d11644e73fb7678decd38b6f32f8c343b8cf10 Mon Sep 17 00:00:00 2001 From: Brian <165865819+brianshea2@users.noreply.github.com> Date: Thu, 9 Jan 2025 23:24:08 -0500 Subject: [PATCH 3/3] myaddr: simplify docs --- ddclient.conf.in | 4 ++-- ddclient.in | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ddclient.conf.in b/ddclient.conf.in index 02c4158..8d61313 100644 --- a/ddclient.conf.in +++ b/ddclient.conf.in @@ -235,8 +235,8 @@ pid=@runstatedir@/ddclient.pid # record PID in file. ## Myaddr (myaddr.tools) ## # protocol=myaddr -# password=key -# name-used-for-logging-only +# password=private-key +# myname.myaddr.tools ## ## MyOnlinePortal (http://myonlineportal.net) diff --git a/ddclient.in b/ddclient.in index e6662a7..fc55a21 100755 --- a/ddclient.in +++ b/ddclient.in @@ -5647,15 +5647,15 @@ The 'myaddr' protocol is used by the DNS service offered by myaddr.tools. Configuration variables applicable to the 'myaddr' protocol are: protocol=myaddr - password=key ## the private key corresponding to the domain to + password=private-key ## the private key corresponding to the domain to ## update - name-used-for-logging-only ## a name (not used by the service; the above key + myname.myaddr.tools ## a name (not used by the service; the above key ## uniquely identifies the domain to update) Example ${program}.conf file entries: protocol=myaddr, \\ password=6bcf18a592bbc85bcee439e1e42def483ff3ef632a84df7ece5ff072f72887c1, \\ - myname.myaddr.tools + example.myaddr.tools EoEXAMPLE }