tinyssh gen host keys
This commit is contained in:
parent
059a926da6
commit
70bd757166
@ -106,6 +106,10 @@ dnf install -y \
|
|||||||
tmux neovim python3-pip \
|
tmux neovim python3-pip \
|
||||||
tree gcc make autoconf automake tar bzip2 || exit 1
|
tree gcc make autoconf automake tar bzip2 || exit 1
|
||||||
|
|
||||||
|
# Install tinyssh-keyconvert
|
||||||
|
echo "[+] Installing tinyssh-keyconvert..."
|
||||||
|
pip3 install git+https://github.com/ansemjo/tinyssh-keyconvert.git || echo "WARNING: tinyssh-keyconvert install failed"
|
||||||
|
|
||||||
# Build and install tinyssh from source since AlmaLinux doesn't package it
|
# Build and install tinyssh from source since AlmaLinux doesn't package it
|
||||||
echo "[+] Installing tinyssh from source..."
|
echo "[+] Installing tinyssh from source..."
|
||||||
cd /tmp || exit 1
|
cd /tmp || exit 1
|
||||||
@ -255,11 +259,18 @@ mkdir -p /etc/tinyssh/sshkeydir
|
|||||||
echo "${SSH_KEY}" > /etc/tinyssh/authorized_keys
|
echo "${SSH_KEY}" > /etc/tinyssh/authorized_keys
|
||||||
chmod 600 /etc/tinyssh/authorized_keys
|
chmod 600 /etc/tinyssh/authorized_keys
|
||||||
|
|
||||||
# Generate host keys using OpenSSH then convert to tinyssh format
|
# Generate host keys using tinyssh directly
|
||||||
ssh-keygen -A
|
/usr/local/bin/tinysshd-makekey /etc/tinyssh/sshkeydir || {
|
||||||
for key in /etc/ssh/ssh_host_*_key; do
|
echo "WARNING: Failed to generate tinyssh keys, falling back to OpenSSH conversion"
|
||||||
|
ssh-keygen -A
|
||||||
|
if command -v tinyssh-keyconvert >/dev/null 2>&1; then
|
||||||
|
for key in /etc/ssh/ssh_host_*_key; do
|
||||||
[ -f "$key" ] && tinyssh-keyconvert "$key" /etc/tinyssh/sshkeydir/
|
[ -f "$key" ] && tinyssh-keyconvert "$key" /etc/tinyssh/sshkeydir/
|
||||||
done
|
done
|
||||||
|
else
|
||||||
|
echo "ERROR: tinyssh-keyconvert not available and tinysshd-makekey failed"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# Configure dracut
|
# Configure dracut
|
||||||
cat > /etc/dracut.conf.d/99-tinyssh.conf << 'EOF'
|
cat > /etc/dracut.conf.d/99-tinyssh.conf << 'EOF'
|
||||||
|
Loading…
Reference in New Issue
Block a user