Skip to content

Commit f168dca

Browse files
committed
remove DSA from pester tests
1 parent 10d0316 commit f168dca

File tree

2 files changed

+45
-46
lines changed

2 files changed

+45
-46
lines changed

contrib/win32/openssh/config.h.vs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1767,4 +1767,3 @@
17671767
#define HAVE_EVP_PKEY_GET0_RSA 1
17681768
#define HAVE_EVP_MD_CTX_NEW 1
17691769
#define HAVE_EVP_MD_CTX_FREE 1
1770-
#define WITH_DSA 1

regress/pesterTests/KeyUtils.Tests.ps1

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Describe "E2E scenarios for ssh key management" -Tags "CI" {
1010
{
1111
Throw "`$OpenSSHTestInfo is null. Please run Set-OpenSSHTestEnvironment to set test environments."
1212
}
13-
13+
1414
$testDir = "$($OpenSSHTestInfo["TestDataPath"])\$suite"
1515
if( -not (Test-path $testDir -PathType Container))
1616
{
@@ -21,24 +21,24 @@ Describe "E2E scenarios for ssh key management" -Tags "CI" {
2121
$NoLibreSSL = $OpenSSHTestInfo["NoLibreSSL"]
2222
if($NoLibreSSL)
2323
{
24-
$keytypes = @("ed25519")
24+
$keytypes = @("ed25519")
2525
}
2626
else
2727
{
28-
$keytypes = @("rsa","dsa","ecdsa","ed25519")
28+
$keytypes = @("rsa","ecdsa","ed25519")
2929
}
30-
30+
3131
$ssouser = $OpenSSHTestInfo["SSOUser"]
32-
32+
3333
$systemSid = Get-UserSID -WellKnownSidType ([System.Security.Principal.WellKnownSidType]::LocalSystemSid)
34-
$adminsSid = Get-UserSID -WellKnownSidType ([System.Security.Principal.WellKnownSidType]::BuiltinAdministratorsSid)
34+
$adminsSid = Get-UserSID -WellKnownSidType ([System.Security.Principal.WellKnownSidType]::BuiltinAdministratorsSid)
3535
$currentUserSid = Get-UserSID -User "$($env:USERDOMAIN)\$($env:USERNAME)"
3636
$objUserSid = Get-UserSID -User $ssouser
37-
$everyoneSid = Get-UserSID -WellKnownSidType ([System.Security.Principal.WellKnownSidType]::WorldSid)
37+
$everyoneSid = Get-UserSID -WellKnownSidType ([System.Security.Principal.WellKnownSidType]::WorldSid)
3838

3939
function ValidateRegistryACL {
4040
param([string]$UserSid = $currentUserSid, $count)
41-
$agentPath = "Registry::HKEY_Users\$UserSid\Software\OpenSSH\Agent"
41+
$agentPath = "Registry::HKEY_Users\$UserSid\Software\OpenSSH\Agent"
4242
$myACL = Get-ACL $agentPath
4343
$OwnerSid = Get-UserSid -User $myACL.Owner
4444
$OwnerSid.Equals($adminsSid) | Should Be $true
@@ -48,8 +48,8 @@ Describe "E2E scenarios for ssh key management" -Tags "CI" {
4848

4949
foreach ($a in $myACL.Access) {
5050
$id = Get-UserSid -User $a.IdentityReference
51-
$identities -contains $id | Should Be $true
52-
([System.UInt32]$a.RegistryRights.value__) | Should Be $FullControlPerm
51+
$identities -contains $id | Should Be $true
52+
([System.UInt32]$a.RegistryRights.value__) | Should Be $FullControlPerm
5353
$a.AccessControlType | Should Be ([System.Security.AccessControl.AccessControlType]::Allow)
5454
$a.IsInherited | Should Be $false
5555
$a.InheritanceFlags | Should Be ([System.Security.AccessControl.InheritanceFlags]::None)
@@ -60,27 +60,27 @@ Describe "E2E scenarios for ssh key management" -Tags "CI" {
6060
$entries.Count | Should Be $count
6161
if($count -gt 0)
6262
{
63-
Test-Path $agentPath\keys | Should be $true
63+
Test-Path $agentPath\keys | Should be $true
6464
$entries | % {
6565
$keyentryAcl = Get-Acl $_.pspath
6666
$OwnerSid = Get-UserSid -User $keyentryAcl.Owner
6767
$OwnerSid.Equals($adminsSid) | Should Be $true
6868
$keyentryAcl.Access | Should Not Be $
6969
foreach ($a in $keyentryAcl.Access) {
7070
$id = Get-UserSid -User $a.IdentityReference
71-
$identities -contains $id | Should Be $true
72-
([System.UInt32]$a.RegistryRights.value__) | Should Be $FullControlPerm
71+
$identities -contains $id | Should Be $true
72+
([System.UInt32]$a.RegistryRights.value__) | Should Be $FullControlPerm
7373
$a.AccessControlType | Should Be ([System.Security.AccessControl.AccessControlType]::Allow)
7474
$a.IsInherited | Should Be $false
7575
$a.InheritanceFlags | Should Be ([System.Security.AccessControl.InheritanceFlags]::None)
7676
$a.PropagationFlags | Should Be ([System.Security.AccessControl.PropagationFlags]::None)
7777
}
78-
}
78+
}
7979
}
8080
else
8181
{
8282
Test-Path $agentPath\keys | Should be $false
83-
}
83+
}
8484
}
8585

8686
#only validate owner and ACEs of the file
@@ -94,7 +94,7 @@ Describe "E2E scenarios for ssh key management" -Tags "CI" {
9494
$currentOwnerSid = Get-UserSid -User $myACL.Owner
9595
$currentOwnerSid.Equals($currentUserSid) | Should Be $true
9696
$myACL.Access | Should Not Be $null
97-
97+
9898
$ReadAccessPerm = ([System.UInt32] [System.Security.AccessControl.FileSystemRights]::Read.value__) -bor `
9999
([System.UInt32] [System.Security.AccessControl.FileSystemRights]::ReadAndExecute.value__) -bor `
100100
([System.UInt32] [System.Security.AccessControl.FileSystemRights]::Synchronize.value__)
@@ -105,7 +105,7 @@ Describe "E2E scenarios for ssh key management" -Tags "CI" {
105105
([System.UInt32] [System.Security.AccessControl.FileSystemRights]::Synchronize.value__)
106106

107107
$FullControlPerm = [System.UInt32] [System.Security.AccessControl.FileSystemRights]::FullControl.value__
108-
108+
109109
if($FilePath.EndsWith(".pub")) {
110110
if ($IsHostKey) {
111111
$myACL.Access.Count | Should Be 3
@@ -123,7 +123,7 @@ Describe "E2E scenarios for ssh key management" -Tags "CI" {
123123

124124
foreach ($a in $myACL.Access) {
125125
$id = Get-UserSid -User $a.IdentityReference
126-
$identities -contains $id | Should Be $true
126+
$identities -contains $id | Should Be $true
127127

128128
switch ($id)
129129
{
@@ -144,7 +144,7 @@ Describe "E2E scenarios for ssh key management" -Tags "CI" {
144144
break;
145145
}
146146
}
147-
147+
148148
$a.AccessControlType | Should Be ([System.Security.AccessControl.AccessControlType]::Allow)
149149
$a.IsInherited | Should Be $false
150150
$a.InheritanceFlags | Should Be ([System.Security.AccessControl.InheritanceFlags]::None)
@@ -157,9 +157,9 @@ Describe "E2E scenarios for ssh key management" -Tags "CI" {
157157
$stderrFile=Join-Path $testDir "$tC.$tI.stderr.txt"
158158
$stdoutFile=Join-Path $testDir "$tC.$tI.stdout.txt"
159159
$logFile = Join-Path $testDir "$tC.$tI.log.txt"
160-
}
160+
}
161161

162-
AfterEach {$tI++;}
162+
AfterEach {$tI++;}
163163

164164
Context "$tC -ssh-keygen all key types" {
165165

@@ -171,14 +171,14 @@ Describe "E2E scenarios for ssh key management" -Tags "CI" {
171171
remove-item ssh_host_*_key* -ErrorAction SilentlyContinue
172172
ssh-keygen -A
173173
Pop-Location
174-
174+
175175
Get-ChildItem (join-path $testDir ssh_host_*_key) | % {
176176
ValidateKeyFile -FilePath $_.FullName
177177
}
178178

179179
Get-ChildItem (join-path $testDir ssh_host_*_key.pub) | % {
180180
ValidateKeyFile -FilePath $_.FullName
181-
}
181+
}
182182
}
183183

184184
It "$tC.$tI - Keygen -t -f" {
@@ -193,7 +193,7 @@ Describe "E2E scenarios for ssh key management" -Tags "CI" {
193193
else
194194
{
195195
ssh-keygen -t $type -P $keypassphrase -f $keyPath
196-
}
196+
}
197197
ValidateKeyFile -FilePath $keyPath
198198
ValidateKeyFile -FilePath "$keyPath.pub" -IsHostKey $false
199199
}
@@ -216,7 +216,7 @@ Describe "E2E scenarios for ssh key management" -Tags "CI" {
216216
AfterAll{$tC++}
217217

218218
# Executing ssh-agent will start agent service
219-
# This is to support typical Unix scenarios where
219+
# This is to support typical Unix scenarios where
220220
# running ssh-agent will setup the agent for current session
221221
It "$tC.$tI - ssh-agent starts agent service" {
222222
if ((Get-Service ssh-agent).Status -eq "Running") {
@@ -237,7 +237,7 @@ Describe "E2E scenarios for ssh key management" -Tags "CI" {
237237

238238
$nullFile = join-path $testDir ("$tC.$tI.nullfile")
239239
$null > $nullFile
240-
240+
241241
foreach($type in $keytypes)
242242
{
243243
$keyPath = Join-Path $testDir "id_$type"
@@ -259,7 +259,7 @@ Describe "E2E scenarios for ssh key management" -Tags "CI" {
259259
Set-content -Path $keyPathDifferentEnding -value "$newcontent"
260260
Repair-UserKeyPermission $keyPathDifferentEnding -confirm:$false
261261
iex "cmd /c `"ssh-add $keyPathDifferentEnding < $nullFile 2> nul `""
262-
}
262+
}
263263
}
264264

265265
#remove SSH_ASKPASS
@@ -269,7 +269,7 @@ Describe "E2E scenarios for ssh key management" -Tags "CI" {
269269
$allkeys = ssh-add -L
270270
$allkeys | Set-Content (Join-Path $testDir "$tC.$tI.allkeyonAdd.txt")
271271
ValidateRegistryACL -count $allkeys.Count
272-
272+
273273
foreach($type in $keytypes)
274274
{
275275
$keyPath = Join-Path $testDir "id_$type"
@@ -297,7 +297,7 @@ Describe "E2E scenarios for ssh key management" -Tags "CI" {
297297

298298
$allkeys = @(ssh-add -L)
299299
ValidateRegistryACL -count $allkeys.count
300-
}
300+
}
301301
}
302302

303303
Context "$tC ssh-keygen known_hosts operations" {
@@ -329,7 +329,7 @@ Describe "E2E scenarios for ssh key management" -Tags "CI" {
329329
$keyFileName = "sshadd_userPermTestkey_ed25519"
330330
$keyFilePath = Join-Path $testDir $keyFileName
331331
Remove-Item -path "$keyFilePath*" -Force -ErrorAction SilentlyContinue
332-
ssh-keygen.exe -t ed25519 -f $keyFilePath -P $keypassphrase
332+
ssh-keygen.exe -t ed25519 -f $keyFilePath -P $keypassphrase
333333
#set up SSH_ASKPASS
334334
Add-PasswordSetting -Pass $keypassphrase
335335
$tI=1
@@ -341,7 +341,7 @@ Describe "E2E scenarios for ssh key management" -Tags "CI" {
341341
AfterEach {
342342
if(Test-Path $keyFilePath) {
343343
Repair-FilePermission -FilePath $keyFilePath -Owner $currentUserSid -FullAccessNeeded $currentUserSid,$systemSid,$adminsSid -confirm:$false
344-
}
344+
}
345345
}
346346

347347
AfterAll {
@@ -351,22 +351,22 @@ Describe "E2E scenarios for ssh key management" -Tags "CI" {
351351
}
352352

353353
It "$tC.$tI- ssh-add - positive (Secured private key owned by current user)" {
354-
#setup to have current user as owner and grant it full control
354+
#setup to have current user as owner and grant it full control
355355
Repair-FilePermission -FilePath $keyFilePath -Owner $currentUserSid -FullAccessNeeded $currentUserSid,$systemSid,$adminsSid -confirm:$false
356356

357357
# for ssh-add to consume SSh_ASKPASS, stdin should not be TTY
358358
cmd /c "ssh-add $keyFilePath < $nullFile 2> nul"
359359
$LASTEXITCODE | Should Be 0
360360
$allkeys = ssh-add -L
361-
$pubkeyraw = ((Get-Content "$keyFilePath.pub").Split(' '))[1]
361+
$pubkeyraw = ((Get-Content "$keyFilePath.pub").Split(' '))[1]
362362
@($allkeys | where { $_.contains($pubkeyraw) }).count | Should Be 1
363-
363+
364364
#clean up
365365
cmd /c "ssh-add -d $keyFilePath 2> nul "
366366
}
367367

368368
It "$tC.$tI - ssh-add - positive (Secured private key owned by Administrators group and the current user has no explicit ACE)" {
369-
#setup to have local admin group as owner and grant it full control
369+
#setup to have local admin group as owner and grant it full control
370370
Repair-FilePermission -FilePath $keyFilePath -Owner $adminsSid -FullAccessNeeded $adminsSid,$systemSid -confirm:$false
371371

372372
# for ssh-add to consume SSh_ASKPASS, stdin should not be TTY
@@ -375,7 +375,7 @@ Describe "E2E scenarios for ssh key management" -Tags "CI" {
375375
$allkeys = ssh-add -L
376376
$pubkeyraw = ((Get-Content "$keyFilePath.pub").Split(' '))[1]
377377
@($allkeys | where { $_.contains($pubkeyraw) }).count | Should Be 1
378-
378+
379379
#clean up
380380
cmd /c "ssh-add -d $keyFilePath 2> nul "
381381
}
@@ -390,13 +390,13 @@ Describe "E2E scenarios for ssh key management" -Tags "CI" {
390390
$allkeys = ssh-add -L
391391
$pubkeyraw = ((Get-Content "$keyFilePath.pub").Split(' '))[1]
392392
@($allkeys | where { $_.contains($pubkeyraw) }).count | Should Be 1
393-
393+
394394
#clean up
395395
cmd /c "ssh-add -d $keyFilePath 2> nul "
396396
}
397397

398398
It "$tC.$tI - ssh-add - positive (Secured private key owned by local system group)" {
399-
#setup to have local admin group as owner and grant it full control
399+
#setup to have local admin group as owner and grant it full control
400400
Repair-FilePermission -FilePath $keyFilePath -Owners $systemSid -FullAccessNeeded $systemSid,$adminsSid -confirm:$false
401401

402402
# for ssh-add to consume SSh_ASKPASS, stdin should not be TTY
@@ -405,11 +405,11 @@ Describe "E2E scenarios for ssh key management" -Tags "CI" {
405405
$allkeys = ssh-add -L
406406
$pubkeyraw = ((Get-Content "$keyFilePath.pub").Split(' '))[1]
407407
@($allkeys | where { $_.contains($pubkeyraw) }).count | Should Be 1
408-
408+
409409
#clean up
410410
cmd /c "ssh-add -d $keyFilePath 2> nul "
411411
}
412-
412+
413413
It "$tC.$tI- ssh-add - negative (other account can access private key file)" {
414414
#setup to have current user as owner and grant it full control
415415
Repair-FilePermission -FilePath $keyFilePath -Owners $currentUserSid -FullAccessNeeded $currentUserSid,$adminsSid, $systemSid -ReadAccessNeeded $objUserSid -confirm:$false
@@ -418,7 +418,7 @@ Describe "E2E scenarios for ssh key management" -Tags "CI" {
418418
$LASTEXITCODE | Should Not Be 0
419419

420420
$allkeys = ssh-add -L
421-
$pubkeyraw = ((Get-Content "$keyFilePath.pub").Split(' '))[1]
421+
$pubkeyraw = ((Get-Content "$keyFilePath.pub").Split(' '))[1]
422422
@($allkeys | where { $_.contains($pubkeyraw) }).count | Should Be 0
423423
}
424424

@@ -430,13 +430,13 @@ Describe "E2E scenarios for ssh key management" -Tags "CI" {
430430
$LASTEXITCODE | Should Not Be 0
431431

432432
$allkeys = ssh-add -L
433-
$pubkeyraw = ((Get-Content "$keyFilePath.pub").Split(' '))[1]
433+
$pubkeyraw = ((Get-Content "$keyFilePath.pub").Split(' '))[1]
434434
@($allkeys | where { $_.contains($pubkeyraw) }).count | Should Be 0
435435
}
436436
}
437-
437+
438438
Context "$tC - ssh-keyscan test cases" {
439-
BeforeAll {
439+
BeforeAll {
440440
$tI=1
441441
$port = $OpenSSHTestInfo["Port"]
442442
Remove-item (join-path $testDir "$tC.$tI.out.txt") -force -ErrorAction SilentlyContinue
@@ -464,7 +464,7 @@ Describe "E2E scenarios for ssh key management" -Tags "CI" {
464464

465465
It "$tC.$tI - ssh-keyscan with -f -t" -Skip:$NoLibreSSL {
466466
Set-Content -Path tmp.txt -Value "127.0.0.1"
467-
cmd /c "ssh-keyscan -p $port -f tmp.txt -t rsa,dsa 2>&1 > $outputFile"
467+
cmd /c "ssh-keyscan -p $port -f tmp.txt -t rsa 2>&1 > $outputFile"
468468
$outputFile | Should Contain '.*ssh-rsa.*'
469469
}
470470
}

0 commit comments

Comments
 (0)