Here's a short script that solves the situation for Ubuntu based systems following 20.10 update (after apt-key
and add-apt-repository
deprecation):
curl -fsSL 'https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x<public-key>' | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/protonvpn-stable.gpg
Where <public-key>
must be replaced with the NO_PUBKEY number displayed in the error message.
Explanation of the curl options:
-f, --fail
(HTTP) Fail silently (no output at all) on server errors. This
is mostly done to better enable scripts etc to better deal with
failed attempts. In normal cases when an HTTP server fails to
deliver a document, it returns an HTML document stating so
(which often also describes why and more). This flag will pre‐
vent curl from outputting that and return error 22.
This method is not fail-safe and there are occasions where non-
successful response codes will slip through, especially when au‐
thentication is involved (response codes 401 and 407).
-L, --location
(HTTP) If the server reports that the requested page has moved
to a different location (indicated with a Location: header and a
3XX response code), this option will make curl redo the request
on the new place. If used together with -i, --include or -I,
--head, headers from all requested pages will be shown. When au‐
thentication is used, curl only sends its credentials to the
initial host. If a redirect takes curl to a different host, it
won't be able to intercept the user+password. See also --loca‐
tion-trusted on how to change this. You can limit the amount of
redirects to follow by using the --max-redirs option.
When curl follows a redirect and the request is not a plain GET
(for example POST or PUT), it will do the following request with
a GET if the HTTP response was 301, 302, or 303. If the response
code was any other 3xx code, curl will re-send the following re‐
quest using the same unmodified method.
You can tell curl to not change the non-GET request method to
GET after a 30x response by using the dedicated options for
that: --post301, --post302 and --post303.
-S, --show-error
When used with -s, --silent, it makes curl show an error message
if it fails.
-s, --silent
Silent or quiet mode. Don't show progress meter or error mes‐
sages. Makes Curl mute. It will still output the data you ask
for, potentially even to the terminal/stdout unless you redirect
it.
This gets the public key search results from the keyserver. You can go directly to the OpenPGP Keyserver in your browser and search for the public key in question and you'll see it. At this time, it is found at:
https://keyserver.ubuntu.com/pks/lookup?search=4EDE055B645F044F&fingerprint=on&op=index
The results are being piped into gpg which creates a key file at /etc/apt/trusted.gpg.d/protonvpn-stable.gpg
Explanation of gpg options:
--dearmor
Pack or unpack an arbitrary input into/from an OpenPGP ASCII ar‐
mor. This is a GnuPG extension to OpenPGP and in general not
very useful.
--output file
-o file
Write output to file. To write to stdout use - as the filename.