forked from openssh/openssh-portable
-
Notifications
You must be signed in to change notification settings - Fork 319
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable support for FIDO2/U2F security keys (#541)
- Loading branch information
1 parent
991465e
commit 4cd1fd1
Showing
17 changed files
with
851 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
param ( | ||
[string] $paths_target_file_path, | ||
[string] $destDir, | ||
[switch] $override | ||
) | ||
|
||
# Workaround that $PSScriptRoot is not support on ps version 2 | ||
If ($PSVersiontable.PSVersion.Major -le 2) {$PSScriptRoot = Split-Path -Parent $MyInvocation.MyCommand.Path} | ||
|
||
if([string]::IsNullOrEmpty($paths_target_file_path)) | ||
{ | ||
$paths_target_file_path = Join-Path $PSScriptRoot "paths.targets" | ||
} | ||
|
||
if([string]::IsNullOrEmpty($destDir)) | ||
{ | ||
$destDir = $PSScriptRoot | ||
} | ||
|
||
if($override) | ||
{ | ||
Remove-Item (join-path $destDir "libfido2") -Recurse -Force -ErrorAction SilentlyContinue | ||
} | ||
elseif (Test-Path (Join-Path $destDir "libfido2") -PathType Container) | ||
{ | ||
return | ||
} | ||
|
||
[xml] $buildConfig = Get-Content $paths_target_file_path | ||
$version = $buildConfig.Project.PropertyGroup.fido2Version | ||
|
||
Write-Host "Downloading libfido2 version:$version" | ||
Write-Host "paths_target_file_path:$paths_target_file_path" | ||
Write-Host "destDir:$destDir" | ||
Write-Host "override:$override" | ||
|
||
$zip_path = Join-Path $PSScriptRoot "libfido2.zip" | ||
|
||
$release_url = "https://ambientworks.net/tmp/libfido2-1.10-b32020cc-win.zip" | ||
Write-Host "release_url:$release_url" | ||
|
||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 -bor ` | ||
[Net.SecurityProtocolType]::Tls11 -bor ` | ||
[Net.SecurityProtocolType]::Tls | ||
|
||
Remove-Item $zip_path -Force -ErrorAction SilentlyContinue | ||
Invoke-WebRequest -Uri $release_url -OutFile $zip_path -UseBasicParsing | ||
if(-not (Test-Path $zip_path)) | ||
{ | ||
throw "failed to download libfido2 version:$version" | ||
} | ||
|
||
# XXX check pgp sig? | ||
Expand-Archive -Path $zip_path -DestinationPath $destDir -Force -ErrorAction SilentlyContinue -ErrorVariable e | ||
if($e -ne $null) | ||
{ | ||
throw "Error when expand zip file. libfido2 version:$version" | ||
} | ||
|
||
Rename-Item -Path $destDir\libfido2-1.10-b32020cc-win -NewName libfido2 | ||
Remove-Item $zip_path -Force -ErrorAction SilentlyContinue | ||
|
||
Write-Host "Succesfully downloaded libfido2 version:$version" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.