Skip to content

Commit 9a2fd8b

Browse files
Fix
1 parent f195d73 commit 9a2fd8b

1 file changed

Lines changed: 16 additions & 2 deletions

File tree

apps/wolfsshd/test/sshd_login_grace_test.ps1

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,13 +90,27 @@ try {
9090
$sshd.WaitForExit(5000) | Out-Null
9191
}
9292

93-
if (Select-String -Path $logFile -Pattern "Failed login within grace period" -Quiet) {
93+
# Dump the log for diagnostics. With -d the daemon logs the grace summary
94+
# line "grace time = N timeout = X" and, on a drop, "Failed login within
95+
# grace period"; timeout = 0 means the timer never fired, while an empty log
96+
# means logging never reached the file.
97+
Write-Host "=== wolfsshd log: $logFile ==="
98+
if (Test-Path $logFile) {
99+
Write-Host ("log size: " + (Get-Item $logFile).Length + " bytes")
100+
Get-Content $logFile
101+
}
102+
else {
103+
Write-Host "(log file does not exist)"
104+
}
105+
Write-Host "=== end of wolfsshd log ==="
106+
107+
if ((Test-Path $logFile) -and
108+
(Select-String -Path $logFile -Pattern "Failed login within grace period" -Quiet)) {
94109
Write-Host "PASS: unauthenticated connection dropped at login grace deadline"
95110
$exitCode = 0
96111
}
97112
else {
98113
Write-Host "FAIL: grace period not enforced"
99-
if (Test-Path $logFile) { Get-Content $logFile -Tail 40 }
100114
}
101115
}
102116
catch {

0 commit comments

Comments
 (0)