import gpg key on a proxy enabled firewalled (11371 blocked port) corporate network

Created by elis on on 2012-12-01
import gpg repository key proxy firewall
Last updated by:
marcobra (Marco Braida) on on 2012-12-18

Corporate firewalls commonly block port 11371 which launchpad PPA’s use for their keys.

Assuming we need to import A258828C repository key

and we are behind a firewalled net with an active proxy answering on 3128 port on:
with ip:

So to bypass this and to import the key we can use

export http_proxy=http://proxy.mycompany:3128; export https_proxy=$http_proxy
sudo -E apt-key adv --keyserver --recv-keys A258828C

Then we can add the repository sources lines to the /etc/apt/sources.list or into a standalone .list file in

Usually we also check/set there are proxy defined into /etc/apt/apt.conf file

Acquire::http::proxy "";
Acquire::https::proxy "";