Ok this one’s a PITA.
I haven’t found a better way yet so it requires access to a non-blocked machine atm
Background
Ubuntu keyservers typically use the port 11371. If you are looking up a key from http://keyserver.ubuntu.com/ for example. It will go to a link that looks like
http://keyserver.ubuntu.com:11371/pks/lookup?search=0x8275A2B297B853E77ABC195BF53DE96D71FCFB2B&op=index
Unfortunately, that port is inaccessible through the network at work
If you use the newly provided add-apt-repository script you will get output that looks like
Executing: gpg –ignore-time-conflict –no-options –no-default-keyring –secret-keyring /etc/apt/secring.gpg –trustdb-name /etc/apt/trustdb.gpg –keyring /etc/apt/trusted.gpg –primary-keyring /etc/apt/trusted.gpg –keyserver keyserver.ubuntu.com –recv 8275A2B297B853E77ABC195BF53DE96D71FCFB2B
gpg: requesting key 71FCFB2B from hkp server keyserver.ubuntu.com
gpgkeys: HTTP fetch error 7: couldn’t connect to host
gpg: no valid OpenPGP data found.
gpg: Total number processed: 0
The repository will still get added to your sources.list but the key wouldn’t be added.
So on an apt-get update you will see output such as
W: GPG error: http://ppa.launchpad.net lucid Release: The following signatures couldn’t be verified because the public key is not available: NO_PUBKEY F53DE96D71FCFB2B
hacky solution
From a machine that is not restricted (I use my personal server) run the command above
sudo add-apt-repository ppa:maglione-k/ppa
You will the output of
Executing: gpg –ignore-time-conflict –no-options –no-default-keyring –secret-keyring /etc/apt/secring.gpg –trustdb-name /etc/apt/trustdb.gpg –keyring /etc/apt/trusted.gpg –primary-keyring /etc/apt/trusted.gpg –keyserver keyserver.ubuntu.com –recv 8275A2B297B853E77ABC195BF53DE96D71FCFB2B
gpg: requesting key 71FCFB2B from hkp server keyserver.ubuntu.com
gpg: key 71FCFB2B: “Launchpad wmii” not changed
gpg: Total number processed: 1
gpg: unchanged: 1
Ignore the not changed line.. I’ve already imported it before this example.
Note the recv line above and the value of 8275A2B297B853E77ABC195BF53DE96D71FCFB2B
Use that with the apt-key command and run:
sudo apt-key adv –keyserver keyserver.ubuntu.com –export –armor
8275A2B297B853E77ABC195BF53DE96D71FCFB2B
You’ll see output of
Executing: gpg –ignore-time-conflict –no-options –no-default-keyring –secret-keyring /etc/apt/secring.gpg –trustdb-name /etc/apt/trustdb.gpg –keyring /etc/apt/trusted.gpg –primary-keyring /etc/apt/trusted.gpg –keyserver keyserver.ubuntu.com –export –armor 8275A2B297B853E77ABC195BF53DE96D71FCFB2B
—–BEGIN PGP PUBLIC KEY BLOCK—–
Version: GnuPG v1.4.10 (GNU/Linux)
mI0EStZv7QEEALorUcGdFwGwPF7R915YdAkVxq10yY3IaWg3SPdFA+9pmYaSiZ6d
3N0Nvg3T9gFdG+VEauvKRe6U+FQekWP0OqEzdRwiEgtqGpDl65nik25/0hPcZ8iB
55bVoxFRLKsQWbrjtUulgKgOm8sWhQPb1Y8EGcaDjZgQxFawrWW3wlUlABEBAAG0
DkxhdW5jaHBhZCB3bWlpiLYEEwECACAFAkrWb+0CGwMGCwkIBwMCBBUCCAMEFgID
AQIeAQIXgAAKCRD1Peltcfz7K8vBA/90ywpWmxKxawP3SwVfTEGFzu/NA2RcoCjN
PHocUm8bGaIcpZuY1vYiMpZ1Yn1cqSJkkiCwe6tmWBUEnudZDtjxD1xQcMxhrdce
Xv5vsxPWTlkV3oYZS5YUbqSMCTyKs5+3jJQVSyMDWBlCijC9UWhMZeGBUY/ERMcX
Q9dyJBRFyw==
=PG1A
—–END PGP PUBLIC KEY BLOCK—–
Redirect the output of the above to a file (I just > xxx.key) and scp that to your restricted machine. Don’t worry about the extra output on top of the key.
From that machine run:
sudo apt-key add xxx.key
And that should be it.
Now apt-get update and you should be fine.