How to work around blocked outbound hkp port for apt keys

Solution 1:

This has been fixed in the upcoming Natty version of Ubuntu: https://launchpad.net/ubuntu/natty/+source/software-properties/0.78.1

Those using an older version need to edit ppa.py:

sudo gedit /usr/lib/python2.6/dist-packages/softwareproperties/ppa.py

Where it says:

keyserver.ubuntu.com

change to:

hkp://keyserver.ubuntu.com:80

Save, exit, then you're hopefully good to go.

Solution 2:

sudo apt-key adv --keyserver keyserver.ubuntu.com --keyserver-options http-proxy=http://proxy:port --recv-keys KEYID

Solution 3:

Here's one workaround I used:

I logged onto a linux server out in the free world beyond our corporate firewall, and did this:

gpg --keyserver keyserver.ubuntu.com --recv 1DABDBB4CEC06767 && gpg --export --armor 1DABDBB4CEC06767

Then on my workstation, I ran this, and pasted the output from the above command (the public key) into the stdin, followed by control-D:

sudo apt-key add -

Then I was able to run sudo apt-get update without problems.

I still think there has to be a better way, ideally something I could script.

Solution 4:

I have another workaround here which might be handy if you can't find another linux server outside your network as proxy. Just send an email to "[email protected]" like subject as "get 0x1DABDBB4CEC06767". But you probably still can't write a simple script to automate this.