Security

通用 ssh 安全性 - 證書認證

  • May 19, 2011

我使用了這篇文章: http: //developer.apple.com/library/mac/#documentation/MacOSXServer/Conceptual/XServer_ProgrammingGuide/Articles/SSH.html以幫助設置 ssh 證書(我在 mac os X)。

我看到密鑰放在一個名為authorized_keys2.

這個文件叫什麼重要嗎?此外,在非個人伺服器(其他人可能具有 root 訪問權限的伺服器)上使用同一個authorized_keys2文件是否安全?他們能用它以某種方式訪問我的個人伺服器嗎?或者我是否為不同的伺服器/伺服器組使用單獨的授權文件?

至於有多台具有基於密鑰的身份驗證的伺服器,是否有任何其他好的“一般做法”,但本文未提及?

authorized_keys2 或更常見的authorized_keys 是預設文件名。至少使用 OpenSSH 伺服器,您可以使用AuthorizedKeysFile指令隨意重命名文件:

AuthorizedKeysFile

Specifies the file that contains the public keys that can be used for user authentication.  AuthorizedKeysFile may contain tokens of the form %T which are substituted during connection setup.  The following tokens are defined: %% is replaced by a literal ’%’, %h is replaced by the home directory of the user being authenticated, and %u is replaced by the username of that user.  After expansion, AuthorizedKeysFile is taken to be an absolute path or one relative to the user’s home directory.  The default is “.ssh/authorized_keys”.

在從 SSH v1 過渡到 SSH v2 期間,authorized_keys 與 authorized_keys2 的區別就出現了。現在 SSH v2 是“預設標準”,因此在大多數情況下,該名稱已收斂回 authorized_keys。

要理解的“密鑰”(請原諒雙關語)點是私鑰仍然是私有的,並且僅儲存在客戶端電腦上。公鑰可以根據訪問需要發佈到一台或多台伺服器。這樣,查看/查看/複製公鑰的能力只會授予對私鑰的額外訪問權限,但重要的是,它本身可能不會被用來獲得訪問權限。

編輯:

我最喜歡的關於基於 SSH 密鑰的身份驗證的系列文章是幾年前由 IBM 發表的。

請記住,這些文章現在已有 10 年曆史,並且有些事情已經改變。儘管如此,對於我迄今為止發現的所有細微差別,它們仍然是最全面的解釋。

引用自:https://serverfault.com/questions/271616