677 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
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
b690e1214d Remove commented code 2025-07-01 15:57:48 -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
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
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
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
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
Mariano Cano
191f1a598d Fix unit tests after introduction of rawSubject 2024-07-09 17:04:46 -07:00
Mariano Cano
f8bda96940 Apply suggestions from code review
Co-authored-by: Herman Slatman <hslatman@users.noreply.github.com>
2024-07-01 12:49:26 -07:00
Mariano Cano
cb9abbe25b Add support for validities in templates
This commit upgrades go.step.sm/crypto with a version that adds support
for setting validity bounds in templates. It also adds support for these
in the certificate modifiers.

The priority for the validity bounds are:
1. Coming from flags.
2. Coming from the template.
3. Defaults.
2024-06-28 16:21:12 -07:00
Mariano Cano
a7a3a4c5d9 Fix comments from code review 2024-06-12 15:42:27 -07:00
Mariano Cano
a017c0e3fb Merge branch 'master' into AuthParams 2024-06-12 15:39:07 -07:00
Max
474f5d28f4 Update hardcoded AWS certs (#1881) 2024-06-11 10:04:44 -07:00
adantop
bedb040659 Updating options to be Disable* and of type *bool 2024-05-30 13:54:03 -06:00
max furman
99ce13a4ea Fix linter warnings 2024-05-20 11:06:53 -07:00
adantop
3ab951f963 Replace sanitized username with google pattern service account usernames 2024-05-09 15:00:14 -06:00
adantop
0a43b55d53 Adding test for new attribute defaults 2024-05-08 09:43:11 -06:00
adantop
e8af03cd36 Allow User Certs for Service Accounts in the GCP provisioner
adding tests

linting

refactor to generate just the sign options

fix linting and adding toggle for user and host certs

resolving linting error
2024-05-08 08:34:58 -06:00