Skip to content

Commit 26dd97e

Browse files
committed
Merge branch 'master' into context-authority
2 parents 400b1ec + 02fd0e7 commit 26dd97e

Some content is hidden

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

44 files changed

+855
-399
lines changed

.github/ISSUE_TEMPLATE/bug-report.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Bug Report
2+
description: File a bug report
3+
title: "[Bug]: "
4+
labels: ["bug", "needs triage"]
5+
body:
6+
- type: markdown
7+
attributes:
8+
value: |
9+
Thanks for taking the time to fill out this bug report!
10+
- type: textarea
11+
id: steps
12+
attributes:
13+
label: Steps to Reproduce
14+
description: Tell us how to reproduce this issue.
15+
placeholder: These are the steps!
16+
validations:
17+
required: true
18+
- type: textarea
19+
id: your-env
20+
attributes:
21+
label: Your Environment
22+
value: |-
23+
* OS -
24+
* `step-ca` Version -
25+
validations:
26+
required: true
27+
- type: textarea
28+
id: expected-behavior
29+
attributes:
30+
label: Expected Behavior
31+
description: What did you expect to happen?
32+
validations:
33+
required: true
34+
- type: textarea
35+
id: actual-behavior
36+
attributes:
37+
label: Actual Behavior
38+
description: What happens instead?
39+
validations:
40+
required: true
41+
- type: textarea
42+
id: context
43+
attributes:
44+
label: Additional Context
45+
description: Add any other context about the problem here.
46+
validations:
47+
required: false
48+
- type: textarea
49+
id: contributing
50+
attributes:
51+
label: Contributing
52+
value: |
53+
Vote on this issue by adding a 👍 reaction.
54+
To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).
55+
validations:
56+
required: false

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 0 additions & 27 deletions
This file was deleted.

.github/ISSUE_TEMPLATE/documentation-request.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,20 @@
11
---
22
name: Documentation Request
33
about: Request documentation for a feature
4-
title: ''
5-
labels: documentation, needs triage
4+
title: '[Docs]:'
5+
labels: docs, needs triage
66
assignees: ''
77

88
---
99

10+
## Hello!
11+
<!-- Please leave this section as-is, it's designed to help others in the community know how to interact with our GitHub issues. -->
12+
13+
- Vote on this issue by adding a 👍 reaction
14+
- If you want to document this feature, comment to let us know (we'll work with you on design, scheduling, etc.)
15+
16+
## Affected area/feature
17+
1018
<!---
1119
Tell us which feature you'd like to see documented.
1220
- Where would you like that documentation to live (command line usage output, website, github markdown on the repo)?

.github/ISSUE_TEMPLATE/enhancement.md

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,24 @@
11
---
22
name: Enhancement
3-
about: Suggest an enhancement to step certificates
3+
about: Suggest an enhancement to step-ca
44
title: ''
55
labels: enhancement, needs triage
66
assignees: ''
77

88
---
99

10-
### What would you like to be added
10+
## Hello!
11+
<!-- Please leave this section as-is,
12+
it's designed to help others in the community know how to interact with our GitHub issues. -->
1113

14+
- Vote on this issue by adding a 👍 reaction
15+
- If you want to implement this feature, comment to let us know (we'll work with you on design, scheduling, etc.)
1216

13-
### Why this is needed
17+
## Issue details
18+
19+
<!-- Enhancement requests are most helpful when they describe the problem you're having
20+
as well as articulating the potential solution you'd like to see built. -->
21+
22+
## Why is this needed?
23+
24+
<!-- Let us know why you think this enhancement would be good for the project or community. -->

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
uses: golangci/golangci-lint-action@v2
3434
with:
3535
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
36-
version: 'v1.45.0'
36+
version: 'v1.45.2'
3737

3838
# Optional: working directory, useful for monorepos
3939
# working-directory: somedir

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
uses: golangci/golangci-lint-action@v2
3434
with:
3535
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
36-
version: 'v1.45.0'
36+
version: 'v1.45.2'
3737

3838
# Optional: working directory, useful for monorepos
3939
# working-directory: somedir

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ integration: bin/$(BINNAME)
151151
#########################################
152152

153153
fmt:
154-
$Q gofmt -l -w $(SRC)
154+
$Q gofmt -l -s -w $(SRC)
155155

156156
lint:
157157
$Q golangci-lint run --timeout=30m

authority/admins.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ func (a *Authority) StoreAdmin(ctx context.Context, adm *linkedca.Admin, prov pr
4949
return admin.WrapErrorISE(err, "error creating admin")
5050
}
5151
if err := a.admins.Store(adm, prov); err != nil {
52-
if err := a.reloadAdminResources(ctx); err != nil {
52+
if err := a.ReloadAdminResources(ctx); err != nil {
5353
return admin.WrapErrorISE(err, "error reloading admin resources on failed admin store")
5454
}
5555
return admin.WrapErrorISE(err, "error storing admin in authority cache")
@@ -66,7 +66,7 @@ func (a *Authority) UpdateAdmin(ctx context.Context, id string, nu *linkedca.Adm
6666
return nil, admin.WrapErrorISE(err, "error updating cached admin %s", id)
6767
}
6868
if err := a.adminDB.UpdateAdmin(ctx, adm); err != nil {
69-
if err := a.reloadAdminResources(ctx); err != nil {
69+
if err := a.ReloadAdminResources(ctx); err != nil {
7070
return nil, admin.WrapErrorISE(err, "error reloading admin resources on failed admin update")
7171
}
7272
return nil, admin.WrapErrorISE(err, "error updating admin %s", id)
@@ -88,7 +88,7 @@ func (a *Authority) removeAdmin(ctx context.Context, id string) error {
8888
return admin.WrapErrorISE(err, "error removing admin %s from authority cache", id)
8989
}
9090
if err := a.adminDB.DeleteAdmin(ctx, id); err != nil {
91-
if err := a.reloadAdminResources(ctx); err != nil {
91+
if err := a.ReloadAdminResources(ctx); err != nil {
9292
return admin.WrapErrorISE(err, "error reloading admin resources on failed admin remove")
9393
}
9494
return admin.WrapErrorISE(err, "error deleting admin %s", id)

authority/authority.go

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,12 @@ type Authority struct {
8484
policyEngine *policy.Engine
8585

8686
adminMutex sync.RWMutex
87+
88+
// Do Not initialize the authority
89+
skipInit bool
8790
}
8891

92+
// Info contains information about the authority.
8993
type Info struct {
9094
StartTime time.Time
9195
RootX509Certs []*x509.Certificate
@@ -113,9 +117,11 @@ func New(cfg *config.Config, opts ...Option) (*Authority, error) {
113117
}
114118
}
115119

116-
// Initialize authority from options or configuration.
117-
if err := a.init(); err != nil {
118-
return nil, err
120+
if !a.skipInit {
121+
// Initialize authority from options or configuration.
122+
if err := a.init(); err != nil {
123+
return nil, err
124+
}
119125
}
120126

121127
return a, nil
@@ -151,9 +157,11 @@ func NewEmbedded(opts ...Option) (*Authority, error) {
151157
// Initialize config required fields.
152158
a.config.Init()
153159

154-
// Initialize authority from options or configuration.
155-
if err := a.init(); err != nil {
156-
return nil, err
160+
if !a.skipInit {
161+
// Initialize authority from options or configuration.
162+
if err := a.init(); err != nil {
163+
return nil, err
164+
}
157165
}
158166

159167
return a, nil
@@ -182,8 +190,8 @@ func MustFromContext(ctx context.Context) *Authority {
182190
}
183191
}
184192

185-
// reloadAdminResources reloads admins and provisioners from the DB.
186-
func (a *Authority) reloadAdminResources(ctx context.Context) error {
193+
// ReloadAdminResources reloads admins and provisioners from the DB.
194+
func (a *Authority) ReloadAdminResources(ctx context.Context) error {
187195
var (
188196
provList provisioner.List
189197
adminList []*linkedca.Admin
@@ -582,7 +590,7 @@ func (a *Authority) init() error {
582590
}
583591

584592
// Load Provisioners and Admins
585-
if err := a.reloadAdminResources(ctx); err != nil {
593+
if err := a.ReloadAdminResources(context.Background()); err != nil {
586594
return err
587595
}
588596

@@ -632,6 +640,12 @@ func (a *Authority) GetAdminDatabase() admin.DB {
632640
return a.adminDB
633641
}
634642

643+
// GetConfig returns the config.
644+
func (a *Authority) GetConfig() *config.Config {
645+
return a.config
646+
}
647+
648+
// GetInfo returns information about the authority.
635649
func (a *Authority) GetInfo() Info {
636650
ai := Info{
637651
StartTime: a.startTime,

authority/authorize_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1034,7 +1034,7 @@ func TestAuthority_authorizeSSHSign(t *testing.T) {
10341034
}
10351035
} else {
10361036
if assert.Nil(t, tc.err) {
1037-
assert.Len(t, 8, got) // number of provisioner.SignOptions returned
1037+
assert.Len(t, 9, got) // number of provisioner.SignOptions returned
10381038
}
10391039
}
10401040
})

0 commit comments

Comments
 (0)