Commit Graph

1122 Commits (dcow/challenge-retry)
 

Author SHA1 Message Date
David Cowden 112fc59f46 make: Fix lint errors
Add `golanglint-ci` to the modules so it's available when running `make
lint`.
4 years ago
David Cowden 6c39439008 acme: make fmt 4 years ago
David Cowden 05780554d2 acme/retry: Cleanup tls-alpn-01 tests
This logic was already in the correct form so it was much easier to
update.
4 years ago
David Cowden d54f963b81 acme/retry: Update DNS challenge tests 4 years ago
David Cowden 0f63e43b10 acme: Update http-01 challenge tests
Add tests for the starting challenge statuses.
Removed unneeded db write test.
4 years ago
David Cowden 9103880f88 Merge branch 'master' into dcow/challenge-retry 4 years ago
Max ba91f4ed13
Merge pull request #260 from anxolerd/feat-force-cn-if-empty
[Feature] Force CommonName for certificates from ACME provisioner
4 years ago
David Cowden d5f95dee57 Merge branch 'master' into dcow/challenge-retry 4 years ago
Oleksandr Kovalchuk 4cd01b6868
Implement tests for forceCNOption modifier
Implement unit tests which checks forceCNOption modifier (implemented
in 322200b7db) is not broken and works
correctly.

Ref: https://github.com/smallstep/certificates/issues/259
4 years ago
Oleksandr Kovalchuk 893a53793a
Modify existing tests to accept forceCNOption modifier
Modify existing tests to pass with changes introduced in commit
322200b7db. This is safe to do as
tests assert exact length of modifiers, which has changed.
4 years ago
Oleksandr Kovalchuk 322200b7db
Implement modifier to set CommonName
Implement modifier which sets CommonName to the certificate if
CommonName is empty and forceCN is set in the config. Replace previous
implementation introduced in 0218018cee
with new modifier.

Closes https://github.com/smallstep/certificates/issues/259
Ref: https://github.com/smallstep/certificates/pull/260#issuecomment-628961322
4 years ago
Max ae15573f93
Merge pull request #249 from smallstep/clive-jevons/dynamic-host-detection-for-acme-directory
dynamic host detection for acme directory

Closes #235, #193
4 years ago
max furman e1409349f3 Allow relative URL for all links in ACME api ...
* Pass the request context all the way down the ACME stack.
* Save baseURL in context and use when generating ACME urls.
4 years ago
Oleksandr Kovalchuk 0218018cee
Generate Subject if `forceCN` and Subject is empty
When `forceCN` is set in provisioner configuration and
Subject.CommonName is empty, set Subject.CommonName to the first SAN
from the CSR to follow the letsencrypt's boulder behavior. This is done
in order to support system which require certificate's Subject field to
be non-empty.

N.B. certbot does not send Subject in its certificate request and relies
on similar behavior of letsencrypt.

Closes https://github.com/smallstep/certificates/issues/259
4 years ago
Oleksandr Kovalchuk 503c9f6101
Add config option to force CN
Add configuration option `forceCN` to ACME provisioner. When this option
is set to `true`, provisioner should generate Subject.CommonName for
certificate if it was not present in the request. Default value of
`false` should keep the existing behavior (do not modify CSR and
certificate).

Ref: https://github.com/smallstep/certificates/issues/259
4 years ago
David Cowden deacbdc358 acme: Don't panic on logic errors
Since it will ultimately 500 anyway, just return an error.
4 years ago
David Cowden f0228183f5 project: go mod tidy 4 years ago
David Cowden c378e0043a acme: Move ordinal to application
The authority now receives the ordinal in its constructor rather than a
global variable set at package initialization time. The ordinal is
passed via the command line option `--ordinal`.
4 years ago
David Cowden b8b3ca2ac1 acme/authority: Add descriptive intro to ValidateChallenge 4 years ago
David Cowden 5e5a76c3b5 acme/api: Set Link and Location headers for all 200
On the challenge resource, set "Link" and "Location" headers for all
successful requests to the challenge resource.
4 years ago
David Cowden 5354906b9c acme/api: Add func name to beginning of comment 4 years ago
David Cowden 976c8f82c6 acme/authority: Fix tests
Also, return early from ValidateChallenge if the challenge is already
valid. Interestingly, we aren't actually testing most of the
ValidateChallenge func, just the early error and return conditions. We
should add some more coverage here.
4 years ago
David Cowden b061d0af34 acme/authority: Fix error message in test
The error message was updated. Make the test should reflect the new
changes.
4 years ago
David Cowden 609e1312da acme/api: Write headers for invalid challenges
Include the "Link" and "Location" headers on invalid challenge
resources. An invalid challenge is still a perfectly acceptable
response.
4 years ago
David Cowden 8ae32f50f2 acme: Fix comment style to appease linter
The linter likes comments on public functions to start with their name,
for some reason...
4 years ago
David Cowden 794725bcc3 acme/api: Remove unused BackoffChallenge func
The mock has an old func that is no longer used. Remove it.
4 years ago
David Cowden 8556d45c3f acme/authority: Move comment onto correct block
The comment appeared too early.
4 years ago
Clive Jevons 639993bd09 Read host and protocol information from request for links
When constructing links we want to read the required host and protocol
information in a dynamic manner from the request for constructing ACME
links such as the directory information. This way, if the server is
running behind a proxy, and we don't know what the exposed URL should
be at runtime, we can construct the required information from the
host, tls and X-Forwarded-Proto fields in the HTTP request.
Inspired by the LetsEncrypt Boulder project (web/relative.go).
4 years ago
David Cowden 84af2ad562 acme: Fix test compile
* Add toACME test for the "processing" state.
4 years ago
David Cowden 2514b58f58 acme/api: Fixup handler_test
Remove superfluous test. Add test checking for the Retry-After header if
the challenge's RetryAfter field is set.
4 years ago
David Cowden 089e3aea4f acme/challenge: Fix error return type on KeyAuthorization
In golang, one should always return error types rather than interfaces
that conform to an error protocol. Why? Because of this:

    https://play.golang.org/p/MVa5vowuNRo

Feels ~~like JavaScript~~ bad, man.
4 years ago
David Cowden 9f18882973 acme/challenge: Copy retry information on clone
When cloning a challenge, deeply clone the retry field if it is not nil.
4 years ago
David Cowden a857c45847 acme/authority: Polymorph the challenge type
Prior to validation, we must wrap the base challenge in the correct
concrete challenge type so that we dispatch the correct validation
method.
4 years ago
David Cowden 2d0a00c4e1 acme/api: Add missing return
Stop execution when the error happens. This was previously a typo.
4 years ago
David Cowden 8326632f5b vscode: Ignore vscode binaries
It might make sense to check in the vscode workspace file if we can make
everything relative to the project directory.
4 years ago
David Cowden 9518ba44b1 provisioner/acme: Add TODO for retry restarts
The comment in acme/authority directs users to this file so put a TODO
in for posterity.
4 years ago
Max f126962f3f
Merge pull request #257 from smallstep/max/accUpd
ACME accountUpdate ignore fields not recognized by the server.
4 years ago
max furman 4cb777bdc1 ACME accountUpdate ignore fields not recognized by the server. 4 years ago
David Cowden bdadea8a37 acme: go fmt 4 years ago
Mariano Cano e855707dc2
Merge pull request #248 from smallstep/embedded-config-init
Initialize the required config fields on embedded authorities
4 years ago
Mariano Cano 4e544344f9 Initialize the required config fields on embedded authorities.
This change is to make easier the use of embedded authorities. It
can be difficult for third parties to know what fields are required.
The new init methods will define the minimum usable configuration.
4 years ago
David Cowden 9af4dd3692 acme: Retry challenge validation attempts
Section 8.2 of RFC 8555 explains how retries apply to the validation
process. However, much is left up to the implementer.

Add retries every 12 seconds for 2 minutes after a client requests a
validation. The challenge status remains "processing" indefinitely until
a distinct conclusion is reached. This allows a client to continually
re-request a validation by sending a post-get to the challenge resource
until the process fails or succeeds.

Challenges in the processing state include information about why a
validation did not complete in the error field. The server also includes
a Retry-After header to help clients and servers coordinate.

Retries are inherently stateful because they're part of the public API.
When running step-ca in a highly available setup with replicas, care
must be taken to maintain a persistent identifier for each instance
"slot". In kubernetes, this implies a *stateful set*.
4 years ago
Mariano Cano 9499aed6d1
Merge pull request #247 from smallstep/embedded-authority
Create a method to initialize the authority without a config file
4 years ago
Mariano Cano b5eab009b2 Rename method to NewEmbedded 4 years ago
Mariano Cano 824374bde0 Create a method to initialize the authority without a config file.
When the CA is embedded in a third party product like Caddy, the
config needed to use placeholders to be valid. This change adds
a new method `NewEmbeddedAuthority` that allows to create an
authority with the given options, the minimum options are a root
and intermediate certificate, and the intermediate key.

Fixes #218
4 years ago
max furman ca0861bf17 Add documentation for running HA 4 years ago
max furman 083abf5150 Fix a bit of getting started doc syntax 4 years ago
max furman 8227449746 Add docs for ssh cert duration for authority config.
Fixes #238.
4 years ago
max furman c1a84c1405 go mod tidy 4 years ago
max furman 1b6bf38b52 Bump cli to v0.14.3 4 years ago