Commit Graph

249 Commits

Author SHA1 Message Date
Roland Bracewell Shoemaker 54573b36ba Remove all stray copyright headers and appends the initial line to LICENSE.txt (#1853) 2016-05-31 12:32:04 -07:00
Daniel McCarney 5ce90a1a72 Make directory URLs relative to requested URL (#1847)
Prior to this PR the /directory JSON result was built once in Handler() and returned as-is for all requests. Each endpoint URL was fully qualified as an absolute URL using the BaseURL configuration
parameter. This required a configuration change in order to tweak the origin being used for subsequent requests. Returning purely relative URLs (e.g. /acme/new-reg vs http://localhost:4000/acme/new-reg) would break clients that assume absolute paths and we don't want that.

This PR introduces a new behaviour where the /directory JSON is built per-request using the HTTP Host header in place of the BaseURL. Clients will still receive a fully qualified URL in each directory entry but we gain the ability to more easily control the host without requiring config changes. To allow gradual migration via the config file we use the old /directory behaviour when a BaseURL is specified in the configuration file. This will address #1823.

Since the request.URL is not populated (Spare the Path attribute) we can not use request.URL.Scheme for the initial http:// vs https:// prefix when constructing the URLs and instead differentiate between the two cases using the req.TLS attribute. For cases (such as in production) where another service is terminating the initial request and making a subsequent HTTP request to the WFE we support the X-Forwarded-Proto header to ensure we use the original request's protocol when building URLs.

Many unit tests for the WFE assumed that when there is no BaseURL specified and no Host header is sent in the request, that the output will return relative paths. This PR changes that behaviour to always return absolute URLs by defaulting to localhost for the Host when it is not specified via the initial request or the BaseURL config option. This PR changes the expected test output to match this behaviour.
2016-05-27 10:17:19 -07:00
Roland Bracewell Shoemaker 5abe7e3cdf Move CSR normalization/verification to their own methods (#1826)
* Split CSR testing and name hoisting into own functions, verify CSR in RA & CA

* Move tests around and various other fixes

* 1.5.3 doesn't have the needed stringer

* Move functions to their own lib

* Remove unused imports

* Move MaxCNLength and BadSignatureAlgorithms to csr package

* Always normalizeCSR in VerifyCSR and de-export it

* Update comments
2016-05-26 14:17:41 -07:00
Jacob Hoffman-Andrews e62a99039d Use MarshalIndent in WFE (#1811)
* Use MarshalIndent in WFE

This makes it easier to read output without first running it through a JSON
prettifier.

* Fix test
* marshal->marshalIndent

https://github.com/letsencrypt/boulder/pull/1811
2016-05-12 20:31:36 -07:00
Roland Bracewell Shoemaker 8ee578c3b7 Check JWK is valid before sending to SA (#1782)
Update vendored github.com/square/go-jose
Check key is valid before sending to SA
2016-05-03 14:26:52 -07:00
Kane York b7cf618f5d context.Context as the first parameter of all RPC calls (#1741)
Change core/interfaces to put context.Context as the first parameter of all RPC calls in preparation for gRPC.
2016-04-19 11:34:36 -07:00
Jacob Hoffman-Andrews e6c17e1717 Switch to new vendor style (#1747)
* Switch to new vendor style.

* Fix metrics generate command.

* Fix miekg/dns types_generate.

* Use generated copies of files.

* Update miekg to latest.

Fixes a problem with `go generate`.

* Set GO15VENDOREXPERIMENT.

* Build in letsencrypt/boulder.

* fix travis more.

* Exclude vendor instead of godeps.

* Replace some ...

* Fix unformatted cmd

* Fix errcheck for vendorexp

* Add GO15VENDOREXPERIMENT to Makefile.

* Temp disable errcheck.

* Restore master fetch.

* Restore errcheck.

* Build with 1.6 also.

* Match statsd.*"

* Skip errcheck unles Go1.6.

* Add other ignorepkg.

* Fix errcheck.

* move errcheck

* Remove go1.6 requirement.

* Put godep-restore with errcheck.

* Remove go1.6 dep.

* Revert master fetch revert.

* Remove -r flag from godep save.

* Set GO15VENDOREXPERIMENT in Dockerfile and remove _worskpace.

* Fix Godep version.
2016-04-18 12:51:36 -07:00
Kane York 25b45a45ec Errcheck errors fixed (#1677)
* Fix all errcheck errors
* Add errcheck to test.sh
* Add a new sa.Rollback method to make handling errors in rollbacks easier.
This also causes a behavior change in the VA. If a HTTP connection is
abruptly closed after serving the headers for a non-200 response, the
reported error will be the read failure instead of the non-200.
2016-04-12 16:54:01 -07:00
Jacob Hoffman-Andrews ecc04e8e61 Refactor log package (#1717)
- Remove error signatures from log methods. This means fewer places where errcheck will show ignored errors.
- Pull in latest cfssl to be compatible with errorless log messages.
- Reduce the number of message priorities we support to just those we actually use.
- AuditNotice -> AuditInfo
- Remove InfoObject (only one use, switched to Info)
- Remove EmergencyExit and related functions in favor of panic
- Remove SyslogWriter / AuditLogger separate types in favor of a single interface, Logger, that has all the logging methods on it.
- Merge mock log into logger. This allows us to unexport the internals but still override them in the mock.
- Shorten names to be compatible with Go style: New, Set, Get, Logger, NewMock, etc.
- Use a shorter log format for stdout logs.
- Remove "... Starting" log messages. We have better information in the "Versions" message logged at startup.

Motivation: The AuditLogger / SyslogWriter distinction was confusing and exposed internals only necessary for tests. Some components accepted one type and some accepted the other. This made it hard to consistently use mock loggers in tests. Also, the unnecessarily fat interface for AuditLogger made it hard to meaningfully mock out.
2016-04-08 16:12:20 -07:00
Jacob Hoffman-Andrews 090565a711 Accept = in orphan-finder.
Also, when a certificate already exists, treat that as info, not error.

Update mock logger to allow matching by log level, and fix WFE and VA tests
correspondingly.
2016-04-05 17:46:51 -07:00
Kane York 6024176ee0 Add calls to PerformValidation in the RA 2016-03-23 10:39:23 -07:00
Jacob Hoffman-Andrews 231129bb78 Pull out WFE's MockCA into a shared mock.
Also:

- Use MockCA in the RA test instead of a real CA.
- Since the mock CA doesn't write to an SA, remove a part of the RA test that
checked that the certificate was written. That code is already tested in the CA,
where the test belongs.
- Format the constants in RA test to be more copy-and-pasteable.
- Remove Printf in mocks/log.go and test/db.go to make failed test output more readable.
2016-03-20 17:23:15 -07:00
Roland Shoemaker 00b617b59a Switch to upstream square/go-jose + pull latest 2016-03-15 13:54:22 -07:00
Roland Shoemaker 03427ccb81 Remove telephone contacts as a option 2016-03-08 16:03:16 -08:00
Damian Poddebniak a3aac300b9 Merge branch 'master' into ChallengesFor_remove_error_type_return 2016-02-17 09:24:44 +01:00
Jessica Frazelle 3df2e942be
go fmt fixes
Signed-off-by: Jessica Frazelle <acidburn@docker.com>
2016-02-16 12:19:15 -08:00
Damian Poddebniak 01cee65079 Changed return type for "ChallengesFor". 2016-02-13 23:01:28 +01:00
Hugo Landau 5c9be5385b ECDSA account key support 2016-01-14 06:56:35 +00:00
Hugo Landau f218e314f8 Add good key testing for ECDSA. 2016-01-07 22:48:38 +00:00
Roland Bracewell Shoemaker 35e8489bd0 Merge branch 'master' into correct_head_content_length 2016-01-04 16:35:16 -08:00
Alex Gaynor cbeffe96a6 Fixed a bunch of typos 2016-01-04 18:39:34 -05:00
Jeff Hodges 426ec155aa correct Content-Length/Transfer-Encoding on HEAD
Fixes #1320
2016-01-04 15:03:14 -08:00
Jeff Hodges 6b0e53b8e0 use ProblemDetails inside of wfe
This uses ProblemDetails throughout the wfe. This is the last step in
allowing the backend services to pass ProblemDetails from RPCs through
to the user.

Updates #1153.

Fixes #1161.
2015-12-15 11:44:33 -08:00
Jeff Hodges 1dc5e53c5a add HTTPStatus to ProblemDetails
For #1161
2015-11-24 23:14:51 -08:00
Roland Shoemaker 15ae242cfe Add tests for new error 2015-11-22 17:19:43 -08:00
Richard Barnes 0835ee8db3 Update VA and WFE to use revised nonce mechanisms in go-jose 2015-11-17 13:50:17 -08:00
Jacob Hoffman-Andrews 8b2c50bc65 Return pointer from NewNonceService. 2015-11-11 12:47:38 -08:00
Jeff Hodges 13cab5c257 add Google Safe Browsing API calls
This allows us to call the Google Safe Browsing calls through the VA.

If the RA config's boolean UseIsSafeDomain is true, the RA will make the RPC
call to the VA during its NewAuthorization.

If the VA config's GoogleSafeBrowsingConfig struct is not nil, the VA
will check the Google Safe Browsing API in
VA.IsSafeDomain. If the GoogleSafeBrowsingConfig struct is nil, it will
always return true.

In order to actually make requests, the VA's GoogleSafeBrowsingConfig
will need to have a directory on disk it can store the local GSB hashes
it will check first and a working Google API key for the GSB API.

Fixes #1058
2015-11-06 16:37:34 -08:00
Richard Barnes ded5fa6f20 Back out field name changes 2015-10-21 21:55:45 -04:00
Richard Barnes cddf1d27ef RealIP->clientAddr and fix nits 2015-10-21 09:07:35 -04:00
Richard Barnes fdc0e2cce9 Merge branch 'master' to wfe_context 2015-10-21 08:47:07 -04:00
Richard Barnes 0fd89d3048 Use a fake clock for the WFE and mock SA 2015-10-20 17:12:59 -04:00
Richard Barnes bd1dee5bbc StatusGone -> StatusNotFound 2015-10-20 11:01:24 -04:00
Jeff Hodges 7d04ea98cf add context to WFE errors
This change makes the use of requestEvent more prominent and provides
some nice handler types to make that better.

In order to avoid stomping on Error, requestEvent gains an Errors string
slice.

Fixes #552
2015-10-16 22:40:51 -07:00
Richard Barnes 8e64139ac2 Merge branch 'master' into shorter-expiry-for-pending 2015-10-13 15:55:38 -07:00
Tom Clegg 22ef139419 Merge branch 'master' into challenge-head 2015-10-09 19:54:45 -07:00
Richard Barnes c3dacf5dae Make expired authz URLs inaccessible. 2015-10-09 17:45:34 -04:00
Richard Barnes 109f7cf75e Limit the number of contacts per registration 2015-10-09 16:35:19 -04:00
Jacob Hoffman-Andrews 487d08ec2e Add rate limiting by registration IP. 2015-10-08 15:47:08 -07:00
Tom Clegg 1bf8cfb4fd Handle HEAD correctly in Challenge 2015-10-07 23:37:41 -07:00
Tom Clegg f32c26c1de Merge branch 'master' into log-actual-ip
Conflicts:
	wfe/web-front-end_test.go
2015-10-07 11:58:23 -07:00
Tom Clegg 75bc949985 Merge branch 'master' into log-actual-ip 2015-10-07 08:20:38 -07:00
Richard Barnes b01e99ea04 Merge branch 'master' into golint 2015-10-07 10:42:36 -04:00
Tom Clegg 01b40466a4 Log actual remote IP, in addition to X-Forwarded-For header, in request log and csrLog 2015-10-05 23:30:58 -07:00
Richard Barnes f064c6d5c7 Merge branch 'master' to 'sig-reuse' 2015-10-05 23:16:16 -04:00
bifurcation 90050e91f5 Merge branch 'master' into golint 2015-10-05 19:23:24 -04:00
Jeff Hodges 5217af94b0 allow whitelisting by a specific reg id
Currently, the whitelisted registration ID is one that is impossible for the
database to return. Once the partner's registration is in place, we can
deploy a change to it.

Fixes #810
2015-10-05 14:11:38 -07:00
bifurcation e7f47d4f09 Merge branch 'master' into golint 2015-10-05 00:14:29 -04:00
Richard Barnes 961e392521 Merge branch 'master' into sig-reuse 2015-10-04 23:25:54 -04:00
Richard Barnes 498deeb518 Fix golint in ./mocks 2015-10-04 20:37:06 -04:00