[SOLVED] [dyndns update] ipv6 only

My YunoHost server

Hardware: LXC container, host is a NUC
YunoHost version: 4.2.8.3
I have access to my server : As root through lxc-attach
Are you in a special context or did you perform some particular tweaking on your YunoHost instance ? : yes
If yes, please explain:

See bellow.

Description of my issue

Hello,

I try to migrate a yunohost, from an internet cube to a server hosting several
LXC containers, while using ipv6 only.

The server has one ipv4 address and a block of ipv6 addresses.
I have an other yunohost already installed in a container.
Its ipv4 is NATed and one ipv6 address is used.
This first yunohost works fine.

Now, for the other yunohost I try to migrate, I have ipv6 only.
Installation and backup restoration worked fine.
I face an issue when I try to dyndns update.

Here is the procedure I followed to install yunohost on top of debian buster (in
a brand new LXC container):

#!/bin/bash

sudo apt update
sudo apt install curl

# to access "adduser" binary:
export PATH="${PATH}:/usr/sbin/"

# try to avoid perl warnings:
export LANGUAGE=${LANG}
export LC_CTYPE=${LANG}
export LC_ALL=${LANG}

sudo passwd # set the password because installation removes sudo
curl https://install.yunohost.org | bash

# during the post-install, I used my domain name <myhost>.nohost.me which is
# already taken, so I ignored dyndns:
sudo yunohost tools postinstall --ignore-dyndns
sudo yunohost backup restore <my_backup_name>

# here is the command that fails:
sudo yunohost dyndns update

I also run a diagnosis and re-gerenated every configuration file that was
modified. One remaining issue (apart from not having an ipv4) is that service avahi-daemon fails.

Here are the errors I face:

root@<myhost>:/# yunohost dyndns update
Error: Failed to resolve A for <myhost>.nohost.me


root@<myhost>:/# yunohost service restart avahi-daemon
Job for avahi-daemon.service failed because the control process exited with error code.
See "systemctl status avahi-daemon.service" and "journalctl -xe" for details.
Warning: Could not execute the command 'systemctl restart avahi-daemon'
Error: Could not restart the service 'avahi-daemon'

Recent service logs:
<time-and-date> systemd[1]: Starting Avahi mDNS/DNS-SD Stack...
<time-and-date> avahi-daemon[1664]: Found user 'avahi' (UID 111) and group 'avahi' (GID 112).
<time-and-date> avahi-daemon[1664]: Successfully dropped root privileges.
<time-and-date> avahi-daemon[1664]: chroot.c: fork() failed: Resource temporarily unavailable
<time-and-date> avahi-daemon[1664]: failed to start chroot() helper daemon.
<time-and-date> systemd[1]: avahi-daemon.service: Main process exited, code=exited, status=255/EXCEPTION
<time-and-date> systemd[1]: avahi-daemon.service: Failed with result 'exit-code'.
<time-and-date> systemd[1]: Failed to start Avahi mDNS/DNS-SD Stack.
<time-and-date> systemd[1]: avahi-daemon.service: Consumed 8ms CPU time.

The host acts as a firewall. The following ports are open:
TCP:

  • 25
  • 53
  • 80
  • 443
  • 587
  • 993
  • 5222
  • 5269

UDP:

  • 53
  • 5353

I can access the container from the outside (tested on TCP port 443).

Am I missing something?
Thank you,

@alb1

Are you able to:

dig +short A wikipedia.org
dig +short AAAA wikipedia.org

Hello @Aleks,

Thank you for your answer.

So, we exchanged in the IRC and you solved my problem.
Here I just summarize what we said.

I was indeed able to:

dig +short A wikipedia.org
dig +short AAAA wikipedia.org

The first command returned the ipv4 address for wikipedia.org and the second its ipv6 address.

Then you explained to me that “the issue is in yunohost’s code itself, […] basically we fetch the dyndns’s server IPv4 and then we use that IPv4 to try to contact the dyndns server… But if you’re in an IPv6 context, it won’t work.”

So you proposed a fix:

<         # FIXME make this work for IPv6-only hosts too..
263,264c262,263
<         dyn_host_ip = result[0] if ok == "ok" and len(result) else None
<         if not dyn_host_ip:
---
>         dyn_host_ipv4 = result[0] if ok == "ok" and len(result) else None
>         if not dyn_host_ipv4:
267c266,271
<         ok, result = dig(domain, rdtype, resolvers=[dyn_host_ip])
---
>         ok, result = dig(dyn_host, "AAAA")
>         dyn_host_ipv6 = result[0] if ok == "ok" and len(result) else None
>         if not dyn_host_ipv6:
>             raise YunohostError("Failed to resolve %s" % dyn_host, raw_msg=True)
>
>         ok, result = dig(domain, rdtype, resolvers=[dyn_host_ipv4, dyn_host_ipv6])

which I applied and it solved my problem.
Now, running yunohost dyndns update returns Success! Updated your IP on DynDNS.

It would be nice to propose this change on github.
Unfortunately, I do not have a github account. So, just feel free to do it.

Again, thank you,

@alb1

Implemented in dyndns update: Fix for ipv6-only hosts · YunoHost/yunohost@a61d023 · GitHub , cheers :+1:

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.