Merge pull request #106245 from mauriciopoppe/gce-windows-ssh-fix

Use simple match instead of regex match in GCE Windows OpenSSH startup script
This commit is contained in:
Kubernetes Prow Robot 2021-11-09 15:30:46 -08:00 committed by GitHub
commit 884a900820
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -241,11 +241,11 @@ while($true) {
# https://github.com/PowerShell/Win32-OpenSSH/wiki/Various-Considerations
#
# these files will be append only, only new keys will be added
$found = Select-String -Path $user_keys_file -Pattern $ssh_key
$found = Select-String -Path $user_keys_file -Pattern $ssh_key -SimpleMatch
if ($found -eq $null) {
Add-Content -Encoding UTF8 $user_keys_file $ssh_key
}
$found = Select-String -Path $administrator_keys_file -Pattern $ssh_key
$found = Select-String -Path $administrator_keys_file -Pattern $ssh_key -SimpleMatch
if ($found -eq $null) {
Add-Content -Encoding UTF8 $administrator_keys_file $ssh_key
}