Re-order SSH key types to make ed25519 default

- Fixes: #981

Signed-off-by: Jonathon Anderson <janderson@ciq.com>
This commit is contained in:
Jonathon Anderson
2025-02-05 23:23:28 -07:00
parent a975c5efb6
commit 4809641ef6
7 changed files with 23 additions and 12 deletions

View File

@@ -18,6 +18,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Don't mount /run during wwinit. #1566
- Simpler permissions in official RPM packages. #1696
- Create temporary files in overlay directory during `wwctl overlay edit`. #1473
- Re-order SSH key types to make ed25519 default. #981
### Fixed

View File

@@ -33,7 +33,7 @@ image mounts:
readonly: true
ssh:
key types:
- ed25519
- ecdsa
- rsa
- dsa
- ecdsa
- ed25519

View File

@@ -1,5 +1,5 @@
package config
type SSHConf struct {
KeyTypes []string `yaml:"key types,omitempty" default:"[\"rsa\",\"dsa\",\"ecdsa\",\"ed25519\"]"`
KeyTypes []string `yaml:"key types,omitempty" default:"[\"ed25519\",\"ecdsa\",\"rsa\",\"dsa\"]"`
}

View File

@@ -6,6 +6,7 @@ import (
"path"
warewulfconf "github.com/warewulf/warewulf/internal/pkg/config"
"github.com/warewulf/warewulf/internal/pkg/overlay"
"github.com/warewulf/warewulf/internal/pkg/util"
"github.com/warewulf/warewulf/internal/pkg/wwlog"
)
@@ -18,6 +19,15 @@ func SSH(keyTypes ...string) error {
if os.Getuid() == 0 {
fmt.Printf("Updating system keys\n")
conf := warewulfconf.Get()
if conf.Warewulf.EnableHostOverlay() {
if err := overlay.BuildHostOverlay(); err != nil {
wwlog.Warn("host overlay could not be built: %s", err)
}
} else {
wwlog.Info("host overlays are disabled")
}
wwkeydir := path.Join(conf.Paths.Sysconfdir, "warewulf/keys") + "/"
err := os.MkdirAll(path.Join(conf.Paths.Sysconfdir, "warewulf/keys"), 0755)

View File

@@ -109,11 +109,11 @@ data from other structures.
### SSH
- Key types:
- ed25519
- ecdsa
- rsa
- dsa
- ecdsa
- ed25519
- First key type: rsa
- First key type: ed25519
## Node

View File

@@ -313,7 +313,7 @@ Filename: etc/profile.d/ssh_setup.csh
if ( ( $_UID > 500 || $_UID == 0 ) && ( ! -f "$HOME/.ssh/config" && ! -f "$HOME/.ssh/cluster" ) ) then
echo "Configuring SSH for cluster access"
install -d -m 700 $HOME/.ssh
ssh-keygen -t rsa -f $HOME/.ssh/cluster -N '' -C "Warewulf Cluster key" >& /dev/null
ssh-keygen -t ed25519 -f $HOME/.ssh/cluster -N '' -C "Warewulf Cluster key" >& /dev/null
cat $HOME/.ssh/cluster.pub >>! $HOME/.ssh/authorized_keys
chmod 0600 $HOME/.ssh/authorized_keys
@@ -347,7 +347,7 @@ Filename: etc/profile.d/ssh_setup.sh
if [ $_UID -ge 500 -o $_UID -eq 0 ] && [ ! -f "$HOME/.ssh/config" -a ! -f "$HOME/.ssh/cluster" ]; then
echo "Configuring SSH for cluster access"
install -d -m 700 $HOME/.ssh
ssh-keygen -t rsa -f $HOME/.ssh/cluster -N '' -C "Warewulf Cluster key" > /dev/null 2>&1
ssh-keygen -t ed25519 -f $HOME/.ssh/cluster -N '' -C "Warewulf Cluster key" > /dev/null 2>&1
cat $HOME/.ssh/cluster.pub >> $HOME/.ssh/authorized_keys
chmod 0600 $HOME/.ssh/authorized_keys

View File

@@ -46,10 +46,10 @@ Warewulf (4.6.0):
readonly: true
ssh:
key types:
- ed25519
- ecdsa
- rsa
- dsa
- ecdsa
- ed25519
wwclient:
port: 0
@@ -165,10 +165,10 @@ SSH key types to generate during ``wwctl configure ssh`` may be overridden using
ssh:
key types:
- ed25519
- ecdsa
- rsa
- dsa
- ecdsa
- ed25519
Warewulf will generate host keys for each listed key type.
The first listed key type is used to generate authentication ssh keys.