From 51991cd26466fe153c5a745252da9a268462096c Mon Sep 17 00:00:00 2001 From: Jacob Hoffman-Andrews Date: Fri, 6 Oct 2017 11:10:02 -0700 Subject: [PATCH] Fix logging of hostname in VA. (#3149) The pbToAuthzMeta method in rpc/pb-marshalling.go only propagates ID and registrationID, not hostname. So log the "domain" parameter instead. --- va/va.go | 2 +- va/va_test.go | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/va/va.go b/va/va.go index dfc173319..7a7981945 100644 --- a/va/va.go +++ b/va/va.go @@ -868,7 +868,7 @@ func (va *ValidationAuthorityImpl) PerformValidation(ctx context.Context, domain logEvent := verificationRequestEvent{ ID: authz.ID, Requester: authz.RegistrationID, - Hostname: authz.Identifier.Value, + Hostname: domain, RequestTime: va.clk.Now(), } vStart := va.clk.Now() diff --git a/va/va_test.go b/va/va_test.go index be229fb63..67f5b7ae9 100644 --- a/va/va_test.go +++ b/va/va_test.go @@ -824,7 +824,7 @@ func TestDNSValidationEmpty(t *testing.T) { } func TestPerformValidationValid(t *testing.T) { - va, _ := setup(nil, 0) + va, mockLog := setup(nil, 0) // create a challenge with well known token chalDNS := core.DNSChallenge01() @@ -840,6 +840,13 @@ func TestPerformValidationValid(t *testing.T) { if samples != 1 { t.Errorf("Wrong number of samples for successful validation. Expected 1, got %d", samples) } + resultLog := mockLog.GetAllMatching(`Validation result`) + if len(resultLog) != 1 { + t.Fatalf("Wrong number of matching lines for 'Validation result'") + } + if !strings.Contains(resultLog[0], `"Hostname":"good-dns01.com"`) { + t.Errorf("PerformValidation didn't log validation hostname.") + } } func TestDNSValidationFailure(t *testing.T) {