1358 Commits

Author SHA1 Message Date
Mariano Cano
1011f5f540 Improve validation in authorization path 2025-12-02 16:54:44 -08:00
Herman Slatman
745fb7a68e Remove deprecated +build tags 2025-11-04 00:27:47 +01:00
Herman Slatman
17a37a13bf Fix backdate support for ACME provisioner
Other provisioners did take into account the authority-wide
certificate backdate configuration already, but the ACME
provisioner did not. This commit adds `authority.GetBackdate`,
so that the ACME provisioner can use it if set.

Fixes: #927
2025-10-22 16:05:45 +02:00
Mariano Cano
8b093d923e Allow remote configuration of GCP organization id
This commit adds support for the remote configuration of the GCP
organization id.

It also reverts a change in smallstep/certificates#2331. Now the
projects service client is initialized just once, instead of doing it on
every operation.

Related to smallstep/cli#1449
2025-09-23 17:50:10 -07:00
Herman Slatman
f1092e103a Fix govet non-constant error format string issues 2025-09-09 01:38:33 +02:00
Mariano Cano
831d005df8 Fix gcp unit tests
This PR fixes the gcp unit tests and delays the initialization of the
cloud resource manager client.
2025-07-09 12:20:29 -07:00
Max
0d9f0513cf Merge branch 'master' into feat-gcp-enable-organization-checking 2025-07-09 08:49:52 -07:00
Mariano Cano
1ae78b803d Make poolhttp thread safe. 2025-07-02 12:46:32 -07:00
Mariano Cano
2b13b82ee3 Apply suggestions from code review
Co-authored-by: Herman Slatman <hslatman@users.noreply.github.com>
2025-07-02 10:48:37 -07:00
Mariano Cano
b690e1214d Remove commented code 2025-07-01 15:57:48 -07:00
Mariano Cano
f3c2e94576 Address linter errors 2025-07-01 14:58:57 -07:00
Mariano Cano
d4fd467e8a Memory improvements
This commit replaces the client in provisioners and webhooks with an
interface. Then it implements the interface using the new poolhttp
package. This package implements the HTTPClient interface but it is
backed by a sync.Pool, this improves memory, allowing the GC to clean
more memory. It also removes the timer in the keystore to avoid
having extra goroutines if a provisioner goes away. This commit avoids
creating the templates func multiple times, reducing some memory in the
heap.
2025-07-01 13:53:52 -07:00
Herman Slatman
5c2059ac13 Ignore ssh.InsecureKeyAlgoDSA usage from staticcheck linter 2025-06-09 20:56:10 +02:00
Mariano Cano
c26c8d7615 Add SSH certificate type to metrics
This commit passes the commit updates the Meter interface with SSH
certificates and X.509 certificate chains. This allows us to add
certificate specific things into the metrics. In this PR we are adding
the SSH certificate type, user, or host.
2025-06-05 16:41:42 -07:00
Mariano Cano
332aa4b39d Fix unit tests 2025-05-30 14:56:15 -07:00
Herman Slatman
acf4387180 Fix new golangci-lint v2 linter issues 2025-05-21 12:21:47 +02:00
Herman Slatman
27944b4eae Fix linter issues 2025-02-18 11:04:54 +01:00
Eric Norris
8b9bd89bcc refactor: make projectIDs authoritative 2025-02-04 15:45:41 -05:00
Eric Norris
a3db8de661 feat(gcp): enable organization checking
Before this commit, users could specify a hardcoded list of project IDs
to restrict access to the GCP provisioner. While this works, it can be
both toilsome to the team maintaining the Smallstep installation and
unintuitive to the internal infrastructure users that may encounter
errors as a result of their project not being added.

This commit is a rough attempt at adding support for validating that a
GCP project belongs to a given GCP organization. It does this by using
the `projects.getAncestry` call in the Cloud Resource Manager API. If
a token's project claim does not have the given organization ID as its
topmost ancestor, the token is rejected. This will require the
`resourcemanager.projects.get` IAM permission on the organization.

The new `OrganizationID` configuration directive is compatible with the
existing `ProjectIDs` configuration. If `ProjectIDs` is non-empty, it
will take precedence over the `OrganizationID` and act as it did before,
with the minor difference that if `OrganizationID` is also non-empty,
the provisioner will check the project's ancestry before rejecting the
token.

There are a couple outstanding questions and tasks after this commit. I
tried to strike the right balance between production-ready and
proof-of-concept here, so I'm open to any suggestions.

- Is the `authority/provisioner/gcp` package the right place for adding
  this functionality? Is the new struct the right approach?
- We should add tests for validating the organization ID.
- How should users configure the authentication for the Cloud Resource
  Manager client? I expect this would be similar to the Cloud KMS
  integration.
- Does Smallstep Professional run in an environment that will be able to
  authenticate with Google? We would need to either grant permissions to
  a Smallstep-owned Google service account if it's run in GCP, or set up
  something like Google's Workload Identity Federation to handle a K8s,
  AWS, or Azure deployment.
2025-01-10 13:47:19 -05:00
Herman Slatman
f4736325fa Use github.com/smallstep/linkedca @ v0.23.0 2025-01-03 18:24:19 +01:00
Mariano Cano
98087fec30 Move wrap transport initialization to constructor
This commit moves the wrap transport initialization to the controller
constructor.
2024-12-12 10:41:21 -08:00
Panagiotis Siatras
809c7023c9 Transport wrappers (#2103)
* internal/httptransport: implemented Wrapper & NoopWrapper

* added transport wrappers

* addressed review comments
2024-12-12 09:51:36 -08:00
Panagiotis Siatras
c986962154 internal/httptransport: initial implementation of the package (#2098)
* internal/httptransport: initial implementation of the package
* authority: refactored for httptransport
* ca: refactored for httptransport
* test: refactored for httptransport
2024-12-10 18:03:37 +02:00
Herman Slatman
4c7aa8a623 Add test case for Nebula certificate errors 2024-12-10 12:19:50 +01:00
Herman Slatman
9000271ce0 Fix new return value from nebula.NewCAPoolFromBytes 2024-12-10 12:10:25 +01:00
Mariano Cano
05295d9c6a Propagate human errors from webhooks
This commit adds a new field error in the webhook response that allows
to propagate errors to the client. With ACME, webhook errors are as
a new subproblem.
2024-11-14 18:29:36 -08:00
Mariano Cano
ff37bf1811 Add unit tests for scepchallenge webhooks 2024-11-12 13:15:11 -08:00
Mariano Cano
f2663dd9d9 Add data support on SCEPCHALLENGE webhooks
This commit adds support for using template data from SCEPCHALLENGE
webhooks.
2024-11-11 18:35:28 -08:00
Max
bb8605c079 Add DisableSSHCAUser and DisableSSHCAHost options to linkedca GCP provisioner (#2045)
* Add DisableSSHCAUser and DisableSSHCAHost options to linkedca GCP provisioner
2024-10-28 16:14:59 -07:00
Herman Slatman
b45b73f4cc Use github.com/smallstep/cli-utils instead of go.step.sm/cli-utils 2024-10-28 10:53:44 +01:00
Max
88443ddab9 Use dnsNamesSubsetValidator for IID provisioners (#2044)
* Use dnsNamesSubsetValidator for IID provisioners

... when disableCustomSANs is set to 'true'.

The DNS names in the certificate request must be a subset of the
authorized set of DNS names (from the IID token). The previous
functionality required that the DNS names in the certificate request
exactly matched the authorized DNS names.

* Update authority/provisioner/sign_options.go

Co-authored-by: Herman Slatman <hslatman@users.noreply.github.com>

* Update authority/provisioner/sign_options.go

Co-authored-by: Herman Slatman <hslatman@users.noreply.github.com>

* Use map[string]struct rather than map[string]bool for clarity

---------

Co-authored-by: Herman Slatman <hslatman@users.noreply.github.com>
2024-10-25 10:39:04 -07:00
Mariano Cano
6b872e8806 Do not fail creating the provisioner HTTP client
This commit avoids an error starting the CA if the `http.DefaultTransport`
is not an `*http.Transport`. If the DefaultTransport is overwritten, the
newHTTPClient method will return a simple *http.Client. With an
*http.Transport, it will return a client that trusts the system
certificate pool and the CA roots.
2024-10-15 18:08:58 -07:00
Herman Slatman
55b097a8ec Fix protobuf enum field type error message comparison test 2024-10-08 10:46:47 +02:00
Herman Slatman
1b09b1143e Use require and assert in a few more Nebula test functions 2024-08-20 23:09:11 +02:00
Herman Slatman
74d30d975a Add test for Nebula with ECDSA P256 keys 2024-08-20 23:01:38 +02:00
Herman Slatman
84d340d373 Merge branch 'master' into herman/fix-nebula-curve-param 2024-08-20 21:15:21 +02:00
Herman Slatman
aeb5e1b366 Address linter issues 2024-08-20 16:54:29 +02:00
Herman Slatman
92e95e4df3 Merge pull request #1940 from smallstep/mariano/self-trust
Allow to use private  IdPs with the OIDC provisioner
2024-08-13 09:59:56 +02:00
Herman Slatman
8e956cc6cd Merge branch 'master' into wire-acme-extensions 2024-08-06 20:24:02 +02:00
Herman Slatman
42bea945c0 Use uppercase SSH in policy error messages 2024-08-05 14:45:34 +02:00
Herman Slatman
31656e3d14 Clarify SSH policy evaluation errors with opposing SSH cert type 2024-08-05 14:12:25 +02:00
Herman Slatman
cae47aa690 Merge branch 'master' into wire-acme-extensions 2024-08-02 22:58:56 +02:00
Mariano Cano
ad70982cda Use testify packages in x5c_test.go 2024-07-24 12:13:57 -07:00
Mariano Cano
656a03e5d1 Use x5rt#S256 claim instead of kid 2024-07-23 12:51:11 -07:00
Mariano Cano
6c6ed46fef Remove sshFingerprintValidator and rename fingerprintValidator 2024-07-23 11:48:46 -07:00
Mariano Cano
ccce670504 Merge branch 'master' into fix-1637 2024-07-23 11:37:00 -07:00
Mariano Cano
88f161818d Merge pull request #1558 from adantop/feat/support-gcp-ssh-user-certs-opt-2
Allowing GCP provisioner to issue SSH User Certificates - Option 2
2024-07-23 11:13:51 -07:00
Mariano Cano
a01a2fbba1 Allow to use private IdPs with the OIDC provisioner
This commit allows using the OIDC provisioner with private identity
providers using a certificate from step-ca.

Fixes #1909
2024-07-22 19:01:37 -07:00
Mariano Cano
343e7308a8 Remove Disabled provisioner add add an Uninitialized state
This commit renames the Disabled provisioner to Uninitialized and adds
an state instead of just a boolean. It also adds tests.
2024-07-11 15:18:52 -07:00
Mariano Cano
39089325b5 Merge branch 'master' into mariano/init-provisioners 2024-07-11 12:43:26 -07:00