segfault/gsnc/sf-gsnc.sh

17 lines
558 B
Bash
Raw Normal View History

2022-07-28 16:19:00 +00:00
#! /bin/bash
2022-10-08 08:30:59 +00:00
[[ -z $SF_SEED ]] && { echo >&2 "SF_SEED= not set"; sleep 5; exit 255; }
2022-08-09 13:05:52 +00:00
ip route del default
ip route add default via 172.22.0.254
2022-07-28 16:19:00 +00:00
# This is the GS_SECRET to get to SSHD (and gs-netcat in cleartext [-C] could be used).
# It can be cryptographically weak. The security is provided by SSHD.
2022-10-08 08:30:59 +00:00
GS_SECRET=$(echo -n "GS-${SF_SEED}${SF_FQDN}" | sha512sum | base64 -w0)
GS_SECRET="${GS_SECRET//[^[:alpha:]]}"
GS_SECRET="${GS_SECRET:0:12}"
2022-07-28 16:19:00 +00:00
2022-11-25 11:35:31 +00:00
echo "${GS_SECRET}" >/config/guest/gsnc-access-22.txt
2022-07-28 16:19:00 +00:00
exec /gs-netcat -l -d "$1" -p 22 -s "22-${GS_SECRET}"