Skip to content

Commit f64ebf3

Browse files
authored
Merge branch 'smallstep:master' into master
2 parents 97aeb8d + 0b0f351 commit f64ebf3

File tree

156 files changed

+5765
-924
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

156 files changed

+5765
-924
lines changed

.github/workflows/release.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545
echo "DOCKER_TAGS_HSM=${{ env.DOCKER_TAGS_HSM }},${{ env.DOCKER_IMAGE }}:hsm" >> "${GITHUB_ENV}"
4646
- name: Create Release
4747
id: create_release
48-
uses: softprops/action-gh-release@c062e08bd532815e2082a85e87e3ef29c3e6d191 # v2.0.8
48+
uses: softprops/action-gh-release@da05d552573ad5aba039eaac05058a918a7bf631 # v2.2.2
4949
env:
5050
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5151
with:
@@ -59,7 +59,11 @@ jobs:
5959
permissions:
6060
id-token: write
6161
contents: write
62+
packages: write
6263
uses: smallstep/workflows/.github/workflows/goreleaser.yml@main
64+
with:
65+
enable-packages-upload: true
66+
is-prerelease: ${{ needs.create_release.outputs.is_prerelease == 'true' }}
6367
secrets: inherit
6468

6569
build_upload_docker:

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,10 @@ go.work.sum
2222
coverage.txt
2323
output
2424
vendor
25+
dist/
2526
.idea
2627
.envrc
28+
29+
# Packages files
30+
0x889B19391F774443-Certify.key
31+
gha-creds-*.json

.goreleaser.yml

Lines changed: 38 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,23 @@
11
# Documentation: https://goreleaser.com/customization/
2+
# yaml-language-server: $schema=https://goreleaser.com/static/schema-pro.json
23
project_name: step-ca
34
version: 2
45

6+
variables:
7+
packageName: step-ca
8+
packageRelease: 1 # Manually update release: in the nfpm section to match this value if you change this
9+
510
before:
611
hooks:
712
# You may remove this if you don't use go modules.
813
- go mod download
914

15+
after:
16+
hooks:
17+
# This script depends on IS_PRERELEASE env being set. This is set by CI in the Is Pre-release step.
18+
- cmd: bash scripts/package-repo-import.sh {{ .Var.packageName }} {{ .Version }}
19+
output: true
20+
1021
builds:
1122
-
1223
id: step-ca
@@ -61,10 +72,16 @@ nfpms:
6172
# Package metadata: dpkg --info dist/step_....deb
6273
#
6374
- &NFPM
75+
id: packages
6476
builds:
6577
- step-ca
66-
package_name: step-ca
67-
file_name_template: "{{ .PackageName }}_{{ .Version }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}{{ if .Mips }}_{{ .Mips }}{{ end }}"
78+
package_name: "{{ .Var.packageName }}"
79+
release: "1"
80+
file_name_template: >-
81+
{{- trimsuffix .ConventionalFileName .ConventionalExtension -}}
82+
{{- if and (eq .Arm "6") (eq .ConventionalExtension ".deb") }}6{{ end -}}
83+
{{- if not (eq .Amd64 "v1")}}{{ .Amd64 }}{{ end -}}
84+
{{- .ConventionalExtension -}}
6885
vendor: Smallstep Labs
6986
homepage: https://github.com/smallstep/certificates
7087
maintainer: Smallstep <[email protected]>
@@ -80,6 +97,13 @@ nfpms:
8097
contents:
8198
- src: debian/copyright
8299
dst: /usr/share/doc/step-ca/copyright
100+
rpm:
101+
signature:
102+
key_file: "{{ .Env.GPG_PRIVATE_KEY_FILE }}"
103+
deb:
104+
signature:
105+
key_file: "{{ .Env.GPG_PRIVATE_KEY_FILE }}"
106+
type: origin
83107
-
84108
<< : *NFPM
85109
id: unversioned
@@ -101,6 +125,12 @@ signs:
101125
args: ["sign-blob", "--oidc-issuer=https://token.actions.githubusercontent.com", "--output-certificate=${certificate}", "--output-signature=${signature}", "${artifact}", "--yes"]
102126
artifacts: all
103127

128+
publishers:
129+
- name: Google Cloud Artifact Registry
130+
ids:
131+
- packages
132+
cmd: ./scripts/package-upload.sh {{ abs .ArtifactPath }} {{ .Var.packageName }} {{ .Version }} {{ .Var.packageRelease }}
133+
104134
snapshot:
105135
name_template: "{{ .Tag }}-next"
106136

@@ -140,7 +170,10 @@ release:
140170
#### Linux
141171
142172
- 📦 [step-ca_linux_{{ .Version }}_amd64.tar.gz](https://dl.smallstep.com/gh-release/certificates/gh-release-header/{{ .Tag }}/step-ca_linux_{{ .Version }}_amd64.tar.gz)
143-
- 📦 [step-ca_{{ .Version }}_amd64.deb](https://dl.smallstep.com/gh-release/certificates/gh-release-header/{{ .Tag }}/step-ca_{{ .Version }}_amd64.deb)
173+
- 📦 [step-ca_{{ replace .Version "-" "." }}-{{ .Var.packageRelease }}_amd64.deb](https://dl.smallstep.com/gh-release/certificates/gh-release-header/{{ .Tag }}/step-ca_{{ replace .Version "-" "." }}-{{ .Var.packageRelease }}_amd64.deb)
174+
- 📦 [step-ca-{{ replace .Version "-" "." }}-{{ .Var.packageRelease }}.x86_64.rpm](https://dl.smallstep.com/gh-release/certificates/gh-release-header/{{ .Tag }}/step-ca-{{ replace .Version "-" "." }}-{{ .Var.packageRelease }}.x86_64.rpm)
175+
- 📦 [step-ca_{{ replace .Version "-" "." }}-{{ .Var.packageRelease }}_arm64.deb](https://dl.smallstep.com/gh-release/certificates/gh-release-header/{{ .Tag }}/step-ca_{{ replace .Version "-" "." }}-{{ .Var.packageRelease }}_arm64.deb)
176+
- 📦 [step-ca-{{ replace .Version "-" "." }}-{{ .Var.packageRelease }}.aarch64.rpm](https://dl.smallstep.com/gh-release/certificates/gh-release-header/{{ .Tag }}/step-ca-{{ replace .Version "-" "." }}-{{ .Var.packageRelease }}.aarch64.rpm)
144177
145178
#### OSX Darwin
146179
@@ -164,7 +197,7 @@ release:
164197
165198
```
166199
cosign verify-blob \
167-
--certificate step-ca_darwin_{{ .Version }}_amd64.tar.gz.sig.pem \
200+
--certificate step-ca_darwin_{{ .Version }}_amd64.tar.gz.pem \
168201
--signature step-ca_darwin_{{ .Version }}_amd64.tar.gz.sig \
169202
--certificate-identity-regexp "https://github\.com/smallstep/workflows/.*" \
170203
--certificate-oidc-issuer https://token.actions.githubusercontent.com \
@@ -198,7 +231,7 @@ release:
198231
# - glob: ./glob/foo/to/bar/file/foobar/override_from_previous
199232

200233
winget:
201-
-
234+
-
202235
# IDs of the archives to use.
203236
# Empty means all IDs.
204237
ids: [ default ]

CHANGELOG.md

Lines changed: 87 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,87 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
2525

2626
---
2727

28+
## [0.28.3] - 2025-03-17
29+
30+
- dependabot updates
31+
32+
33+
## [0.28.2] - 2025-02-20
34+
35+
### Added
36+
37+
- Added support for imported keys on YubiKey (smallstep/certificates#2113)
38+
- Enable storing ACME attestation payload (smallstep/certificates#2114)
39+
- Add ACME attestation format field to ACME challenge (smallstep/certificates#2124)
40+
41+
### Changed
42+
43+
- Added internal httptransport package to replace cloning of http.DefaultTransport (smallstep/certificates#2098, smallstep/certificates#2103, smallstep/certificates#2104)
44+
- For example, replacing http.DefaultTransport clone in provisioner webhook business logic.
45+
46+
47+
## [0.28.1] - 2024-11-19
48+
49+
### Added
50+
51+
- Support for using template data from SCEPCHALLENGE webhooks (smallstep/certificates#2065)
52+
- New field to Webhook response that allows for propagation of human readable errors to the client (smallstep/certificates#2066, smallstep/certificates#2069)
53+
- CICD for pushing DEB and RPM packages to packages.smallstep.com on releases (smallstep/certificates#2076)
54+
- PKCS11 utilities in HSM container image (smallstep/certificates#2077)
55+
56+
### Changed
57+
58+
- Artifact names for RPM and DEB packages in conformance with standards (smallstep/certificates#2076)
59+
60+
61+
## [0.28.0] - 2024-10-29
62+
63+
### Added
64+
65+
- Add options to GCP IID provisioner to enable or disable signing of SSH user and host certificates (smallstep/certificates#2045)
66+
67+
### Changed
68+
69+
- For IID provisioners with disableCustomSANs set to true, validate that the
70+
requested DNS names are a subset of the allowed DNS names (based on the IID token),
71+
rather than requiring an exact match to the entire list of allowed DNS names. (smallstep/certificates#2044)
72+
73+
74+
## [0.27.5] - 2024-10-17
75+
76+
### Added
77+
78+
- Option to log real IP (x-forwarded-for) in logging middleware (smallstep/certificates#2002)
79+
80+
### Fixed
81+
82+
- Pulled in updates to smallstep/pkcs7 to fix failing Windows SCEP enrollment certificates (smallstep/certificates#1994)
83+
84+
85+
## [0.27.4] - 2024-09-13
86+
87+
### Fixed
88+
89+
- Release worfklow
90+
91+
## [0.27.3] - 2024-09-13
92+
93+
### Added
94+
95+
- AWS auth method for Vault RA mode (smallstep/certificates#1976)
96+
- API endpoints for retrieving Intermediate certificates (smallstep/certificates#1962)
97+
- Enable use of OIDC provisioner with private identity providers and a certificate from step-ca (smallstep/certificates#1940)
98+
- Support for verifying `cnf` and `x5rt#S256` claim when provided in token (smallstep/certificates#1660)
99+
- Add Wire integration to ACME provisioner (smallstep/certificates#1666)
100+
101+
### Changed
102+
103+
- Clarified SSH certificate policy errors (smallstep/certificates#1951)
104+
105+
### Fixed
106+
107+
- Nebula ECDSA P-256 support (smallstep/certificates#1662)
108+
28109
## [0.27.2] - 2024-07-18
29110

30111
### Added
@@ -86,7 +167,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
86167

87168
## [0.26.0] - 2024-03-28
88169

89-
### Added
170+
### Added
90171

91172
- [TPM KMS](https://github.com/smallstep/crypto/tree/master/kms/tpmkms) support for CA keys (smallstep/certificates#1772)
92173
- Propagation of HTTP request identifier using X-Request-Id header (smallstep/certificates#1743, smallstep/certificates#1542)
@@ -96,7 +177,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
96177
- AWS `ca-west-1` identity document root certificate (smallstep/certificates#1715)
97178
- [COSE RS1](https://www.rfc-editor.org/rfc/rfc8812.html#section-2) as a supported algorithm with ACME `device-attest-01` challenge (smallstep/certificates#1663)
98179

99-
### Changed
180+
### Changed
100181

101182
- In an RA setup, let the CA decide the RA certificate lifetime (smallstep/certificates#1764)
102183
- Use Debian Bookworm in Docker containers (smallstep/certificates#1615)
@@ -146,17 +227,17 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
146227
- Added AWS public certificates for me-central-1 and ap-southeast-3
147228
(smallstep/certificates#1404)
148229
- Added namespace field to VaultCAS JSON config (smallstep/certificates#1424)
149-
- Added AWS public certificates for me-central-1 and ap-southeast-3
230+
- Added AWS public certificates for me-central-1 and ap-southeast-3
150231
(smallstep/certificates#1404)
151-
- Added unversioned filenames to Github release assets
232+
- Added unversioned filenames to Github release assets
152233
(smallstep/certificates#1435)
153234
- Send X5C leaf certificate to webhooks (smallstep/certificates#1485)
154235
- Added support for disableSmallstepExtensions claim (smallstep/certificates#1484)
155236
- Added all AWS Identity Document Certificates (smallstep/certificates#1404, smallstep/certificates#1510)
156237
- Added Winget release automation (smallstep/certificates#1519)
157238
- Added CSR to SCEPCHALLENGE webhook request body (smallstep/certificates#1523)
158239
- Added SCEP issuance notification webhook (smallstep/certificates#1544)
159-
- Added ability to disable color in the log text formatter
240+
- Added ability to disable color in the log text formatter
160241
(smallstep/certificates(#1559)
161242

162243
### Changed
@@ -184,7 +265,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
184265
(smallstep/certificates#1476, smallstep/crypto#288)
185266
- Fixed adding certificate templates with ASN.1 functions
186267
(smallstep/certificates#1500, smallstep/crypto#302)
187-
- Fixed a problem when the ca.json is truncated if the encoding of the
268+
- Fixed a problem when the ca.json is truncated if the encoding of the
188269
configuration fails (e.g., new provisioner with bad template data)
189270
(smallstep/cli#994, smallstep/certificates#1501)
190271
- Fixed provisionerOptionsToLinkedCA missing template and templateData

acme/api/eab.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ func validateEABJWS(ctx context.Context, jws *jose.JSONWebSignature) (string, *a
129129
keyID := header.KeyID
130130
nonce := header.Nonce
131131

132-
if !(algorithm == jose.HS256 || algorithm == jose.HS384 || algorithm == jose.HS512) {
132+
if algorithm != jose.HS256 && algorithm != jose.HS384 && algorithm != jose.HS512 {
133133
return "", acme.NewError(acme.ErrorMalformedType, "'alg' field set to invalid algorithm '%s'", algorithm)
134134
}
135135

acme/api/revoke.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ func isAccountAuthorized(_ context.Context, dbCert *acme.Certificate, certToBeRe
180180
func wrapRevokeErr(err error) *acme.Error {
181181
t := err.Error()
182182
if strings.Contains(t, "is already revoked") {
183-
return acme.NewError(acme.ErrorAlreadyRevokedType, t) //nolint:govet // allow non-constant error messages
183+
return acme.NewError(acme.ErrorAlreadyRevokedType, t)
184184
}
185185
return acme.WrapErrorISE(err, "error when revoking certificate")
186186
}
@@ -190,9 +190,9 @@ func wrapRevokeErr(err error) *acme.Error {
190190
func wrapUnauthorizedError(cert *x509.Certificate, unauthorizedIdentifiers []acme.Identifier, msg string, err error) *acme.Error {
191191
var acmeErr *acme.Error
192192
if err == nil {
193-
acmeErr = acme.NewError(acme.ErrorUnauthorizedType, msg) //nolint:govet // allow non-constant error messages
193+
acmeErr = acme.NewError(acme.ErrorUnauthorizedType, msg)
194194
} else {
195-
acmeErr = acme.WrapError(acme.ErrorUnauthorizedType, err, msg) //nolint:govet // allow non-constant error messages
195+
acmeErr = acme.WrapError(acme.ErrorUnauthorizedType, err, msg)
196196
}
197197
acmeErr.Status = http.StatusForbidden // RFC8555 7.6 shows example with 403
198198

acme/challenge.go

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import (
3939
"github.com/smallstep/certificates/acme/wire"
4040
"github.com/smallstep/certificates/authority/provisioner"
4141
wireprovisioner "github.com/smallstep/certificates/authority/provisioner/wire"
42+
"github.com/smallstep/certificates/internal/cast"
4243
)
4344

4445
type ChallengeType string
@@ -88,6 +89,8 @@ type Challenge struct {
8889
URL string `json:"url"`
8990
Target string `json:"target,omitempty"`
9091
Error *Error `json:"error,omitempty"`
92+
Payload []byte `json:"-"`
93+
PayloadFormat string `json:"-"`
9194
}
9295

9396
// ToLog enables response logging.
@@ -227,7 +230,7 @@ func tlsAlert(err error) uint8 {
227230
if errors.As(err, &opErr) {
228231
v := reflect.ValueOf(opErr.Err)
229232
if v.Kind() == reflect.Uint8 {
230-
return uint8(v.Uint())
233+
return uint8(v.Uint()) //nolint:gosec // handled by checking its type
231234
}
232235
}
233236
return 0
@@ -942,6 +945,8 @@ func deviceAttest01Validate(ctx context.Context, ch *Challenge, db DB, jwk *jose
942945
ch.Status = StatusValid
943946
ch.Error = nil
944947
ch.ValidatedAt = clock.Now().Format(time.RFC3339)
948+
ch.Payload = payload
949+
ch.PayloadFormat = format
945950

946951
// Store the fingerprint in the authorization.
947952
//
@@ -974,9 +979,9 @@ type tpmAttestationData struct {
974979
type coseAlgorithmIdentifier int32
975980

976981
const (
977-
coseAlgES256 coseAlgorithmIdentifier = -7
978-
coseAlgRS256 coseAlgorithmIdentifier = -257
979-
coseAlgRS1 coseAlgorithmIdentifier = -65535 // deprecated, but (still) often used in TPMs
982+
coseAlgES256 = coseAlgorithmIdentifier(-7)
983+
coseAlgRS256 = coseAlgorithmIdentifier(-257)
984+
coseAlgRS1 = coseAlgorithmIdentifier(-65535) // deprecated, but (still) often used in TPMs
980985
)
981986

982987
func doTPMAttestationFormat(_ context.Context, prov Provisioner, ch *Challenge, jwk *jose.JSONWebKey, att *attestationObject) (*tpmAttestationData, error) {
@@ -1101,8 +1106,13 @@ func doTPMAttestationFormat(_ context.Context, prov Provisioner, ch *Challenge,
11011106
return nil, NewDetailedError(ErrorBadAttestationStatementType, "invalid alg in attestation statement")
11021107
}
11031108

1109+
algI32, err := cast.SafeInt32(alg)
1110+
if err != nil {
1111+
return nil, WrapDetailedError(ErrorBadAttestationStatementType, err, "invalid alg %d in attestation statement", alg)
1112+
}
1113+
11041114
var hash crypto.Hash
1105-
switch coseAlgorithmIdentifier(alg) {
1115+
switch coseAlgorithmIdentifier(algI32) {
11061116
case coseAlgRS256, coseAlgES256:
11071117
hash = crypto.SHA256
11081118
case coseAlgRS1:

0 commit comments

Comments
 (0)