From c106a0d6b0a5c9a37ed54666bba92bf884f1aa60 Mon Sep 17 00:00:00 2001 From: Colin Cogle Date: Thu, 10 Feb 2022 10:14:47 -0500 Subject: [PATCH] Version bump to fix TOFU bug. Added null checks to Add- and Remove-PSGeminiKnownCertificate. I had included these in v1.0.0, but a file reversion seems to have overwritten them. New version already pushed to PSGallery. --- CHANGELOG.md | 5 ++++- NEWS | 3 +++ PSGemini.psd1 | 2 +- src/PSGemini.psm1 | 4 ++++ 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index afbf662..1abfb69 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,7 @@ # PSGemini ChangeLog +## Version 1.0.1 +If `$env:PSGeminiTOFUPath` was not defined, certificates could not be reliably added or removed. This has been corrected by checking for null or undefined values. + ## Version 1.0.0 -Coming soon \ No newline at end of file +First release. \ No newline at end of file diff --git a/NEWS b/NEWS index be51393..21598b3 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,6 @@ +VERSION 1.0.1 +Fixed certificate store issues that slipped past the cracks. + VERSION 1.0.0 PSGemini's first release. Client certificates are untested. Please test them out and report back. \ No newline at end of file diff --git a/PSGemini.psd1 b/PSGemini.psd1 index 9fad23b..fe4d15c 100644 --- a/PSGemini.psd1 +++ b/PSGemini.psd1 @@ -4,7 +4,7 @@ RootModule = 'src/PSGemini.psm1' # Version number of this module. -ModuleVersion = '1.0.0' +ModuleVersion = '1.0.1' # Supported PSEditions CompatiblePSEditions = @('Core', 'Desktop') diff --git a/src/PSGemini.psm1 b/src/PSGemini.psm1 index 1010455..650c41c 100644 --- a/src/PSGemini.psm1 +++ b/src/PSGemini.psm1 @@ -557,6 +557,8 @@ Function Add-PSGeminiKnownCertificate { ) Write-Verbose "Memorizing certificate for $HostName with fingerprint $Fingerprint and expiration date $ExpirationDate." + + $env:PSGeminiTOFUPath ??= (Join-Path -Path $env:HOME -ChildPath '.PSGemini_known_hosts.csv') Export-CSV -Path $env:PSGeminiTOFUPath -Append -Delimiter ',' -InputObject ([PSCustomObject]@{ HostName = $HostName Fingerprint = $Fingerprint @@ -577,6 +579,8 @@ Function Remove-PSGeminiKnownCertificate { [String] $Fingerprint ) + $env:PSGeminiTOFUPath ??= (Join-Path -Path $env:HOME -ChildPath '.PSGemini_known_hosts.csv') + If (-Not (Test-Path -Path $env:PSGeminiTOFUPath -PathType Leaf)) { Return $null }