Merge pull request #42 from letsencrypt/jcj-hackathon

Customizable URLs, Listen Addresses, and Spec-Compliance w/ Challenges
This commit is contained in:
jsha 2015-03-20 16:49:30 -07:00
commit 3ca689caf7
4 changed files with 56 additions and 18 deletions

View File

@ -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/auth && \
go-wrapper download github.com/cloudflare/cfssl/config && \ go-wrapper download github.com/cloudflare/cfssl/config && \
go-wrapper download github.com/cloudflare/cfssl/signer go-wrapper download github.com/cloudflare/cfssl/signer
#go-wrapper download github.com/cloudflare/cfssl/signer/remote && \
# Copy in the Boulder sources # Copy in the Boulder sources
RUN mkdir -p /go/src/github.com/letsencrypt/boulder RUN mkdir -p /go/src/github.com/letsencrypt/boulder

View File

@ -94,6 +94,20 @@ func main() {
{ {
Name: "monolithic", Name: "monolithic",
Usage: "Start the CA in monolithic mode, without using AMQP", 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) { Action: func(c *cli.Context) {
// Grab parameters // Grab parameters
@ -122,8 +136,7 @@ func main() {
ca.SA = sa ca.SA = sa
// Go! // Go!
authority := "0.0.0.0:4000" urlBase := c.String("baseUrl")
urlBase := "http://" + authority
newRegPath := "/acme/new-reg" newRegPath := "/acme/new-reg"
regPath := "/acme/reg/" regPath := "/acme/reg/"
newAuthzPath := "/acme/new-authz" newAuthzPath := "/acme/new-authz"
@ -154,14 +167,28 @@ func main() {
// XXX: Better way to do this? Part of improved configuration // XXX: Better way to do this? Part of improved configuration
ra.AuthzBase = wfe.AuthzBase ra.AuthzBase = wfe.AuthzBase
fmt.Fprintf(os.Stderr, "Server running...\n") fmt.Fprintf(os.Stderr, "Server running, listening on %s...\n", c.String("listenAddress"))
err = http.ListenAndServe(authority, nil) err = http.ListenAndServe(c.String("listenAddress"), nil)
failOnError(err, "Error starting HTTP server") failOnError(err, "Error starting HTTP server")
}, },
}, },
{ {
Name: "monolithic-amqp", Name: "monolithic-amqp",
Usage: "Start the CA in monolithic mode, using 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) { Action: func(c *cli.Context) {
// Grab parameters // Grab parameters
cfsslServer := c.GlobalString("cfssl") cfsslServer := c.GlobalString("cfssl")
@ -218,8 +245,7 @@ func main() {
wfe.SA = &sac wfe.SA = &sac
// Go! // Go!
authority := "0.0.0.0:4000" urlBase := c.String("baseUrl")
urlBase := "http://" + authority
newRegPath := "/acme/new-reg" newRegPath := "/acme/new-reg"
regPath := "/acme/reg/" regPath := "/acme/reg/"
newAuthzPath := "/acme/new-authz" newAuthzPath := "/acme/new-authz"
@ -239,14 +265,28 @@ func main() {
http.HandleFunc(authzPath, wfe.Authorization) http.HandleFunc(authzPath, wfe.Authorization)
http.HandleFunc(certPath, wfe.Certificate) http.HandleFunc(certPath, wfe.Certificate)
fmt.Fprintf(os.Stderr, "Server running...\n") fmt.Fprintf(os.Stderr, "Server running, listening on %s...\n", c.String("listenAddress"))
err = http.ListenAndServe(authority, nil) err = http.ListenAndServe(c.String("listenAddress"), nil)
failOnError(err, "Error starting HTTP server") failOnError(err, "Error starting HTTP server")
}, },
}, },
{ {
Name: "wfe", Name: "wfe",
Usage: "Start the WebFrontEnd", 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) { Action: func(c *cli.Context) {
// Create necessary clients // Create necessary clients
ch := amqpChannel(c.GlobalString("amqp")) ch := amqpChannel(c.GlobalString("amqp"))
@ -263,8 +303,7 @@ func main() {
wfe.SA = &sac wfe.SA = &sac
// Connect the front end to HTTP // Connect the front end to HTTP
authority := "0.0.0.0:4000" urlBase := c.String("baseUrl")
urlBase := "http://" + authority
newRegPath := "/acme/new-reg" newRegPath := "/acme/new-reg"
regPath := "/acme/reg/" regPath := "/acme/reg/"
newAuthzPath := "/acme/new-authz" newAuthzPath := "/acme/new-authz"
@ -284,8 +323,8 @@ func main() {
http.HandleFunc(authzPath, wfe.Authorization) http.HandleFunc(authzPath, wfe.Authorization)
http.HandleFunc(certPath, wfe.Certificate) http.HandleFunc(certPath, wfe.Certificate)
fmt.Fprintf(os.Stderr, "Server running...\n") fmt.Fprintf(os.Stderr, "Server running, listening on %s...\n", c.String("listenAddress"))
http.ListenAndServe(authority, nil) http.ListenAndServe(c.String("listenAddress"), nil)
}, },
}, },
{ {

View File

@ -88,7 +88,7 @@ func TestMergeChallenge(t *testing.T) {
t2 := time.Now().Add(-5 * time.Hour) t2 := time.Now().Add(-5 * time.Hour)
challenge := Challenge{ challenge := Challenge{
Status: StatusPending, Status: StatusPending,
Completed: t1, Validated: &t1,
Token: "asdf", Token: "asdf",
Path: "", Path: "",
R: "asdf", R: "asdf",
@ -97,7 +97,7 @@ func TestMergeChallenge(t *testing.T) {
} }
response := Challenge{ response := Challenge{
Status: StatusValid, Status: StatusValid,
Completed: t2, Validated: &t2,
Token: "qwer", Token: "qwer",
Path: "qwer", Path: "qwer",
R: "qwer", R: "qwer",
@ -106,7 +106,7 @@ func TestMergeChallenge(t *testing.T) {
} }
merged := Challenge{ merged := Challenge{
Status: StatusPending, Status: StatusPending,
Completed: t1, Validated: &t1,
Token: "asdf", Token: "asdf",
Path: "qwer", Path: "qwer",
R: "asdf", R: "asdf",
@ -118,7 +118,7 @@ func TestMergeChallenge(t *testing.T) {
if probe.Status != merged.Status { if probe.Status != merged.Status {
t.Errorf("MergeChallenge allowed response to overwrite 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") t.Errorf("MergeChallenge allowed response to overwrite completed time")
} }
if probe.Token != merged.Token { if probe.Token != merged.Token {

View File

@ -130,7 +130,7 @@ type Challenge struct {
// If successful, the time at which this challenge // If successful, the time at which this challenge
// was completed by the server. // 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 // A URI to which a response can be POSTed
URI AcmeURL `json:"uri"` URI AcmeURL `json:"uri"`