Skip to content

RFC2136 Plugin - Unauthenticated update raises "Exception calling "Replace" with "2" argument(s): "String cannot be of zero length." #360

Closed
@dsbibby

Description

@dsbibby

Since the 4.5 release, the RFC2136 plugin raises an exception when performing unauthenticated updates:

Submit-ChallengeValidation : Exception calling "Replace" with "2" argument(s): "String cannot be of zero length.
Parameter name: oldValue"
At C:\Program Files\WindowsPowerShell\Modules\Posh-ACME\4.5.0\Public\New-PACertificate.ps1:218 char:9
+         Submit-ChallengeValidation
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Submit-ChallengeValidation], MethodInvocationException
    + FullyQualifiedErrorId : ArgumentException,Submit-ChallengeValidation

This appears to be due to line 298 in the plugin module which was introduced in #308:

    Write-Debug "Sending the following to nsupdate:`n$(($cmds -join "`n").Replace($TsigKeyValue,'************'))"

This line needs to take in to account that $TsigKeyValue may not be set. I have successfully made this work locally by modifying as below:

    if (-not $TsigKeyValue) {
        Write-Debug "Sending the following to nsupdate:`n$($cmds -join "`n")"
    } else {
        Write-Debug "Sending the following to nsupdate:`n$(($cmds -join "`n").Replace($TsigKeyValue,'************'))"
    }

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions