web-dev-qa-db-ja.com

SSHに使用するのに最適なホストキーアルゴリズムはどれですか。

known_hostsファイル内に含まれていないSSHサーバーに初めて接続すると、SSHクライアントには、サーバーから提供された公開鍵のフィンガープリントが表示されます。私はこの質問から発見しました ここ クライアントとして、ssh_config内で、ホストの/etc/ssh/ディレクトリの公開鍵ペアのどれを希望するかを指定できることを確認しました。

ssh_configのマニュアルページから、現在のデフォルトは次のとおりであることがわかりました。

    [email protected],
    [email protected],
    [email protected],
    [email protected],
    [email protected],
    [email protected],
    ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,
    ecdsa-sha2-nistp521,ssh-ed25519,
    ssh-rsa,ssh-dss

最近、SSHサーバーからRSAではなくECDSAフィンガープリントが送信されてきましたが、それが重要である場合、どのアルゴリズムを選択すればよいのか迷っていました。

これ 記事はECDSAがthe old elliptic-curve DSA implementation that is known to have severe vulnerabilitesであると主張していますRSAまたは最新のed25519アルゴリズムを使用する必要がありますか?

24
user4191887

現在、

  • RSAは依然としてゴールドスタンダードとして推奨されています(強力、幅広い互換性)
  • ed25519は良好です(NISTには依存しませんが、すべての古いクライアントと互換性はありません)。

サーバーは通常、より多くの異なるホストキータイプを提供しているため、互換性を目指しています。クライアント構成での優先順位は、より強いものからより互換性のあるものへの順です。

率直に言って、エンドユーザーとしてのあなたにとって、それは問題ではありません。一部のキーにはセキュリティ上の懸念があるかもしれませんが、合理的な長さで完全に壊れているとは考えられないため、中間者攻撃などが発生する可能性があります。

この記事では「深刻な脆弱性」について言及していますが、具体的なことは何も述べていません。そのようなサーブの脆弱性があったとしても、だれもそれを使用したり、サポートしたり、推奨したりすることはありません。参照がないと、懸念事項についてコメントするのはかなり困難です。

14
Jakuje

アルゴリズムは流動的な状態にあるため、 ssh-audit ツール(Githubで利用可能)( here's より新しいフォーク)を使用すると非常に便利です。

現在の安全なSSH設定の出力例を以下に示します。

# general
(gen) banner: SSH-2.0-OpenSSH_6.7p1 Debian-5+deb8u3
(gen) software: OpenSSH 6.7p1
(gen) compatibility: OpenSSH 6.5+, Dropbear SSH 2013.62+
(gen) compression: enabled ([email protected])

# key exchange algorithms
(kex) [email protected]          -- [info] available since OpenSSH 6.5, Dropbear SSH 2013.62
(kex) diffie-hellman-group-exchange-sha256  -- [warn] using custom size modulus (possibly weak)
                                            `- [info] available since OpenSSH 4.4

# Host-key algorithms
(key) ssh-ed25519                           -- [info] available since OpenSSH 6.5
(key) ssh-rsa                               -- [info] available since OpenSSH 2.5.0, Dropbear SSH 0.28

# encryption algorithms (ciphers)
(enc) [email protected]         -- [info] available since OpenSSH 6.5
                                            `- [info] default cipher since OpenSSH 6.9.
(enc) [email protected]                -- [info] available since OpenSSH 6.2
(enc) [email protected]                -- [info] available since OpenSSH 6.2
(enc) aes256-ctr                            -- [info] available since OpenSSH 3.7, Dropbear SSH 0.52
(enc) aes192-ctr                            -- [info] available since OpenSSH 3.7
(enc) aes128-ctr                            -- [info] available since OpenSSH 3.7, Dropbear SSH 0.52

# message authentication code algorithms
(mac) [email protected]         -- [info] available since OpenSSH 6.2
(mac) [email protected]         -- [info] available since OpenSSH 6.2
(mac) [email protected]              -- [info] available since OpenSSH 6.2
(mac) hmac-sha1                             -- [warn] using encrypt-and-MAC mode
                                            `- [warn] using weak hashing algorithm
                                            `- [info] available since OpenSSH 2.1.0, Dropbear SSH 0.28

# algorithm recommendations (for OpenSSH 6.7)
(rec) -hmac-sha1                            -- mac algorithm to remove

/etc/ssh/sshd_configに使用される設定:

KexAlgorithms [email protected],diffie-hellman-group-exchange-sha256
Ciphers [email protected],[email protected],[email protected],aes256-ctr,aes192-ctr,aes128-ctr
# Following MACs does not work on Mac OSX 10.10 or older
MACs [email protected],[email protected],[email protected],hmac-sha1

/etc/ssh/ssh_configに使用される設定:

HostKeyAlgorithms [email protected],[email protected],ssh-ed25519,ssh-rsa
KexAlgorithms [email protected],diffie-hellman-group-exchange-sha256
MACs [email protected],[email protected],[email protected],hmac-sha1
Ciphers [email protected],[email protected],[email protected],aes256-ctr,aes192-ctr,aes128-ctr
11
John Greene

アルゴリズムとキーサイズの選択

SSHは、認証鍵のいくつかの公開鍵アルゴリズムをサポートしています。これらには以下が含まれます:

  • rsa-大きな数の因数分解の難しさに基づく古いアルゴリズム。 RSAには、少なくとも2048ビットの鍵サイズが推奨されます。 4096ビットの方が優れています。 RSAは古くなり、ファクタリングは大幅に進歩しています。別のアルゴリズムを選択することをお勧めします。 RSAアルゴリズムは予見可能な将来に実質的に破綻する可能性があります。すべてのSSHクライアントがこのアルゴリズムをサポートしています。

  • dsa-古い米国政府のデジタル署名アルゴリズム。これは、離散対数の計算の難しさに基づいています。通常、1024のキーサイズが使用されます。元の形式のDSAは推奨されなくなりました。

  • ecdsa-楕円曲線を使用して、米国政府によって標準化された新しいデジタル署名アルゴリズム。これはおそらく、現在のアプリケーションに適したアルゴリズムです。 256、384、および521(sic!)ビットの3つの鍵サイズのみがサポートされています。キーはまだ小さく、おそらく安全であるはずですが、小さいキーよりも安全であるため、常に521ビットで使用することをお勧めします。現在、ほとんどのSSHクライアントがこのアルゴリズムをサポートしています。

  • ed25519-これはOpenSSHで追加された新しいアルゴリズムです。クライアントでのサポートはまだ一般的ではありません。したがって、汎用アプリケーションでの使用は、まだお勧めできません。

参照 https://www.ssh.com/ssh/keygen/#sec-Choosing-an-Algorithm-and-Key-Size

8
cdmo