Skip to content

Commit

Permalink
Version 1.2.3
Browse files Browse the repository at this point in the history
Fix ssh login on Alpine 3.21 (openssh 9.9_p1) ref #34
  • Loading branch information
macmpi committed Jan 8, 2025
1 parent e3b9423 commit 12d6ffe
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
Binary file modified headless.apkovl.tar.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion headless.apkovl.tar.gz.sha512
Original file line number Diff line number Diff line change
@@ -1 +1 @@
d30ebaec4e1e9224e0a4a34861f392ba41adf585cdf6e3ede41492fb6a55a0c881455a510663422b77cb42a5b48a02fc17d62fafc74df6c49e324639b25ba337 headless.apkovl.tar.gz
fecc6b66f1b08a959c6509334b5c1942b8df76ba6b7d51c54630f0c502706650b9d345bab71cd3d787681113eb5c1a40b2f6bc238ca6e4137fd00de8a6bc8a17 headless.apkovl.tar.gz
18 changes: 16 additions & 2 deletions overlay/usr/local/bin/headless_bootstrap
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# SPDX-FileCopyrightText: Copyright 2022-2023, macmpi
# SPDX-License-Identifier: MIT

HDLSBSTRP_VERSION="1.2.2"
HDLSBSTRP_VERSION="1.2.3"

_apk() {
local cmd="$1"
Expand Down Expand Up @@ -91,6 +91,9 @@ _setup_sshd() {
## Setup temporary SSH server (root login, no password):
# we use some bundled (or optionaly provided) keys to avoid generation at startup and save time.
_apk add openssh-server
# Preserve sshd-session & al binaries before uninstall
[ -d /usr/lib/ssh ] && cp -a /usr/lib/ssh /tmp/.trash/.

_preserve "/etc/ssh/sshd_config"
_preserve "/etc/conf.d/sshd"

Expand All @@ -116,6 +119,15 @@ else
EOF
fi

# Define sshd-session & al files new location into sshd_config
for f in /tmp/.trash/ssh/sshd-*; do
[ -e "$f" ] || continue # protect failing glob
name=$(echo $(basename $f) | cut -c6-)
initial=$(echo $name | cut -c1 | tr [a-z] [A-Z])
final=$(echo $name | cut -c2-)
echo "Sshd${initial}${final}Path $f" >>/etc/ssh/sshd_config
done

# Server keys: inject optional custom keys, or generate new (might be stored),
# or use bundeled ones (not stored)
local keygen_stance="sshd_disable_keygen=yes"
Expand All @@ -138,6 +150,7 @@ else
fi

echo "$keygen_stance" >>/etc/conf.d/sshd

rc-service sshd restart
}

Expand Down Expand Up @@ -165,7 +178,7 @@ _is_ro && mount -o remount,ro "${ovlpath}"
_logger "Update $updt_status"

if [ "$updt_status" = "successful" ]; then
printf '%s\n\n' "Updated" >>/tmp/.trash/banner
printf '%s\n\n' "Updated (Read release notes!)" >>/tmp/.trash/banner
else
printf '\n' >>/tmp/.trash/banner
return 1
Expand Down Expand Up @@ -229,6 +242,7 @@ if ! install -m644 "${ovlpath}"/interfaces /etc/network/interfaces >/dev/null 2>
EOF
for dev in /sys/class/net/*; do
[ -e "$dev" ] || continue # protect failing glob
# shellcheck disable=SC2034 # Unused IFINDEX while still sourced from uevent.
local DEVTYPE INTERFACE IFINDEX
DEVTYPE=""
Expand Down

0 comments on commit 12d6ffe

Please sign in to comment.