diff --git a/cmd/boulder/main.go b/cmd/boulder/main.go index 23d74c5e0..1117531ba 100644 --- a/cmd/boulder/main.go +++ b/cmd/boulder/main.go @@ -37,7 +37,7 @@ func main() { err = sa.InitTables() cmd.FailOnError(err, "Unable to initialize SA") ra := ra.NewRegistrationAuthorityImpl(auditlogger) - va := va.NewValidationAuthorityImpl(auditlogger) + va := va.NewValidationAuthorityImpl(auditlogger, c.CA.TestMode) ca, err := ca.NewCertificateAuthorityImpl(auditlogger, c.CA.Server, c.CA.AuthKey, c.CA.Profile) cmd.FailOnError(err, "Unable to create CA") diff --git a/cmd/shell.go b/cmd/shell.go index a53e9e525..2391c6ecd 100644 --- a/cmd/shell.go +++ b/cmd/shell.go @@ -53,9 +53,10 @@ type Config struct { } CA struct { - Server string - AuthKey string - Profile string + Server string + AuthKey string + Profile string + TestMode bool } SA struct { diff --git a/test/example-config.json b/test/example-config.json index 1e288488e..1d54985c7 100644 --- a/test/example-config.json +++ b/test/example-config.json @@ -33,7 +33,8 @@ "ca": { "server": "localhost:9000", "authKey": "79999d86250c367a2b517a1ae7d409c1", - "profile": "ee" + "profile": "ee", + "testMode": true }, "sa": { diff --git a/va/validation-authority.go b/va/validation-authority.go index b5599aa3b..64eb4ecb9 100644 --- a/va/validation-authority.go +++ b/va/validation-authority.go @@ -22,11 +22,12 @@ import ( type ValidationAuthorityImpl struct { RA core.RegistrationAuthority log *blog.AuditLogger + TestMode bool } -func NewValidationAuthorityImpl(logger *blog.AuditLogger) ValidationAuthorityImpl { +func NewValidationAuthorityImpl(logger *blog.AuditLogger, tm bool) ValidationAuthorityImpl { logger.Notice("Validation Authority Starting") - return ValidationAuthorityImpl{log: logger} + return ValidationAuthorityImpl{log: logger, TestMode: tm} } // Validation methods @@ -39,9 +40,12 @@ func (va ValidationAuthorityImpl) validateSimpleHTTPS(identifier core.AcmeIdenti return } - // XXX: Local version; uncomment for real version - url := fmt.Sprintf("http://localhost:5001/.well-known/acme-challenge/%s", challenge.Path) - //url := fmt.Sprintf("https://%s/.well-known/acme-challenge/%s", identifier, challenge.Path) + url := "" + if va.TestMode { + url = fmt.Sprintf("http://localhost:5001/.well-known/acme-challenge/%s", challenge.Path) + } else { + url = fmt.Sprintf("https://%s/.well-known/acme-challenge/%s", identifier, challenge.Path) + } httpRequest, err := http.NewRequest("GET", url, nil) if err != nil { @@ -96,8 +100,17 @@ func (va ValidationAuthorityImpl) validateDvsni(identifier core.AcmeIdentifier, zName := hex.EncodeToString(z) // Make a connection with SNI = nonceName - hostPort := "localhost:5001" - //hostPort := identifier + ":443" // XXX: Local version; uncomment for real version + + hostPort := "" + if va.TestMode { + hostPort = "localhost:5001" + } else { + if identifier.Type != "dns" { + challenge.Status = core.StatusInvalid + return + } + hostPort = identifier.Value + ":443" + } conn, err := tls.Dial("tcp", hostPort, &tls.Config{ ServerName: nonceName, InsecureSkipVerify: true,