Przeglądaj źródła

fix: enforce trusted remote host keys

root 3 miesięcy temu
rodzic
commit
8b2eef7c40
1 zmienionych plików z 4 dodań i 1 usunięć
  1. 4 1
      tools/windows/invoke-remote.ps1

+ 4 - 1
tools/windows/invoke-remote.ps1

@@ -1,8 +1,11 @@
 param([Parameter(ValueFromRemainingArguments=$true)][string[]]$Command)
 param([Parameter(ValueFromRemainingArguments=$true)][string[]]$Command)
 $ErrorActionPreference='Stop'
 $ErrorActionPreference='Stop'
 $delays=2,5,10,20,30
 $delays=2,5,10,20,30
+$knownHosts=Join-Path $HOME '.ssh\known_hosts'
 for($i=0;$i -lt $delays.Count;$i++){
 for($i=0;$i -lt $delays.Count;$i++){
-  & ssh -o ConnectTimeout=10 -o ServerAliveInterval=15 -o ServerAliveCountMax=4 edk2-uefi-lab @Command
+  & ssh -o StrictHostKeyChecking=yes -o "UserKnownHostsFile=$knownHosts" `
+    -o ConnectTimeout=10 -o ServerAliveInterval=15 -o ServerAliveCountMax=4 `
+    edk2-uefi-lab @Command
   if($LASTEXITCODE -eq 0){exit 0}
   if($LASTEXITCODE -eq 0){exit 0}
   if($i -eq 4){throw 'REMOTE_NETWORK_UNSTABLE'}
   if($i -eq 4){throw 'REMOTE_NETWORK_UNSTABLE'}
   Start-Sleep -Seconds $delays[$i]
   Start-Sleep -Seconds $delays[$i]