This commit is contained in:
Dominik Moritz Roth 2025-08-18 01:18:55 +02:00
parent 9bc2c4bb34
commit 0a108c460d

View File

@ -207,14 +207,14 @@ depends() {
}
install() {
inst_multiple tinysshd tinyssh-keyconvert ssh-keygen
inst_multiple tinysshd tinysshd-makekey
mkdir -p "$initdir/etc/tinyssh"
# Copy authorized keys
[ -f /etc/tinyssh/authorized_keys ] && inst /etc/tinyssh/authorized_keys /etc/tinyssh/authorized_keys
# Copy host keys
inst /etc/tinyssh/sshkeydir /etc/tinyssh/ 2>/dev/null || true
[ -d /etc/tinyssh/sshkeydir ] && inst /etc/tinyssh/sshkeydir /etc/tinyssh/ 2>/dev/null || true
# Install startup script
inst_hook cmdline 60 "$moddir/tinyssh-start.sh"
@ -229,13 +229,7 @@ cat > /usr/lib/dracut/modules.d/60tinyssh/tinyssh-start.sh << 'EOF'
#!/bin/bash
info "Starting tinyssh SSH server on port 2222..."
[ -d /etc/tinyssh ] || mkdir -p /etc/tinyssh
[ -d /etc/tinyssh/sshkeydir ] || {
mkdir -p /etc/tinyssh/sshkeydir
ssh-keygen -A
for key in /etc/ssh/ssh_host_*_key; do
[ -f "$key" ] && tinyssh-keyconvert "$key" /etc/tinyssh/sshkeydir/
done
}
[ -d /etc/tinyssh/sshkeydir ] || tinysshd-makekey /etc/tinyssh/sshkeydir
tinysshd -p 2222 /etc/tinyssh/sshkeydir &
EOF
@ -252,7 +246,7 @@ EOF
chmod +x /usr/lib/dracut/modules.d/60tinyssh/*.sh
# Setup tinyssh
mkdir -p /etc/tinyssh/sshkeydir
mkdir -p /etc/tinyssh
echo "${SSH_KEY}" > /etc/tinyssh/authorized_keys
chmod 600 /etc/tinyssh/authorized_keys