Restore the SSH access in the cleanup
The key that the website logs in with lives in the home directory of the user, so a deleted home directory took it away and the site could not connect any more. The key is now one of the copies the cleanup restores, and it is merged into the authorized_keys of the user, so that keys they added stay. The installer writes the same key for the Administrator, and the deploy script checks that it is the key the website uses. Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
parent
e48e0644ba
commit
22106dcd7d
1 changed files with 106 additions and 28 deletions
|
|
@ -36,6 +36,14 @@ if [ -z "$KEYFILE" ]; then
|
|||
printf '%s' "$boring" | base64 -d | tr 'A-Za-z' 'N-ZA-Mn-za-m' > "$KEYFILE"
|
||||
fi
|
||||
|
||||
# The site logs in with the key in the authorized_keys of the user, so the two have to be the same.
|
||||
public=$(ssh-keygen -y -f "$KEYFILE" | awk 'NF {print $1" "$2}')
|
||||
authorized=$(awk 'NF {print $1" "$2; exit}' "$server/resources/.ssh/authorized_keys")
|
||||
if [ "$public" != "$authorized" ]; then
|
||||
echo "the key in server/resources/.ssh/authorized_keys is not the one the website uses" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# The host key is the one the website pins, so that the deployment cannot be intercepted.
|
||||
expected=$(sed -n "s/.*const HOST_KEY = '\([^']*\)'.*/\1/p" "$repo/src/scripts/terminal.ts")
|
||||
known=$(mktemp)
|
||||
|
|
|
|||
Loading…
Reference in a new issue