mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-07-25 00:05:17 -04:00
feat: use SSH host certificates (#3786)
This commit is contained in:
parent
95f17a6d06
commit
7ea5c41f9b
34 changed files with 706 additions and 117 deletions
|
@ -0,0 +1,3 @@
|
|||
[Unit]
|
||||
Wants=sshd-keygen@ed25519.service
|
||||
PartOf=sshd.service
|
44
image/sysroot-tree/usr/libexec/openssh/sshd-keygen
Normal file
44
image/sysroot-tree/usr/libexec/openssh/sshd-keygen
Normal file
|
@ -0,0 +1,44 @@
|
|||
#!/usr/bin/bash
|
||||
# Taken from the original openssh-server package and slightly modified
|
||||
|
||||
set -x
|
||||
|
||||
# Create the host keys for the OpenSSH server.
|
||||
KEYTYPE=$1
|
||||
case $KEYTYPE in
|
||||
"dsa") ;& # disabled in FIPS
|
||||
"ed25519")
|
||||
FIPS=/proc/sys/crypto/fips_enabled
|
||||
if [[ -r $FIPS && $(cat $FIPS) == "1" ]]; then
|
||||
exit 0
|
||||
fi
|
||||
;;
|
||||
"rsa") ;; # always ok
|
||||
"ecdsa") ;;
|
||||
*) # wrong argument
|
||||
exit 12 ;;
|
||||
esac
|
||||
mkdir -p /var/run/state/ssh
|
||||
KEY=/var/run/state/ssh/ssh_host_${KEYTYPE}_key
|
||||
|
||||
KEYGEN=/usr/bin/ssh-keygen
|
||||
if [[ ! -x $KEYGEN ]]; then
|
||||
exit 13
|
||||
fi
|
||||
|
||||
# remove old keys
|
||||
rm -f "$KEY"{,.pub}
|
||||
|
||||
# create new keys
|
||||
if ! $KEYGEN -q -t "$KEYTYPE" -f "$KEY" -C '' -N '' >&/dev/null; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# sanitize permissions
|
||||
/usr/bin/chmod 600 "$KEY"
|
||||
/usr/bin/chmod 644 "$KEY".pub
|
||||
if [[ -x /usr/sbin/restorecon ]]; then
|
||||
/usr/sbin/restorecon "$KEY"{,.pub}
|
||||
fi
|
||||
|
||||
exit 0
|
Loading…
Add table
Add a link
Reference in a new issue