forked from finn/tinyboard
Compare commits
4 Commits
1f4e8555da
...
5941f95b00
| Author | SHA1 | Date | |
|---|---|---|---|
| 5941f95b00 | |||
| 747c8a81d8 | |||
|
|
5a9e55b673 | ||
|
|
e5bdf95dcf |
@@ -81,6 +81,11 @@ KEY_PATH="$SSH_DIR/$KEY_NAME"
|
||||
mkdir -p "$(dirname "$RCLONE_CONF")"
|
||||
|
||||
header "Checking Tunnel"
|
||||
info "Verifying spoke SSH service is reachable on port $TUNNEL_PORT..."
|
||||
# Test TCP connectivity first
|
||||
if ! timeout 5 bash -c "cat < /dev/null > /dev/tcp/localhost/$TUNNEL_PORT" 2>/dev/null; then
|
||||
die "Cannot connect to port $TUNNEL_PORT on localhost — is the tunnel up?"
|
||||
fi
|
||||
info "Scanning spoke host key..."
|
||||
KEYSCAN=$(ssh-keyscan -p "$TUNNEL_PORT" -H localhost 2>/dev/null)
|
||||
[ -n "$KEYSCAN" ] || die "Spoke not reachable on port $TUNNEL_PORT — is the tunnel up?"
|
||||
@@ -91,9 +96,6 @@ while IFS= read -r KEYSCAN_LINE; do
|
||||
fi
|
||||
done <<<"$KEYSCAN"
|
||||
|
||||
info "Verifying spoke SSH service is reachable on port $TUNNEL_PORT..."
|
||||
info "Note: Password authentication should be enabled on the spoke for initial key setup."
|
||||
|
||||
header "Generating Hub SSH Key"
|
||||
if [ -f "$KEY_PATH" ]; then
|
||||
warn "Key $KEY_PATH already exists, skipping generation."
|
||||
|
||||
@@ -405,21 +405,7 @@ echo -e " Spoke name: ${GREEN}$SPOKE_NAME${NC}"
|
||||
echo -e " Tunnel port: ${GREEN}$TUNNEL_PORT${NC} on $HUB_HOST"
|
||||
echo -e " SSH key: ${GREEN}$KEY_PATH${NC}"
|
||||
echo ""
|
||||
echo -e "${YELLOW}The hub owner needs to do the following on ${HUB_HOST}:${NC}"
|
||||
echo -e "${YELLOW}Next step — on the hub, run as ${HUB_USER}:${NC}"
|
||||
echo ""
|
||||
echo " 1. Generate a hub->spoke key:"
|
||||
echo " ssh-keygen -t ed25519 -f ~/.ssh/${HUB_USER}-${SPOKE_NAME}-$(date +%Y%m)"
|
||||
echo ""
|
||||
echo " 2. Copy it to this spoke through the tunnel:"
|
||||
echo " ssh-copy-id -i ~/.ssh/${HUB_USER}-${SPOKE_NAME}-$(date +%Y%m).pub -p $TUNNEL_PORT ${HUB_USER}@localhost"
|
||||
echo ""
|
||||
echo " 3. Add an rclone remote in ~/.config/rclone/rclone.conf:"
|
||||
echo " [${SPOKE_NAME}-remote]"
|
||||
echo " type = sftp"
|
||||
echo " host = localhost"
|
||||
echo " port = $TUNNEL_PORT"
|
||||
echo " key_file = /home/$HUB_USER/.ssh/${HUB_USER}-${SPOKE_NAME}-$(date +%Y%m)"
|
||||
echo " shell_type = unix"
|
||||
echo " md5sum_command = md5sum"
|
||||
echo " sha1sum_command = sha1sum"
|
||||
echo " cd tinyboard && ./setup.sh # choose option 2 (onboard spoke)"
|
||||
echo ""
|
||||
|
||||
Reference in New Issue
Block a user