PGPキーサーバーにHTTPS経由のダウンロード機能がありますか?

PGPキーサーバーにHTTPS経由のダウンロード機能がありますか?

当社のファイアウォールはポート80でキーサーバーをブロックし、サポートしたいディストリビューションはまだTLSを介したHKPSをサポートしていません。

HTTPS経由で特定のキーを簡単にダウンロードできるキーサーバーはありますか?たとえば、キーストアにある独自の秘密鍵を取得できます。https://keybase.io/naftulikay/pgp_keys.asc

キーサーバープロトコルを使用せずにHTTPSを介してキーを取得できるリソースはありますか?私はAnsibleを書いているので、HTTPSを介してコンテンツを取得するのは簡単です。

ベストアンサー1

openpgp.org設備が整っているhttps。ただ指紋を通していくつかのキーを持ってきました。パスは予測可能で、${KEY_FINGERPRINT}インポートするキーの指紋に置き換えることができます。もちろん、次の場所にアップロードする必要がありますhttps://keys.openpgp.org

curl --sSL https://keys.openpgp.org/vks/v1/by-fingerprint/${KEY_FINGERPRINT} | \
  gpg --import

Ubuntuキーサーバーには、ASCII形式のキーを取得できるHTTP(S)APIもあります。

curl -sSL https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x${KEY_FINGERPRINT} | \
  gpg --import

| gpg --importキーデータをGnuPGキーリングにインポートするために使用されるパイプに注意してください。

HTTPS経由でGPG / PGPキーを自動的にインポートする:

パスはhttps://keys.openpgp.org予測可能でサーバーに保存されているキーフィンガープリントに基づいてのみ変更されるため、フィンガープリントで識別されたキーリストを自動的にインポートできます。以下はテストされており、正常に動作することが知られています。

スクリプトを自分の目的に合わせて調整するには、(3)サンプルキーフィンガープリントをインポートするキーフィンガープリントに置き換えて、変数を目的のパスPATHSCRIPTSに設定するだけです。

#!/bin/bash

PATHSCRIPTS='/home/pi'

# Create text file using a Here-Doc containing Key Fingerprints of keys to import into keyring:

cat <<EOF> $PATHSCRIPTS/Key-fingerprints-list.txt
AEB042FFD73BAA7545EDA021343A2DF613C5E7F8
7AFAF20259E69236E43EEF521F45D0F6E89F27A6
704FCD2556C40AF8F2FBD8E2E5A1DE67F98FA66F
EOF

# Read the text file we created into an array
readarray arrayKeyFingerprints < $PATHSCRIPTS/Key-fingerprints-list.txt

# Loop through the array adding each key in turn by its fingerprint from keys.openpgp.org:
for i in ${arrayKeyFingerprints[@]}; do
    curl https://keys.openpgp.org/vks/v1/by-fingerprint/$i | gpg --import
done

test.sh上記のスクリプト(Raspberry Piに保存して実行)の結果は次のとおりです。

pi@pi4-ap1:~ $ ./test.sh 
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                             Dload  Upload   Total   Spent    Left  Speed
100  3212  100  3212    0     0   7629      0 --:--:-- --:--:-- --:--:--  7629
gpg: /home/pi/.gnupg/trustdb.gpg: trustdb created
gpg: key 343A2DF613C5E7F8: public key "Terrence Houlahan (I'm the former NYPD cop living in the UK.  This is my only *personal* key.  Trust no others.) <[email protected]>" imported
gpg: Total number processed: 1
gpg:               imported: 1
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                             Dload  Upload   Total   Spent    Left  Speed
100  3220  100  3220    0     0  18720      0 --:--:-- --:--:-- --:--:-- 18612
gpg: key 1F45D0F6E89F27A6: public key "Terrence Houlahan (Terrence Houlahan Linux & Network Engineer) <[email protected]>" imported
gpg: Total number processed: 1
gpg:               imported: 1
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                             Dload  Upload   Total   Spent    Left  Speed
100  3252  100  3252    0     0  19473      0 --:--:-- --:--:-- --:--:-- 19473
gpg: key E5A1DE67F98FA66F: public key "Terrence Houlahan (Open-IPcamera Project Developer Key Terrence Houlahan) <[email protected]>" imported
gpg: Total number processed: 1
gpg:               imported: 1

(3) インポートしたキーを使用してキーリストを作成します。

pi@pi4-ap1:~ $ gpg --list-keys
/home/pi/.gnupg/pubring.kbx
---------------------------
pub   rsa4096 2011-03-13 [SC]
  AEB042FFD73BAA7545EDA021343A2DF613C5E7F8
uid           [ unknown] Terrence Houlahan (I'm the former NYPD cop living in the UK.  This is my only *personal* key.  Trust no others.) <[email protected]>
sub   rsa4096 2011-03-13 [E]

pub   rsa4096 2019-02-06 [SC] [expires: 2029-01-31]
  7AFAF20259E69236E43EEF521F45D0F6E89F27A6
uid           [ unknown] Terrence Houlahan (Terrence Houlahan Linux & Network Engineer) <[email protected]>
sub   rsa4096 2019-02-06 [E] [expires: 2029-01-31]

pub   rsa4096 2019-02-06 [SC] [expires: ????-??-??]
  704FCD2556C40AF8F2FBD8E2E5A1DE67F98FA66F
uid           [ unknown] Terrence Houlahan (Open-IPcamera Project Developer Key Terrence Houlahan) <[email protected]>
sub   rsa4096 2019-02-06 [E] [expires: ????-??-??]

おすすめ記事