Skip to content

Commit

Permalink
Over master rebase and merges
Browse files Browse the repository at this point in the history
  • Loading branch information
dopey committed Oct 27, 2021
1 parent 3765012 commit 3449a97
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 18 deletions.
4 changes: 2 additions & 2 deletions command/README.md
Expand Up @@ -12,7 +12,7 @@ should exist within its own package if possible. For example, `version` and
Any package used by a command but does not contain explicit business logic
directly related to the command should exist in the top-level of this
repository. For example, the `github.com/smallstep/cli/flags` and
`github.com/smallstep/cli/errs` package are used by many different commands and
`go.step.sm/cli-utils/errs` package are used by many different commands and
contain functionality for defining flags and creating/manipulating errors.

### Adding a Command
Expand Down Expand Up @@ -71,7 +71,7 @@ There are three packages which contain functionality to make writing commands ea
- `github.com/smallstep/cli/usage`
- `github.com/smallstep/cli/flags`
- `github.com/smallstep/cli/prompts`
- `github.com/smallstep/cli/errs`
- `go.step.sm/cli-utils/errs`

The usage package is used to extend the default documentation provided by
`urfave/cli` by enabling us to document arguments, whether they are optional or
Expand Down
42 changes: 37 additions & 5 deletions command/ca/init.go
Expand Up @@ -204,13 +204,28 @@ func initAction(ctx *cli.Context) (err error) {
if rootKey, err = pemutil.Read(key); err != nil {
return err
}
<<<<<<< HEAD
case ra != "" && ra != apiv1.CloudCAS && ra != apiv1.StepCAS:
return errs.InvalidFlagValue(ctx, "ra", ctx.String("ra"), "StepCAS or CloudCAS")
case kmsName != "" && kmsName != "azurekms":
return errs.InvalidFlagValue(ctx, "kms", ctx.String("kms"), "azurekms")
case kmsName != "" && ra != "":
return errs.IncompatibleFlagWithFlag(ctx, "kms", "ra")
case pkiOnly && noDB:
=======
case ra != "" && ra != apiv1.CloudCAS:
return errs.InvalidFlagValue(ctx, "ra", ctx.String("ra"), "CloudCAS")
}

var pkiOpts = []pki.Option{}

configure := !ctx.Bool("pki")
noDB := ctx.Bool("no-db")
if noDB {
pkiOpts = append(pkiOpts, pki.WithNoDB())
}
if !configure && noDB {
>>>>>>> 081edd7 (Over master rebase and merges)
return errs.IncompatibleFlagWithFlag(ctx, "pki", "no-db")
case pkiOnly && helm:
return errs.IncompatibleFlagWithFlag(ctx, "pki", "helm")
Expand Down Expand Up @@ -536,11 +551,6 @@ func initAction(ctx *cli.Context) (err error) {
}
}

p, err = pki.New(casOptions)
if err != nil {
return err
}

var address string
ui.Println("What IP and port will your new CA bind to?", ui.WithValue(ctx.String("address")))
address, err = ui.Prompt("(e.g. :443 or 127.0.0.1:443)",
Expand Down Expand Up @@ -584,6 +594,7 @@ func initAction(ctx *cli.Context) (err error) {
}
}

<<<<<<< HEAD
p, err := pki.New(casOptions, opts...)
if err != nil {
return err
Expand All @@ -600,6 +611,23 @@ func initAction(ctx *cli.Context) (err error) {
} else {
ui.Println("Choose a password for your CA keys and first provisioner.", ui.WithValue(password))
}
=======
pkiOpts = append(pkiOpts,
pki.WithProvisioner(provisioner),
pki.WithAddress(address),
pki.WithDNSNames(dnsNames),
pki.WithCaURL(caURL),
)
} else {
pkiOpts = append(pkiOpts,
pki.WithPKIOnly(),
)
}

p, err := pki.New(casOptions, pkiOpts...)
if err != nil {
return err
>>>>>>> 081edd7 (Over master rebase and merges)
}

pass, err := ui.PromptPasswordGenerate("[leave empty and we'll generate one]", ui.WithRichPrompt(), ui.WithValue(password))
Expand Down Expand Up @@ -712,6 +740,7 @@ func promptDeploymentType(ctx *cli.Context, isRA bool) (pki.DeploymentType, erro
var deploymentTypes []deployment
deploymentType := strings.ToLower(ctx.String("deployment-type"))

<<<<<<< HEAD
// Assume standalone for backward compatibility if all required flags are
// passed.
if deploymentType == "" && isNonInteractiveInit(ctx) {
Expand Down Expand Up @@ -760,6 +789,9 @@ func promptDeploymentType(ctx *cli.Context, isRA bool) (pki.DeploymentType, erro
return 0, err
}
return deploymentTypes[i].Value, nil
=======
return p.Save()
>>>>>>> 081edd7 (Over master rebase and merges)
}

// assertCryptoRand asserts that a cryptographically secure random number
Expand Down
2 changes: 1 addition & 1 deletion command/crypto/key/sign.go
Expand Up @@ -14,9 +14,9 @@ import (

"github.com/pkg/errors"
"github.com/smallstep/cli/command"
"github.com/smallstep/cli/errs"
"github.com/smallstep/cli/utils"
"github.com/urfave/cli"
"go.step.sm/cli-utils/errs"
"go.step.sm/crypto/pemutil"
)

Expand Down
2 changes: 1 addition & 1 deletion command/crypto/key/verify.go
Expand Up @@ -11,9 +11,9 @@ import (

"github.com/pkg/errors"
"github.com/smallstep/cli/command"
"github.com/smallstep/cli/errs"
"github.com/smallstep/cli/utils"
"github.com/urfave/cli"
"go.step.sm/cli-utils/errs"
"go.step.sm/crypto/pemutil"
)

Expand Down
9 changes: 0 additions & 9 deletions go.sum
Expand Up @@ -505,8 +505,6 @@ github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmK
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
github.com/icrowley/fake v0.0.0-20180203215853-4178557ae428 h1:Mo9W14pwbO9VfRe+ygqZ8dFbPpoIK1HFrG/zjTuQ+nc=
github.com/icrowley/fake v0.0.0-20180203215853-4178557ae428 h1:Mo9W14pwbO9VfRe+ygqZ8dFbPpoIK1HFrG/zjTuQ+nc=
github.com/icrowley/fake v0.0.0-20180203215853-4178557ae428/go.mod h1:uhpZMVGznybq1itEKXj6RYw9I71qK4kH+OGMjRC4KEo=
github.com/icrowley/fake v0.0.0-20180203215853-4178557ae428/go.mod h1:uhpZMVGznybq1itEKXj6RYw9I71qK4kH+OGMjRC4KEo=
github.com/imdario/mergo v0.3.4/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA=
github.com/imdario/mergo v0.3.8/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA=
Expand Down Expand Up @@ -782,14 +780,8 @@ github.com/smallstep/certificates v0.17.5 h1:1I6T4ts0OnmkcDXA8bIzri82SpJYcaM0hQ/
github.com/smallstep/certificates v0.17.5/go.mod h1:L/hR8en0O+GrhnwiKg+EIRP5PNkHq3Ci0s/Wu55BrDI=
github.com/smallstep/certinfo v1.5.2 h1:XO3f9krMkKFDRG4CJFdb3vVoLaXMDAhCn3g0padk9EI=
github.com/smallstep/certinfo v1.5.2/go.mod h1:gA7HBbue0Wwr3kD60P2UtgTIFfMAOC66D3rzYhI0GZ4=
<<<<<<< HEAD
github.com/smallstep/nosql v0.3.8 h1:1/EWUbbEdz9ai0g9Fd09VekVjtxp+5+gIHpV2PdwW3o=
github.com/smallstep/nosql v0.3.8/go.mod h1:X2qkYpNcW3yjLUvhEHfgGfClpKbFPapewvx7zo4TOFs=
=======
github.com/smallstep/nosql v0.3.6 h1:cq6a3NwjFJxkVlWU1T4qGskcfEXr0fO1WqQrraDO1Po=
github.com/smallstep/nosql v0.3.6/go.mod h1:h1zC/Z54uNHc8euquLED4qJNCrMHd3nytA141ZZh4qQ=
github.com/smallstep/nosql v0.3.7/go.mod h1:mC+MOhUY1uV5S5vGmAwp1FSPfDB7iImiYn5nJCjzAdA=
>>>>>>> 06ce0f2 (Bump to updated version of badger)
github.com/smallstep/truststore v0.9.6 h1:vNzEJmaJL0XOZD8uouXLmYu4/aP1UQ/wHUopH3qKeYA=
github.com/smallstep/truststore v0.9.6/go.mod h1:HwHKRcBi0RUxxw1LYDpTRhYC4jZUuxPpkHdVonlkoDM=
github.com/smallstep/zcrypto v0.0.0-20210924233136-66c2600f6e71 h1:q0IDrQpquiWcU1nJmjwEremPwG+pT2AAGsDatPgg3Kw=
Expand Down Expand Up @@ -831,7 +823,6 @@ github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5q
github.com/src-d/gcfg v1.4.0/go.mod h1:p/UMsR43ujA89BJY9duynAwIpvqEujIH/jFlfL7jWoI=
github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw=
github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw=
github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw=
github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5JnDBl6z3cMAg/SywNDC5ABu5ApDIw6lUbRmI=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
Expand Down

0 comments on commit 3449a97

Please sign in to comment.