File tree Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -126,30 +126,31 @@ jobs:
126126 fi
127127
128128
129+
129130 # Find the first non-comment line (actual key) in hostkey.txt
130131 KEYLINE=$(grep -v '^#' hostkey.txt | head -n 1)
131132 if echo "$KEYLINE" | grep -q 'ssh-ed25519'; then
132- KEYTYPE="ed25519"
133+ KEYTYPE="ssh- ed25519"
133134 elif echo "$KEYLINE" | grep -q 'ecdsa'; then
134- KEYTYPE="ecdsa"
135+ KEYTYPE="ecdsa-sha2-nistp256 "
135136 elif echo "$KEYLINE" | grep -q 'ssh-rsa'; then
136- KEYTYPE="rsa"
137+ KEYTYPE="ssh- rsa"
137138 else
138139 echo "ERROR: Unknown key type in hostkey.txt: $KEYLINE"
139140 cat hostkey.txt
140141 exit 1
141142 fi
142143
143- # Extract the fingerprint for the detected key type (from the first matching key line)
144- FINGERPRINT =$(ssh-keygen -l -f hostkey.txt | grep -i "$KEYTYPE" | head -n 1 | awk '{print $2}')
145- if [ -z "$FINGERPRINT " ]; then
146- echo "ERROR: Could not extract fingerprint for $KEYTYPE from hostkey.txt"
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"
147148 cat hostkey.txt
148149 exit 1
149150 fi
150151
151- # Add the host key to PuTTY's cache using plink.exe
152- ./plink.exe -ssh -hostkey "$FINGERPRINT " "$SFTP_HOST" exit || true
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
153154
154155 # Clean up
155156 rm -f hostkey.txt
You can’t perform that action at this time.
0 commit comments