Public bug reported:

[Impact]
apt-key fails to fetch keys with "Address family not supported by protocol"

[Description]
We've had users report issues about apt-key being unable to fetch keys when 
IPv6 is disabled. As the mentioned kernel command line parameter disables IPV6 
socket support, servers that allow/respond with IPv6 will cause 
connect_server() to fail with EAFNOSUPPORT.

As this error is not being handled in some version of dirmngr, it'll
simply fail the connection and could cause other processes to fail as
well. In the test scenario below, it's easy to demonstrate this
behaviour through apt-key.

This has been reported upstream, and has been fixed with the following commit:
- dirmngr: Handle EAFNOSUPPORT at connect_server. (109d16e8f644)

The fix has been present upstream starting with GnuPG 2.22, so it's not
currently available in any Ubuntu releases.

[Test Case]
1. Spin up Focal VM

2. Disable IPv6:
$ sudo vi /etc/default/grub
(...)
GRUB_CMDLINE_LINUX="ipv6.disable=1"
$ sudo update-grub

3. Reboot the VM

4. Try to fetch a key:
sudo apt-key adv --fetch-keys https://www.postgreSQL.org/media/keys/ACCC4CF8.asc

You'll get the following error:
gpg: WARNING: unable to fetch URI 
https://www.postgresql.org/media/keys/ACCC4CF8.asc: Address family not 
supported by protocol

[Regression Potential]
The patch introduces additional error handling when connecting to servers, to 
properly mark remote hosts as having valid IPv4 and/or IPv6 connectivity. We 
should look out for potential regressions when connecting to servers with 
exclusive IPv4 or IPv6 connectivity, to make sure the server is not getting 
marked as 'dead' due to missing one of the versions.
This commit has also been tested in the corresponding Ubuntu series, and has 
been deemed safe for backporting to stable branches of upstream GnuPG. The 
overall regression potential for this change should be fairly low, and breakage 
should be easily spotted.

** Affects: gnupg2 (Ubuntu)
     Importance: High
     Assignee: Heitor Alves de Siqueira (halves)
         Status: In Progress


** Tags: seg sts

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1910432

Title:
  dirmngr doesn't work with kernel parameter ipv6.disable=1

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/gnupg2/+bug/1910432/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to