Skip to content

Commit

Permalink
Version bump to fix TOFU bug.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
rhymeswithmogul committed Feb 10, 2022
1 parent bf0d8e7 commit c106a0d
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
First release.
3 changes: 3 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -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.
2 changes: 1 addition & 1 deletion PSGemini.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
4 changes: 4 additions & 0 deletions src/PSGemini.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
}
Expand Down

0 comments on commit c106a0d

Please sign in to comment.