From b45b73f4cc9746b7c91252dccc6bf374002b3351 Mon Sep 17 00:00:00 2001 From: Herman Slatman Date: Mon, 28 Oct 2024 10:53:44 +0100 Subject: [PATCH] Use `github.com/smallstep/cli-utils` instead of `go.step.sm/cli-utils` --- authority/export.go | 8 +++++--- authority/provisioner/options.go | 2 +- authority/provisioner/ssh_options.go | 3 ++- authority/provisioners.go | 4 ++-- authority/provisioners_test.go | 4 ++-- ca/adminClient.go | 4 ++-- ca/ca.go | 8 +++++--- ca/client.go | 20 +++++++++++--------- ca/identity/identity.go | 6 ++++-- ca/provisioner.go | 8 +++++--- cas/stepcas/jwk_issuer.go | 8 +++++--- cmd/step-ca/main.go | 13 +++++++------ commands/app.go | 8 +++++--- commands/export.go | 9 +++++---- commands/onboard.go | 14 ++++++++------ go.mod | 2 +- go.sum | 4 ++-- pki/pki.go | 24 +++++++++++++----------- pki/pki_test.go | 10 ++++++---- pki/templates.go | 8 +++++--- templates/templates.go | 5 +++-- 21 files changed, 99 insertions(+), 73 deletions(-) diff --git a/authority/export.go b/authority/export.go index b8efbbd7b..43479d5f2 100644 --- a/authority/export.go +++ b/authority/export.go @@ -8,10 +8,12 @@ import ( "strings" "github.com/pkg/errors" - "github.com/smallstep/certificates/authority/provisioner" - "go.step.sm/cli-utils/step" - "go.step.sm/linkedca" "google.golang.org/protobuf/types/known/structpb" + + "github.com/smallstep/cli-utils/step" + "go.step.sm/linkedca" + + "github.com/smallstep/certificates/authority/provisioner" ) // Export creates a linkedca configuration form the current ca.json and loaded diff --git a/authority/provisioner/options.go b/authority/provisioner/options.go index ec7780819..f68e9daca 100644 --- a/authority/provisioner/options.go +++ b/authority/provisioner/options.go @@ -6,7 +6,7 @@ import ( "github.com/pkg/errors" - "go.step.sm/cli-utils/step" + "github.com/smallstep/cli-utils/step" "go.step.sm/crypto/jose" "go.step.sm/crypto/x509util" diff --git a/authority/provisioner/ssh_options.go b/authority/provisioner/ssh_options.go index e870ff30d..def2ec724 100644 --- a/authority/provisioner/ssh_options.go +++ b/authority/provisioner/ssh_options.go @@ -5,7 +5,8 @@ import ( "strings" "github.com/pkg/errors" - "go.step.sm/cli-utils/step" + + "github.com/smallstep/cli-utils/step" "go.step.sm/crypto/sshutil" "github.com/smallstep/certificates/authority/policy" diff --git a/authority/provisioners.go b/authority/provisioners.go index d56ce9e53..d12ebf464 100644 --- a/authority/provisioners.go +++ b/authority/provisioners.go @@ -11,8 +11,8 @@ import ( "github.com/pkg/errors" - "go.step.sm/cli-utils/step" - "go.step.sm/cli-utils/ui" + "github.com/smallstep/cli-utils/step" + "github.com/smallstep/cli-utils/ui" "go.step.sm/crypto/jose" "go.step.sm/linkedca" diff --git a/authority/provisioners_test.go b/authority/provisioners_test.go index f62f81273..659df18ed 100644 --- a/authority/provisioners_test.go +++ b/authority/provisioners_test.go @@ -9,12 +9,12 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "go.step.sm/crypto/jose" "go.step.sm/crypto/keyutil" "go.step.sm/linkedca" - "github.com/stretchr/testify/require" - "github.com/smallstep/assert" "github.com/smallstep/certificates/api/render" "github.com/smallstep/certificates/authority/admin" diff --git a/ca/adminClient.go b/ca/adminClient.go index 3ead66294..5fb6e9f68 100644 --- a/ca/adminClient.go +++ b/ca/adminClient.go @@ -15,8 +15,8 @@ import ( "github.com/pkg/errors" "google.golang.org/protobuf/encoding/protojson" - "go.step.sm/cli-utils/token" - "go.step.sm/cli-utils/token/provision" + "github.com/smallstep/cli-utils/token" + "github.com/smallstep/cli-utils/token/provision" "go.step.sm/crypto/jose" "go.step.sm/crypto/randutil" "go.step.sm/linkedca" diff --git a/ca/ca.go b/ca/ca.go index 0b426ded2..99edd6ee4 100644 --- a/ca/ca.go +++ b/ca/ca.go @@ -18,6 +18,11 @@ import ( "github.com/go-chi/chi/v5" "github.com/go-chi/chi/v5/middleware" "github.com/pkg/errors" + + "github.com/smallstep/cli-utils/step" + "github.com/smallstep/nosql" + "go.step.sm/crypto/x509util" + "github.com/smallstep/certificates/acme" acmeAPI "github.com/smallstep/certificates/acme/api" acmeNoSQL "github.com/smallstep/certificates/acme/db/nosql" @@ -35,9 +40,6 @@ import ( "github.com/smallstep/certificates/scep" scepAPI "github.com/smallstep/certificates/scep/api" "github.com/smallstep/certificates/server" - "github.com/smallstep/nosql" - "go.step.sm/cli-utils/step" - "go.step.sm/crypto/x509util" ) type options struct { diff --git a/ca/client.go b/ca/client.go index b18efbaf4..165eac2c5 100644 --- a/ca/client.go +++ b/ca/client.go @@ -24,21 +24,23 @@ import ( "strings" "github.com/pkg/errors" + "golang.org/x/net/http2" + "google.golang.org/protobuf/encoding/protojson" + "google.golang.org/protobuf/proto" + + "github.com/smallstep/cli-utils/step" + "go.step.sm/crypto/jose" + "go.step.sm/crypto/keyutil" + "go.step.sm/crypto/pemutil" + "go.step.sm/crypto/randutil" + "go.step.sm/crypto/x509util" + "github.com/smallstep/certificates/api" "github.com/smallstep/certificates/authority" "github.com/smallstep/certificates/authority/provisioner" "github.com/smallstep/certificates/ca/client" "github.com/smallstep/certificates/ca/identity" "github.com/smallstep/certificates/errs" - "go.step.sm/cli-utils/step" - "go.step.sm/crypto/jose" - "go.step.sm/crypto/keyutil" - "go.step.sm/crypto/pemutil" - "go.step.sm/crypto/randutil" - "go.step.sm/crypto/x509util" - "golang.org/x/net/http2" - "google.golang.org/protobuf/encoding/protojson" - "google.golang.org/protobuf/proto" ) // DisableIdentity is a global variable to disable the identity. diff --git a/ca/identity/identity.go b/ca/identity/identity.go index ac7040012..43ff20e01 100644 --- a/ca/identity/identity.go +++ b/ca/identity/identity.go @@ -14,9 +14,11 @@ import ( "time" "github.com/pkg/errors" - "github.com/smallstep/certificates/api" - "go.step.sm/cli-utils/step" + + "github.com/smallstep/cli-utils/step" "go.step.sm/crypto/pemutil" + + "github.com/smallstep/certificates/api" ) // Type represents the different types of identity files. diff --git a/ca/provisioner.go b/ca/provisioner.go index d5b23f38c..0de6733ce 100644 --- a/ca/provisioner.go +++ b/ca/provisioner.go @@ -6,11 +6,13 @@ import ( "time" "github.com/pkg/errors" - "github.com/smallstep/certificates/authority/provisioner" - "go.step.sm/cli-utils/token" - "go.step.sm/cli-utils/token/provision" + + "github.com/smallstep/cli-utils/token" + "github.com/smallstep/cli-utils/token/provision" "go.step.sm/crypto/jose" "go.step.sm/crypto/randutil" + + "github.com/smallstep/certificates/authority/provisioner" ) const tokenLifetime = 5 * time.Minute diff --git a/cas/stepcas/jwk_issuer.go b/cas/stepcas/jwk_issuer.go index 5ef017a28..2af4fceea 100644 --- a/cas/stepcas/jwk_issuer.go +++ b/cas/stepcas/jwk_issuer.go @@ -8,12 +8,14 @@ import ( "time" "github.com/pkg/errors" + + "github.com/smallstep/cli-utils/ui" + "go.step.sm/crypto/jose" + "go.step.sm/crypto/randutil" + "github.com/smallstep/certificates/authority/provisioner" "github.com/smallstep/certificates/ca" "github.com/smallstep/certificates/cas/apiv1" - "go.step.sm/cli-utils/ui" - "go.step.sm/crypto/jose" - "go.step.sm/crypto/randutil" ) type jwkIssuer struct { diff --git a/cmd/step-ca/main.go b/cmd/step-ca/main.go index c7ece08ff..46661e637 100644 --- a/cmd/step-ca/main.go +++ b/cmd/step-ca/main.go @@ -16,14 +16,15 @@ import ( //nolint:gosec // profile server, if enabled runs on a different port _ "net/http/pprof" + "github.com/urfave/cli" + "github.com/smallstep/certificates/authority" "github.com/smallstep/certificates/commands" - "github.com/urfave/cli" - "go.step.sm/cli-utils/command" - "go.step.sm/cli-utils/command/version" - "go.step.sm/cli-utils/step" - "go.step.sm/cli-utils/ui" - "go.step.sm/cli-utils/usage" + "github.com/smallstep/cli-utils/command" + "github.com/smallstep/cli-utils/command/version" + "github.com/smallstep/cli-utils/step" + "github.com/smallstep/cli-utils/ui" + "github.com/smallstep/cli-utils/usage" "go.step.sm/crypto/pemutil" // Enabled kms interfaces. diff --git a/commands/app.go b/commands/app.go index c793f11cd..7f4e2e131 100644 --- a/commands/app.go +++ b/commands/app.go @@ -13,15 +13,17 @@ import ( "unicode" "github.com/pkg/errors" + "github.com/urfave/cli" + + "github.com/smallstep/cli-utils/errs" + "github.com/smallstep/cli-utils/step" + "github.com/smallstep/certificates/acme" "github.com/smallstep/certificates/authority/config" "github.com/smallstep/certificates/authority/provisioner" "github.com/smallstep/certificates/ca" "github.com/smallstep/certificates/db" "github.com/smallstep/certificates/pki" - "github.com/urfave/cli" - "go.step.sm/cli-utils/errs" - "go.step.sm/cli-utils/step" ) // AppCommand is the action used as the top action. diff --git a/commands/export.go b/commands/export.go index 19bfb1fab..b09c290b6 100644 --- a/commands/export.go +++ b/commands/export.go @@ -8,13 +8,14 @@ import ( "unicode" "github.com/pkg/errors" - "github.com/smallstep/certificates/authority" - "github.com/smallstep/certificates/authority/config" "github.com/urfave/cli" "google.golang.org/protobuf/encoding/protojson" - "go.step.sm/cli-utils/command" - "go.step.sm/cli-utils/errs" + "github.com/smallstep/cli-utils/command" + "github.com/smallstep/cli-utils/errs" + + "github.com/smallstep/certificates/authority" + "github.com/smallstep/certificates/authority/config" ) func init() { diff --git a/commands/onboard.go b/commands/onboard.go index ef3b7854f..b3e95ac0f 100644 --- a/commands/onboard.go +++ b/commands/onboard.go @@ -9,16 +9,18 @@ import ( "os" "github.com/pkg/errors" + "github.com/urfave/cli" + + "github.com/smallstep/cli-utils/command" + "github.com/smallstep/cli-utils/errs" + "github.com/smallstep/cli-utils/fileutil" + "github.com/smallstep/cli-utils/ui" + "go.step.sm/crypto/randutil" + "github.com/smallstep/certificates/authority/config" "github.com/smallstep/certificates/ca" "github.com/smallstep/certificates/cas/apiv1" "github.com/smallstep/certificates/pki" - "github.com/urfave/cli" - "go.step.sm/cli-utils/command" - "go.step.sm/cli-utils/errs" - "go.step.sm/cli-utils/fileutil" - "go.step.sm/cli-utils/ui" - "go.step.sm/crypto/randutil" ) // defaultOnboardingURL is the production onboarding url, to use a development diff --git a/go.mod b/go.mod index d04d38dab..4ea556bc5 100644 --- a/go.mod +++ b/go.mod @@ -28,13 +28,13 @@ require ( github.com/sirupsen/logrus v1.9.3 github.com/slackhq/nebula v1.9.4 github.com/smallstep/assert v0.0.0-20200723003110-82e2b9b3b262 + github.com/smallstep/cli-utils v0.10.0 github.com/smallstep/go-attestation v0.4.4-0.20240109183208-413678f90935 github.com/smallstep/nosql v0.7.0 github.com/smallstep/pkcs7 v0.0.0-20240911091500-b1cae6277023 github.com/smallstep/scep v0.0.0-20240926084937-8cf1ca453101 github.com/stretchr/testify v1.9.0 github.com/urfave/cli v1.22.16 - go.step.sm/cli-utils v0.9.0 go.step.sm/crypto v0.54.0 go.step.sm/linkedca v0.22.1 golang.org/x/crypto v0.28.0 diff --git a/go.sum b/go.sum index bef55df92..9215e1129 100644 --- a/go.sum +++ b/go.sum @@ -373,6 +373,8 @@ github.com/slackhq/nebula v1.9.4 h1:p06JxtXT/OBMWt2OQkY7F0phOBb42X93YWNsS1yqC9o= github.com/slackhq/nebula v1.9.4/go.mod h1:1+4q4wd3dDAjO8rKCttSb9JIVbklQhuJiBp5I0lbIsQ= github.com/smallstep/assert v0.0.0-20200723003110-82e2b9b3b262 h1:unQFBIznI+VYD1/1fApl1A+9VcBk+9dcqGfnePY87LY= github.com/smallstep/assert v0.0.0-20200723003110-82e2b9b3b262/go.mod h1:MyOHs9Po2fbM1LHej6sBUT8ozbxmMOFG+E+rx/GSGuc= +github.com/smallstep/cli-utils v0.10.0 h1:CfXNvHtIN5pAzGvGP0NEUZoGFcj5epNEB6RSpSfduek= +github.com/smallstep/cli-utils v0.10.0/go.mod h1:jIeNa5ctrVg89lU5TaQKYd6o1eFxi9mtZu1sXSxpEBg= github.com/smallstep/go-attestation v0.4.4-0.20240109183208-413678f90935 h1:kjYvkvS/Wdy0PVRDUAA0gGJIVSEZYhiAJtfwYgOYoGA= github.com/smallstep/go-attestation v0.4.4-0.20240109183208-413678f90935/go.mod h1:vNAduivU014fubg6ewygkAvQC0IQVXqdc8vaGl/0er4= github.com/smallstep/nosql v0.7.0 h1:YiWC9ZAHcrLCrayfaF+QJUv16I2bZ7KdLC3RpJcnAnE= @@ -434,8 +436,6 @@ go.opentelemetry.io/otel/sdk v1.29.0 h1:vkqKjk7gwhS8VaWb0POZKmIEDimRCMsopNYnriHy go.opentelemetry.io/otel/sdk v1.29.0/go.mod h1:pM8Dx5WKnvxLCb+8lG1PRNIDxu9g9b9g59Qr7hfAAok= go.opentelemetry.io/otel/trace v1.29.0 h1:J/8ZNK4XgR7a21DZUAsbF8pZ5Jcw1VhACmnYt39JTi4= go.opentelemetry.io/otel/trace v1.29.0/go.mod h1:eHl3w0sp3paPkYstJOmAimxhiFXPg+MMTlEh3nsQgWQ= -go.step.sm/cli-utils v0.9.0 h1:55jYcsQbnArNqepZyAwcato6Zy2MoZDRkWW+jF+aPfQ= -go.step.sm/cli-utils v0.9.0/go.mod h1:Y/CRoWl1FVR9j+7PnAewufAwKmBOTzR6l9+7EYGAnp8= go.step.sm/crypto v0.54.0 h1:V8p+12Ld0NRA/RBMYoKXA0dWmVKZSdCwP56IwzweT9g= go.step.sm/crypto v0.54.0/go.mod h1:vQJyTngfZDW+UyZdFzOMCY/txWDAmcwViEUC7Gn4YfU= go.step.sm/linkedca v0.22.1 h1:GvprpH9P4Sv9U+eZ3bxDgRSSpW14cFDYpe1kS6yWLkw= diff --git a/pki/pki.go b/pki/pki.go index 234bae5a2..83349a09d 100644 --- a/pki/pki.go +++ b/pki/pki.go @@ -17,6 +17,19 @@ import ( "time" "github.com/pkg/errors" + "golang.org/x/crypto/ssh" + + "github.com/smallstep/cli-utils/errs" + "github.com/smallstep/cli-utils/fileutil" + "github.com/smallstep/cli-utils/step" + "github.com/smallstep/cli-utils/ui" + "github.com/smallstep/nosql" + "go.step.sm/crypto/jose" + "go.step.sm/crypto/kms" + kmsapi "go.step.sm/crypto/kms/apiv1" + "go.step.sm/crypto/pemutil" + "go.step.sm/linkedca" + "github.com/smallstep/certificates/authority" "github.com/smallstep/certificates/authority/admin" admindb "github.com/smallstep/certificates/authority/admin/db/nosql" @@ -26,17 +39,6 @@ import ( "github.com/smallstep/certificates/cas" "github.com/smallstep/certificates/cas/apiv1" "github.com/smallstep/certificates/db" - "github.com/smallstep/nosql" - "go.step.sm/cli-utils/errs" - "go.step.sm/cli-utils/fileutil" - "go.step.sm/cli-utils/step" - "go.step.sm/cli-utils/ui" - "go.step.sm/crypto/jose" - "go.step.sm/crypto/kms" - kmsapi "go.step.sm/crypto/kms/apiv1" - "go.step.sm/crypto/pemutil" - "go.step.sm/linkedca" - "golang.org/x/crypto/ssh" ) // DeploymentType defines witch type of deployment a user is initializing diff --git a/pki/pki_test.go b/pki/pki_test.go index 7d5bc8c50..f707a868a 100644 --- a/pki/pki_test.go +++ b/pki/pki_test.go @@ -5,16 +5,18 @@ import ( "path/filepath" "testing" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "github.com/smallstep/cli-utils/step" + "github.com/smallstep/nosql" + "github.com/smallstep/certificates/authority/admin" admindb "github.com/smallstep/certificates/authority/admin/db/nosql" authconfig "github.com/smallstep/certificates/authority/config" "github.com/smallstep/certificates/authority/provisioner" "github.com/smallstep/certificates/cas/apiv1" "github.com/smallstep/certificates/db" - "github.com/smallstep/nosql" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "go.step.sm/cli-utils/step" ) func withDBDataSource(t *testing.T, dataSource string) func(c *authconfig.Config) error { diff --git a/pki/templates.go b/pki/templates.go index 0ccbed8b4..bae6db1dd 100644 --- a/pki/templates.go +++ b/pki/templates.go @@ -5,10 +5,12 @@ import ( "path/filepath" "github.com/pkg/errors" + + "github.com/smallstep/cli-utils/errs" + "github.com/smallstep/cli-utils/fileutil" + "github.com/smallstep/cli-utils/step" + "github.com/smallstep/certificates/templates" - "go.step.sm/cli-utils/errs" - "go.step.sm/cli-utils/fileutil" - "go.step.sm/cli-utils/step" ) // getTemplates returns all the templates enabled diff --git a/templates/templates.go b/templates/templates.go index 2544b6e9c..e58f5fbc7 100644 --- a/templates/templates.go +++ b/templates/templates.go @@ -9,8 +9,9 @@ import ( "github.com/Masterminds/sprig/v3" "github.com/pkg/errors" - "go.step.sm/cli-utils/fileutil" - "go.step.sm/cli-utils/step" + + "github.com/smallstep/cli-utils/fileutil" + "github.com/smallstep/cli-utils/step" ) // TemplateType defines how a template will be written in disk.