File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -141,16 +141,18 @@ jobs:
141141 exit 1
142142 fi
143143
144- # Extract the full key string for the detected key type
145- FULLKEY=$(grep -v '^#' hostkey.txt | grep "$KEYTYPE" | head -n 1 | awk '{print $1 " " $2}')
146- if [ -z "$FULLKEY" ]; then
147- echo "ERROR: Could not extract full key for $KEYTYPE from hostkey.txt"
144+ # Extract the key type and base64 key, join with colon for PuTTY format
145+ KEYTYPE_FIELD=$(echo "$KEYLINE" | awk '{print $1}')
146+ KEYDATA_FIELD=$(echo "$KEYLINE" | awk '{print $2}')
147+ PUTTY_HOSTKEY="$KEYTYPE_FIELD:$KEYDATA_FIELD"
148+ if [ -z "$KEYTYPE_FIELD" ] || [ -z "$KEYDATA_FIELD" ]; then
149+ echo "ERROR: Could not extract PuTTY host key format from: $KEYLINE"
148150 cat hostkey.txt
149151 exit 1
150152 fi
151153
152- # Add the host key to PuTTY's cache using plink.exe (must use full key string, not fingerprint )
153- ./plink.exe -ssh -hostkey "$FULLKEY " "$SFTP_HOST" exit || true
154+ # Add the host key to PuTTY's cache using plink.exe (must use keytype:base64key format )
155+ ./plink.exe -ssh -hostkey "$PUTTY_HOSTKEY " "$SFTP_HOST" exit || true
154156
155157 # Clean up
156158 rm -f hostkey.txt
You can’t perform that action at this time.
0 commit comments