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

Bug #1910432 reported by Heitor Alves de Siqueira
14
This bug affects 1 person
Affects Status Importance Assigned to Milestone
gnupg2 (Ubuntu)
Fix Released
High
Heitor Alves de Siqueira
Bionic
Fix Released
High
Heitor Alves de Siqueira
Focal
Fix Released
High
Heitor Alves de Siqueira
Groovy
Fix Released
High
Heitor Alves de Siqueira
Hirsute
Fix Released
High
Heitor Alves de Siqueira

Bug Description

[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.

Related branches

Changed in gnupg2 (Ubuntu Bionic):
assignee: nobody → Heitor Alves de Siqueira (halves)
Changed in gnupg2 (Ubuntu Focal):
assignee: nobody → Heitor Alves de Siqueira (halves)
Changed in gnupg2 (Ubuntu Groovy):
assignee: nobody → Heitor Alves de Siqueira (halves)
status: New → In Progress
Changed in gnupg2 (Ubuntu Focal):
status: New → In Progress
Changed in gnupg2 (Ubuntu Bionic):
status: New → In Progress
importance: Undecided → High
Changed in gnupg2 (Ubuntu Groovy):
importance: Undecided → High
Changed in gnupg2 (Ubuntu Focal):
importance: Undecided → High
tags: added: sts-sponsor
Revision history for this message
Dan Streetman (ddstreet) wrote :

added some minor comments to MRs about versioning; also the backport for bionic needs a bit of fixing

tags: added: sts-sponsor-ddstreet
Revision history for this message
Dan Streetman (ddstreet) wrote :

uploaded to f/g/h, thanks @halves!

One more minor comment for b added in the MR

Revision history for this message
Robie Basak (racb) wrote :

> 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.

+1. Please do this during SRU verification, as well as checking that dual stack works as expected. I accept though that the code path being added is only when errno == EAFNOSUPPORT so scope for regression is very limited.

The Hirsute release pocket currently has 2.2.20-1ubuntu1, same as Groovy. So I can't accept 2.2.20-1ubuntu1 into Groovy, since then the Hirsute release pocket would be a lower version than what is in Groovy. I suggest you use 2.2.20-1ubuntu1.20.10.1 based on https://wiki.ubuntu.com/SecurityTeam/UpdatePreparation#Update_the_packaging. Alternatively this problem will be resolved as soon as 2.2.20-1ubuntu2 in hirsute-proposed migrates.

Please fix the Groovy upload, or otherwise ping when fixed. I see no reason to block right now on accepting the Focal upload, but it would be nice to get both into proposed and then released at once, so users don't regress when upgrading from Focal to Groovy.

Changed in gnupg2 (Ubuntu Focal):
status: In Progress → Fix Committed
Changed in gnupg2 (Ubuntu Groovy):
status: In Progress → Incomplete
tags: added: verification-needed verification-needed-focal
Revision history for this message
Robie Basak (racb) wrote : Please test proposed package

Hello Heitor, or anyone else affected,

Accepted gnupg2 into focal-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/gnupg2/2.2.19-3ubuntu2.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-focal to verification-done-focal. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-focal. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package gnupg2 - 2.2.20-1ubuntu2

---------------
gnupg2 (2.2.20-1ubuntu2) hirsute; urgency=medium

  * d/p/dirmngr-handle-EAFNOSUPPORT-at-connect_server.patch:
    - Fix IPv6 connectivity for dirmngr (LP: #1910432)

 -- Heitor Alves de Siqueira <email address hidden> Sat, 16 Jan 2021 14:53:14 +0000

Changed in gnupg2 (Ubuntu Hirsute):
status: In Progress → Fix Released
Revision history for this message
Robie Basak (racb) wrote :

> I suggest you use 2.2.20-1ubuntu1.20.10.1 based on https://wiki.ubuntu.com/SecurityTeam/UpdatePreparation#Update_the_packaging. Alternatively this problem will be resolved as soon as 2.2.20-1ubuntu2 in hirsute-proposed migrates.

It occurred to me that 2.2.20-1ubuntu1.20.10.1 won't help either. We need the Hirsute release pocket to move beyond 2.2.20-1ubuntu1.

Dan Streetman (ddstreet)
Changed in gnupg2 (Ubuntu Groovy):
status: Incomplete → In Progress
Revision history for this message
Timo Aaltonen (tjaalton) wrote :

Hello Heitor, or anyone else affected,

Accepted gnupg2 into groovy-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/gnupg2/2.2.20-1ubuntu1.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-groovy to verification-done-groovy. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-groovy. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in gnupg2 (Ubuntu Groovy):
status: In Progress → Fix Committed
tags: added: verification-needed-groovy
Revision history for this message
Ubuntu SRU Bot (ubuntu-sru-bot) wrote : Autopkgtest regression report (gnupg2/2.2.20-1ubuntu1.1)

All autopkgtests for the newly accepted gnupg2 (2.2.20-1ubuntu1.1) for groovy have finished running.
The following regressions have been reported in tests triggered by the package:

repo/2.9-1 (arm64)

Please visit the excuses page listed below and investigate the failures, proceeding afterwards as per the StableReleaseUpdates policy regarding autopkgtest regressions [1].

https://people.canonical.com/~ubuntu-archive/proposed-migration/groovy/update_excuses.html#gnupg2

[1] https://wiki.ubuntu.com/StableReleaseUpdates#Autopkgtest_Regressions

Thank you!

Revision history for this message
Heitor Alves de Siqueira (halves) wrote :

Validated for Focal according to test case from description:
root@focal-vm:~# dpkg -l | grep dirmngr
ii dirmngr 2.2.19-3ubuntu2.1 amd64 GNU privacy guard - network certificate management service
root@focal-vm:~# apt-key adv --fetch-keys https://www.postgreSQL.org/media/keys/ACCC4CF8.asc
Executing: /tmp/apt-key-gpghome.W9r6hkIT5Y/gpg.1.sh --fetch-keys https://www.postgreSQL.org/media/keys/ACCC4CF8.asc
gpg: requesting key from 'https://www.postgreSQL.org/media/keys/ACCC4CF8.asc'
gpg: key 7FCC7D46ACCC4CF8: public key "PostgreSQL Debian Repository" imported
gpg: Total number processed: 1
gpg: imported: 1
root@focal-vm:~# grep ipv6.disable /proc/cmdline
BOOT_IMAGE=/boot/vmlinuz-5.4.0-65-generic root=UUID=ef66e66c-66c8-47d5-9310-b49fc053c8fe ro ipv6.disable=1 quiet splash console=tty1 console=ttyS0 vt.handoff=7

I also ran a simple test with v4/v6 exclusive connections as well as a dual
stack connection, to make sure we didn't introduce any major regressions:
root@focal-vm:~# apt-key adv --fetch-keys https://ipv4.google.com
Executing: /tmp/apt-key-gpghome.VV7UHTmUDt/gpg.1.sh --fetch-keys https://ipv4.google.com
gpg: requesting key from 'https://ipv4.google.com'
gpg: no valid OpenPGP data found.
gpg: Total number processed: 0
root@focal-vm:~# apt-key adv --fetch-keys https://ipv6.google.com
Executing: /tmp/apt-key-gpghome.OiPpZl0mQm/gpg.1.sh --fetch-keys https://ipv6.google.com
gpg: requesting key from 'https://ipv6.google.com'
gpg: no valid OpenPGP data found.
gpg: Total number processed: 0
root@focal-vm:~# apt-key adv --fetch-keys https://www.postgreSQL.org/media/keys/ACCC4CF8.asc
Executing: /tmp/apt-key-gpghome.a3KNTZlRrM/gpg.1.sh --fetch-keys https://www.postgreSQL.org/media/keys/ACCC4CF8.asc
gpg: requesting key from 'https://www.postgreSQL.org/media/keys/ACCC4CF8.asc'
gpg: key 7FCC7D46ACCC4CF8: "PostgreSQL Debian Repository" not changed
gpg: Total number processed: 1
gpg: unchanged: 1

tags: added: verification-done-focal
removed: verification-needed-focal
Revision history for this message
Heitor Alves de Siqueira (halves) wrote :

Validated for Groovy according to test case from description:
root@groovy-vm:~# dpkg -l | grep dirmngr
ii dirmngr 2.2.20-1ubuntu1.1 amd64 GNU privacy guard - network certificate management service
root@groovy-vm:~# apt-key adv --fetch-keys https://www.postgreSQL.org/media/keys/ACCC4CF8.asc
Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).
Executing: /tmp/apt-key-gpghome.T6PKzVoAlh/gpg.1.sh --fetch-keys https://www.postgreSQL.org/media/keys/ACCC4CF8.asc
gpg: requesting key from 'https://www.postgreSQL.org/media/keys/ACCC4CF8.asc'
gpg: key 7FCC7D46ACCC4CF8: public key "PostgreSQL Debian Repository" imported
gpg: Total number processed: 1
gpg: imported: 1
root@groovy-vm:~# grep ipv6.disable /proc/cmdline
BOOT_IMAGE=/boot/vmlinuz-5.8.0-41-generic root=UUID=e45ec002-fa78-4256-b1a6-1e43d865e0d0 ro ipv6.disable=1 quiet splash console=tty1 console=ttyS0 vt.handoff=7

I also ran a simple test with v4/v6 exclusive connections as well as a dual
stack connection, to make sure we didn't introduce any major regressions:
root@groovy-vm:~# apt-key adv --fetch-keys https://ipv4.google.com
Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).
Executing: /tmp/apt-key-gpghome.iPyobLuCUo/gpg.1.sh --fetch-keys https://ipv4.google.com
gpg: requesting key from 'https://ipv4.google.com'
gpg: no valid OpenPGP data found.
gpg: Total number processed: 0
root@groovy-vm:~# apt-key adv --fetch-keys https://ipv6.google.com
Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).
Executing: /tmp/apt-key-gpghome.XheKPph16K/gpg.1.sh --fetch-keys https://ipv6.google.com
gpg: requesting key from 'https://ipv6.google.com'
gpg: no valid OpenPGP data found.
gpg: Total number processed: 0
root@groovy-vm:~# apt-key adv --fetch-keys https://www.postgreSQL.org/media/keys/ACCC4CF8.asc
Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).
Executing: /tmp/apt-key-gpghome.SUZHNyCoc0/gpg.1.sh --fetch-keys https://www.postgreSQL.org/media/keys/ACCC4CF8.asc
gpg: requesting key from 'https://www.postgreSQL.org/media/keys/ACCC4CF8.asc'
gpg: key 7FCC7D46ACCC4CF8: "PostgreSQL Debian Repository" not changed
gpg: Total number processed: 1
gpg: unchanged: 1

tags: added: verification-done-groovy
removed: verification-needed-groovy
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package gnupg2 - 2.2.20-1ubuntu1.1

---------------
gnupg2 (2.2.20-1ubuntu1.1) groovy; urgency=medium

  * d/p/dirmngr-handle-EAFNOSUPPORT-at-connect_server.patch:
    - Fix IPv6 connectivity for dirmngr (LP: #1910432)

 -- Heitor Alves de Siqueira <email address hidden> Sat, 16 Jan 2021 14:53:14 +0000

Changed in gnupg2 (Ubuntu Groovy):
status: Fix Committed → Fix Released
Revision history for this message
Brian Murray (brian-murray) wrote : Update Released

The verification of the Stable Release Update for gnupg2 has completed successfully and the package is now being released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package gnupg2 - 2.2.19-3ubuntu2.1

---------------
gnupg2 (2.2.19-3ubuntu2.1) focal; urgency=medium

  * d/p/dirmngr-handle-EAFNOSUPPORT-at-connect_server.patch:
    - Fix IPv6 connectivity for dirmngr (LP: #1910432)

 -- Heitor Alves de Siqueira <email address hidden> Wed, 06 Jan 2021 18:10:35 +0000

Changed in gnupg2 (Ubuntu Focal):
status: Fix Committed → Fix Released
Revision history for this message
Łukasz Zemczak (sil2100) wrote : Please test proposed package

Hello Heitor, or anyone else affected,

Accepted gnupg2 into bionic-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/gnupg2/2.2.4-1ubuntu1.4 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-bionic to verification-done-bionic. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-bionic. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in gnupg2 (Ubuntu Bionic):
status: In Progress → Fix Committed
tags: added: verification-needed-bionic
Revision history for this message
Ubuntu SRU Bot (ubuntu-sru-bot) wrote : Autopkgtest regression report (gnupg2/2.2.4-1ubuntu1.4)

All autopkgtests for the newly accepted gnupg2 (2.2.4-1ubuntu1.4) for bionic have finished running.
The following regressions have been reported in tests triggered by the package:

libgnupg-interface-perl/0.52-9 (ppc64el, amd64, armhf, i386, arm64, s390x)
paperkey/1.5-3 (armhf)

Please visit the excuses page listed below and investigate the failures, proceeding afterwards as per the StableReleaseUpdates policy regarding autopkgtest regressions [1].

https://people.canonical.com/~ubuntu-archive/proposed-migration/bionic/update_excuses.html#gnupg2

[1] https://wiki.ubuntu.com/StableReleaseUpdates#Autopkgtest_Regressions

Thank you!

Revision history for this message
Heitor Alves de Siqueira (halves) wrote :

Validated for Bionic according to test case from description:
root@bionic-vm:~# dpkg -l | grep dirmngr
ii dirmngr 2.2.4-1ubuntu1.4 amd64 GNU privacy guard - network certificate management service
root@bionic-vm:~# apt-key adv --fetch-keys https://www.postgreSQL.org/media/keys/ACCC4CF8.asc
Executing: /tmp/apt-key-gpghome.Ktk68TsVfY/gpg.1.sh --fetch-keys https://www.postgreSQL.org/media/keys/ACCC4CF8.asc
gpg: requesting key from 'https://www.postgreSQL.org/media/keys/ACCC4CF8.asc'
gpg: key 7FCC7D46ACCC4CF8: 2 signatures not checked due to missing keys
gpg: key 7FCC7D46ACCC4CF8: public key "PostgreSQL Debian Repository" imported
gpg: Total number processed: 1
gpg: imported: 1
root@bionic-vm:~# grep ipv6.disable /proc/cmdline
BOOT_IMAGE=/boot/vmlinuz-4.15.0-135-generic root=UUID=ef3d4aea-b40a-406e-89ee-5f2ec310fcf6 ro ipv6.disable=1 quiet splash console=tty1 console=ttyS0 vt.handoff=1

I also ran a simple test with v4/v6 exclusive connection, as well as a dual stack connection, to make sure we didn't introduce any major regressions:
root@bionic-vm:~# apt-key adv --fetch-keys https://ipv4.google.com
Executing: /tmp/apt-key-gpghome.KsRawrZtqv/gpg.1.sh --fetch-keys https://ipv4.google.com
gpg: requesting key from 'https://ipv4.google.com'
gpg: no valid OpenPGP data found.
gpg: Total number processed: 0
root@bionic-vm:~# apt-key adv --fetch-keys https://ipv6.google.com
Executing: /tmp/apt-key-gpghome.HD4rkLJ2OU/gpg.1.sh --fetch-keys https://ipv6.google.com
gpg: requesting key from 'https://ipv6.google.com'
gpg: no valid OpenPGP data found.
gpg: Total number processed: 0
root@bionic-vm:~# apt-key adv --fetch-keys https://www.postgreSQL.org/media/keys/ACCC4CF8.asc
Executing: /tmp/apt-key-gpghome.bCV1CDO7Rc/gpg.1.sh --fetch-keys https://www.postgreSQL.org/media/keys/ACCC4CF8.asc
gpg: requesting key from 'https://www.postgreSQL.org/media/keys/ACCC4CF8.asc'
gpg: key 7FCC7D46ACCC4CF8: 2 signatures not checked due to missing keys
gpg: key 7FCC7D46ACCC4CF8: "PostgreSQL Debian Repository" not changed
gpg: Total number processed: 1
gpg: unchanged: 1

tags: added: verification-done verification-done-bionic
removed: verification-needed verification-needed-bionic
Revision history for this message
Heitor Alves de Siqueira (halves) wrote :

Failures for libgnupg-interface-perl are the result of the upstream test suite and very unlikely to be related to this SRU. I've opened bug 1916499 to investigate those separately.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package gnupg2 - 2.2.4-1ubuntu1.4

---------------
gnupg2 (2.2.4-1ubuntu1.4) bionic; urgency=medium

  * d/p/dirmngr-handle-EAFNOSUPPORT-at-connect_server.patch:
    - Fix IPv6 connectivity for dirmngr (LP: #1910432)
  * Fix autopkgtests (LP: #1825186)
    - add d/t/simple-tests from devel branch
    - remove broken gpgv-win32 test from d/t/control

 -- Heitor Alves de Siqueira <email address hidden> Sat, 16 Jan 2021 14:47:37 +0000

Changed in gnupg2 (Ubuntu Bionic):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.