-
Notifications
You must be signed in to change notification settings - Fork 359
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Allow master configuration for ssh key type (#10072)
- Loading branch information
1 parent
01572a2
commit 65d9edc
Showing
16 changed files
with
157 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
:orphan: | ||
|
||
**Improvements** | ||
|
||
- Master Configuration: Add support for crypto system configuration for ssh connection. | ||
``security.key_type`` now accepts ``RSA``, ``ECDSA`` or ``ED25519``. Default key type is changed | ||
from ``1024-bit RSA`` to ``ED25519``, since ``ED25519`` keys are faster and more secure than the | ||
old default, and ``ED25519`` is also the default key type for ``ssh-keygen``. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package ssh | ||
|
||
import ( | ||
"testing" | ||
|
||
"golang.org/x/crypto/ssh" | ||
"gotest.tools/assert" | ||
|
||
"github.com/determined-ai/determined/master/internal/config" | ||
) | ||
|
||
func verifyKeys(t *testing.T, keys PrivateAndPublicKeys) { | ||
privateKey, err := ssh.ParsePrivateKey(keys.PrivateKey) | ||
assert.NilError(t, err) | ||
|
||
publickKey, _, _, _, err := ssh.ParseAuthorizedKey(keys.PublicKey) //nolint:dogsled | ||
assert.NilError(t, err) | ||
assert.Equal(t, string(publickKey.Marshal()), string(privateKey.PublicKey().Marshal())) | ||
} | ||
|
||
func TestSSHKeyGenerate(t *testing.T) { | ||
t.Run("generate RSA key", func(t *testing.T) { | ||
keys, err := GenerateKey(config.SSHConfig{KeyType: config.KeyTypeRSA, RsaKeySize: 512}) | ||
assert.NilError(t, err) | ||
verifyKeys(t, keys) | ||
}) | ||
|
||
t.Run("generate ECDSA key", func(t *testing.T) { | ||
keys, err := GenerateKey(config.SSHConfig{KeyType: config.KeyTypeECDSA}) | ||
assert.NilError(t, err) | ||
verifyKeys(t, keys) | ||
}) | ||
|
||
t.Run("generate ED25519 key", func(t *testing.T) { | ||
keys, err := GenerateKey(config.SSHConfig{KeyType: config.KeyTypeED25519}) | ||
assert.NilError(t, err) | ||
verifyKeys(t, keys) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.