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

Created by elis
Keywords:
import gpg repository key proxy firewall
Last updated by:
marcobra (Marco Braida)

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:
proxy.mycompany
with ip: 192.168.100.59

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 keyserver.ubuntu.com --recv-keys A258828C

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

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

Acquire::http::proxy "http://192.168.100.59:3128/";
Acquire::https::proxy "https://192.168.100.59:3128/";