forked from TrueCloudLab/certificates
mv pkg config -> step
This commit is contained in:
parent
741ac64c61
commit
10db335f13
4 changed files with 16 additions and 16 deletions
|
@ -29,7 +29,7 @@ import (
|
||||||
"github.com/smallstep/certificates/authority/provisioner"
|
"github.com/smallstep/certificates/authority/provisioner"
|
||||||
"github.com/smallstep/certificates/ca/identity"
|
"github.com/smallstep/certificates/ca/identity"
|
||||||
"github.com/smallstep/certificates/errs"
|
"github.com/smallstep/certificates/errs"
|
||||||
"go.step.sm/cli-utils/config"
|
"go.step.sm/cli-utils/step"
|
||||||
"go.step.sm/crypto/jose"
|
"go.step.sm/crypto/jose"
|
||||||
"go.step.sm/crypto/keyutil"
|
"go.step.sm/crypto/keyutil"
|
||||||
"go.step.sm/crypto/pemutil"
|
"go.step.sm/crypto/pemutil"
|
||||||
|
@ -1295,7 +1295,7 @@ func createCertificateRequest(commonName string, sans []string, key crypto.Priva
|
||||||
// getRootCAPath returns the path where the root CA is stored based on the
|
// getRootCAPath returns the path where the root CA is stored based on the
|
||||||
// STEPPATH environment variable.
|
// STEPPATH environment variable.
|
||||||
func getRootCAPath() string {
|
func getRootCAPath() string {
|
||||||
return filepath.Join(config.StepPath(), "certs", "root_ca.crt")
|
return filepath.Join(step.Path(), "certs", "root_ca.crt")
|
||||||
}
|
}
|
||||||
|
|
||||||
func readJSON(r io.ReadCloser, v interface{}) error {
|
func readJSON(r io.ReadCloser, v interface{}) error {
|
||||||
|
|
|
@ -21,7 +21,7 @@ import (
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
"go.step.sm/cli-utils/command"
|
"go.step.sm/cli-utils/command"
|
||||||
"go.step.sm/cli-utils/command/version"
|
"go.step.sm/cli-utils/command/version"
|
||||||
"go.step.sm/cli-utils/config"
|
"go.step.sm/cli-utils/step"
|
||||||
"go.step.sm/cli-utils/ui"
|
"go.step.sm/cli-utils/ui"
|
||||||
"go.step.sm/cli-utils/usage"
|
"go.step.sm/cli-utils/usage"
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ var (
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
config.Set("Smallstep CA", Version, BuildTime)
|
step.Set("Smallstep CA", Version, BuildTime)
|
||||||
authority.GlobalVersion.Version = Version
|
authority.GlobalVersion.Version = Version
|
||||||
rand.Seed(time.Now().UnixNano())
|
rand.Seed(time.Now().UnixNano())
|
||||||
}
|
}
|
||||||
|
@ -115,7 +115,7 @@ func main() {
|
||||||
app := cli.NewApp()
|
app := cli.NewApp()
|
||||||
app.Name = "step-ca"
|
app.Name = "step-ca"
|
||||||
app.HelpName = "step-ca"
|
app.HelpName = "step-ca"
|
||||||
app.Version = config.Version()
|
app.Version = step.Version()
|
||||||
app.Usage = "an online certificate authority for secure automated certificate management"
|
app.Usage = "an online certificate authority for secure automated certificate management"
|
||||||
app.UsageText = `**step-ca** <config> [**--password-file**=<file>]
|
app.UsageText = `**step-ca** <config> [**--password-file**=<file>]
|
||||||
[**--ssh-host-password-file**=<file>] [**--ssh-user-password-file**=<file>]
|
[**--ssh-host-password-file**=<file>] [**--ssh-user-password-file**=<file>]
|
||||||
|
|
16
pki/pki.go
16
pki/pki.go
|
@ -29,9 +29,9 @@ import (
|
||||||
"github.com/smallstep/certificates/kms"
|
"github.com/smallstep/certificates/kms"
|
||||||
kmsapi "github.com/smallstep/certificates/kms/apiv1"
|
kmsapi "github.com/smallstep/certificates/kms/apiv1"
|
||||||
"github.com/smallstep/nosql"
|
"github.com/smallstep/nosql"
|
||||||
"go.step.sm/cli-utils/config"
|
|
||||||
"go.step.sm/cli-utils/errs"
|
"go.step.sm/cli-utils/errs"
|
||||||
"go.step.sm/cli-utils/fileutil"
|
"go.step.sm/cli-utils/fileutil"
|
||||||
|
"go.step.sm/cli-utils/step"
|
||||||
"go.step.sm/cli-utils/ui"
|
"go.step.sm/cli-utils/ui"
|
||||||
"go.step.sm/crypto/jose"
|
"go.step.sm/crypto/jose"
|
||||||
"go.step.sm/crypto/pemutil"
|
"go.step.sm/crypto/pemutil"
|
||||||
|
@ -89,42 +89,42 @@ const (
|
||||||
// GetDBPath returns the path where the file-system persistence is stored
|
// GetDBPath returns the path where the file-system persistence is stored
|
||||||
// based on the STEPPATH environment variable.
|
// based on the STEPPATH environment variable.
|
||||||
func GetDBPath() string {
|
func GetDBPath() string {
|
||||||
return filepath.Join(config.StepPath(), dbPath)
|
return filepath.Join(step.Path(), dbPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetConfigPath returns the directory where the configuration files are stored
|
// GetConfigPath returns the directory where the configuration files are stored
|
||||||
// based on the STEPPATH environment variable.
|
// based on the STEPPATH environment variable.
|
||||||
func GetConfigPath() string {
|
func GetConfigPath() string {
|
||||||
return filepath.Join(config.StepPath(), configPath)
|
return filepath.Join(step.Path(), configPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetPublicPath returns the directory where the public keys are stored based on
|
// GetPublicPath returns the directory where the public keys are stored based on
|
||||||
// the STEPPATH environment variable.
|
// the STEPPATH environment variable.
|
||||||
func GetPublicPath() string {
|
func GetPublicPath() string {
|
||||||
return filepath.Join(config.StepPath(), publicPath)
|
return filepath.Join(step.Path(), publicPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetSecretsPath returns the directory where the private keys are stored based
|
// GetSecretsPath returns the directory where the private keys are stored based
|
||||||
// on the STEPPATH environment variable.
|
// on the STEPPATH environment variable.
|
||||||
func GetSecretsPath() string {
|
func GetSecretsPath() string {
|
||||||
return filepath.Join(config.StepPath(), privatePath)
|
return filepath.Join(step.Path(), privatePath)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetRootCAPath returns the path where the root CA is stored based on the
|
// GetRootCAPath returns the path where the root CA is stored based on the
|
||||||
// STEPPATH environment variable.
|
// STEPPATH environment variable.
|
||||||
func GetRootCAPath() string {
|
func GetRootCAPath() string {
|
||||||
return filepath.Join(config.StepPath(), publicPath, "root_ca.crt")
|
return filepath.Join(step.Path(), publicPath, "root_ca.crt")
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetOTTKeyPath returns the path where the one-time token key is stored based
|
// GetOTTKeyPath returns the path where the one-time token key is stored based
|
||||||
// on the STEPPATH environment variable.
|
// on the STEPPATH environment variable.
|
||||||
func GetOTTKeyPath() string {
|
func GetOTTKeyPath() string {
|
||||||
return filepath.Join(config.StepPath(), privatePath, "ott_key")
|
return filepath.Join(step.Path(), privatePath, "ott_key")
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetTemplatesPath returns the path where the templates are stored.
|
// GetTemplatesPath returns the path where the templates are stored.
|
||||||
func GetTemplatesPath() string {
|
func GetTemplatesPath() string {
|
||||||
return filepath.Join(config.StepPath(), templatesPath)
|
return filepath.Join(step.Path(), templatesPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetProvisioners returns the map of provisioners on the given CA.
|
// GetProvisioners returns the map of provisioners on the given CA.
|
||||||
|
|
|
@ -6,9 +6,9 @@ import (
|
||||||
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/smallstep/certificates/templates"
|
"github.com/smallstep/certificates/templates"
|
||||||
"go.step.sm/cli-utils/config"
|
|
||||||
"go.step.sm/cli-utils/errs"
|
"go.step.sm/cli-utils/errs"
|
||||||
"go.step.sm/cli-utils/fileutil"
|
"go.step.sm/cli-utils/fileutil"
|
||||||
|
"go.step.sm/cli-utils/step"
|
||||||
)
|
)
|
||||||
|
|
||||||
// getTemplates returns all the templates enabled
|
// getTemplates returns all the templates enabled
|
||||||
|
@ -44,7 +44,7 @@ func generateTemplates(t *templates.Templates) error {
|
||||||
if !ok {
|
if !ok {
|
||||||
return errors.Errorf("template %s does not exists", t.Name)
|
return errors.Errorf("template %s does not exists", t.Name)
|
||||||
}
|
}
|
||||||
if err := fileutil.WriteFile(config.StepAbs(t.TemplatePath), []byte(data), 0644); err != nil {
|
if err := fileutil.WriteFile(step.Abs(t.TemplatePath), []byte(data), 0644); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ func generateTemplates(t *templates.Templates) error {
|
||||||
if !ok {
|
if !ok {
|
||||||
return errors.Errorf("template %s does not exists", t.Name)
|
return errors.Errorf("template %s does not exists", t.Name)
|
||||||
}
|
}
|
||||||
if err := fileutil.WriteFile(config.StepAbs(t.TemplatePath), []byte(data), 0644); err != nil {
|
if err := fileutil.WriteFile(step.Abs(t.TemplatePath), []byte(data), 0644); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue