From e604b8edb9f8291f8efdff7d7404abf34e5bd643 Mon Sep 17 00:00:00 2001 From: "J.C. Jones" Date: Fri, 20 Mar 2015 15:05:32 -0700 Subject: [PATCH 1/2] Update per spec - Spec says the Challenge objects contain a field "Validated" not "Completed." - The Challenge object says "Validated" should be omitempty, but wasn't a pointer. - Swapped to using pointers so it will not be "completed":"0001-01-01T00:00:00Z" - Sort of related to [Issue #71 in Acme-Spec](https://github.com/letsencrypt/acme-spec/issues/71) - Remove commented-out line from Dockerfile (whoops) --- Dockerfile | 1 - core/core_test.go | 8 ++++---- core/objects.go | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1244e462b..301186fdf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,7 +13,6 @@ RUN go-wrapper download github.com/bifurcation/gose && \ go-wrapper download github.com/cloudflare/cfssl/auth && \ go-wrapper download github.com/cloudflare/cfssl/config && \ go-wrapper download github.com/cloudflare/cfssl/signer - #go-wrapper download github.com/cloudflare/cfssl/signer/remote && \ # Copy in the Boulder sources RUN mkdir -p /go/src/github.com/letsencrypt/boulder diff --git a/core/core_test.go b/core/core_test.go index e1c70f4e3..6114bb3b6 100644 --- a/core/core_test.go +++ b/core/core_test.go @@ -88,7 +88,7 @@ func TestMergeChallenge(t *testing.T) { t2 := time.Now().Add(-5 * time.Hour) challenge := Challenge{ Status: StatusPending, - Completed: t1, + Validated: &t1, Token: "asdf", Path: "", R: "asdf", @@ -97,7 +97,7 @@ func TestMergeChallenge(t *testing.T) { } response := Challenge{ Status: StatusValid, - Completed: t2, + Validated: &t2, Token: "qwer", Path: "qwer", R: "qwer", @@ -106,7 +106,7 @@ func TestMergeChallenge(t *testing.T) { } merged := Challenge{ Status: StatusPending, - Completed: t1, + Validated: &t1, Token: "asdf", Path: "qwer", R: "asdf", @@ -118,7 +118,7 @@ func TestMergeChallenge(t *testing.T) { if probe.Status != merged.Status { t.Errorf("MergeChallenge allowed response to overwrite status") } - if probe.Completed != merged.Completed { + if probe.Validated != merged.Validated { t.Errorf("MergeChallenge allowed response to overwrite completed time") } if probe.Token != merged.Token { diff --git a/core/objects.go b/core/objects.go index dce792349..b53bc890c 100644 --- a/core/objects.go +++ b/core/objects.go @@ -130,7 +130,7 @@ type Challenge struct { // If successful, the time at which this challenge // was completed by the server. - Completed time.Time `json:"completed,omitempty"` + Validated *time.Time `json:"validated,omitempty"` // A URI to which a response can be POSTed URI AcmeURL `json:"uri"` From 6247af9ca670f6d32ebbd5c2b1a8a00708adeaf7 Mon Sep 17 00:00:00 2001 From: "J.C. Jones" Date: Fri, 20 Mar 2015 16:26:35 -0700 Subject: [PATCH 2/2] Issue #41: Configurable baseUrl and listenAddress --- cmd/boulder-start/main.go | 63 +++++++++++++++++++++++++++++++-------- 1 file changed, 51 insertions(+), 12 deletions(-) diff --git a/cmd/boulder-start/main.go b/cmd/boulder-start/main.go index 023afbfe8..5b1c373a0 100644 --- a/cmd/boulder-start/main.go +++ b/cmd/boulder-start/main.go @@ -94,6 +94,20 @@ func main() { { Name: "monolithic", Usage: "Start the CA in monolithic mode, without using AMQP", + Flags: []cli.Flag { + cli.StringFlag{ + Name: "baseUrl", + EnvVar: "BASE_URL", + Value: "http://localhost:4000", + Usage: "Base URL", + }, + cli.StringFlag{ + Name: "listenAddress", + EnvVar: "LISTEN_ADDRESS", + Value: "0.0.0.0:4000", + Usage: "interface and port to listen on", + }, + }, Action: func(c *cli.Context) { // Grab parameters @@ -122,8 +136,7 @@ func main() { ca.SA = sa // Go! - authority := "0.0.0.0:4000" - urlBase := "http://" + authority + urlBase := c.String("baseUrl") newRegPath := "/acme/new-reg" regPath := "/acme/reg/" newAuthzPath := "/acme/new-authz" @@ -154,14 +167,28 @@ func main() { // XXX: Better way to do this? Part of improved configuration ra.AuthzBase = wfe.AuthzBase - fmt.Fprintf(os.Stderr, "Server running...\n") - err = http.ListenAndServe(authority, nil) + fmt.Fprintf(os.Stderr, "Server running, listening on %s...\n", c.String("listenAddress")) + err = http.ListenAndServe(c.String("listenAddress"), nil) failOnError(err, "Error starting HTTP server") }, }, { Name: "monolithic-amqp", Usage: "Start the CA in monolithic mode, using AMQP", + Flags: []cli.Flag { + cli.StringFlag{ + Name: "baseUrl", + EnvVar: "BASE_URL", + Value: "http://localhost:4000", + Usage: "Base URL", + }, + cli.StringFlag{ + Name: "listenAddress", + EnvVar: "LISTEN_ADDRESS", + Value: "0.0.0.0:4000", + Usage: "interface and port to listen on", + }, + }, Action: func(c *cli.Context) { // Grab parameters cfsslServer := c.GlobalString("cfssl") @@ -218,8 +245,7 @@ func main() { wfe.SA = &sac // Go! - authority := "0.0.0.0:4000" - urlBase := "http://" + authority + urlBase := c.String("baseUrl") newRegPath := "/acme/new-reg" regPath := "/acme/reg/" newAuthzPath := "/acme/new-authz" @@ -239,14 +265,28 @@ func main() { http.HandleFunc(authzPath, wfe.Authorization) http.HandleFunc(certPath, wfe.Certificate) - fmt.Fprintf(os.Stderr, "Server running...\n") - err = http.ListenAndServe(authority, nil) + fmt.Fprintf(os.Stderr, "Server running, listening on %s...\n", c.String("listenAddress")) + err = http.ListenAndServe(c.String("listenAddress"), nil) failOnError(err, "Error starting HTTP server") }, }, { Name: "wfe", Usage: "Start the WebFrontEnd", + Flags: []cli.Flag { + cli.StringFlag{ + Name: "baseUrl", + EnvVar: "BASE_URL", + Value: "http://localhost:4000", + Usage: "Base URL", + }, + cli.StringFlag{ + Name: "listenAddress", + EnvVar: "LISTEN_ADDRESS", + Value: "0.0.0.0:4000", + Usage: "interface and port to listen on", + }, + }, Action: func(c *cli.Context) { // Create necessary clients ch := amqpChannel(c.GlobalString("amqp")) @@ -263,8 +303,7 @@ func main() { wfe.SA = &sac // Connect the front end to HTTP - authority := "0.0.0.0:4000" - urlBase := "http://" + authority + urlBase := c.String("baseUrl") newRegPath := "/acme/new-reg" regPath := "/acme/reg/" newAuthzPath := "/acme/new-authz" @@ -284,8 +323,8 @@ func main() { http.HandleFunc(authzPath, wfe.Authorization) http.HandleFunc(certPath, wfe.Certificate) - fmt.Fprintf(os.Stderr, "Server running...\n") - http.ListenAndServe(authority, nil) + fmt.Fprintf(os.Stderr, "Server running, listening on %s...\n", c.String("listenAddress")) + http.ListenAndServe(c.String("listenAddress"), nil) }, }, {