Skip to content

Commit

Permalink
add crypto-config-path command line parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
mc-slava committed Sep 30, 2021
1 parent 9f97249 commit 1b8b4f4
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cmd/app/createca.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ such as organization, country etc. This can then be used as the root
certificate authority for an instance of sigstore fulcio`,
Run: func(cmd *cobra.Command, args []string) {
log.Logger.Info("binding to PKCS11 HSM")
p11Ctx, err := crypto11.ConfigureFromFile("config/crypto11.conf")
p11Ctx, err := crypto11.ConfigureFromFile(viper.GetString("crypto-config-path"))
if err != nil {
log.Logger.Fatal(err)
}
Expand Down
1 change: 1 addition & 0 deletions cmd/app/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ func init() {
rootCmd.PersistentFlags().String("hsm-caroot-id", "", "HSM ID for Root CA (only used with --ca fulcio)")
rootCmd.PersistentFlags().String("ct-log-url", "http://localhost:6962/test", "host and path (with log prefix at the end) to the ct log")
rootCmd.PersistentFlags().String("config-path", "/etc/fulcio-config/config.json", "path to fulcio config json")
rootCmd.PersistentFlags().String("crypto-config-path", "config/crypto11.conf", "path to fulcio pkcs11 config file")

if err := viper.BindPFlags(rootCmd.PersistentFlags()); err != nil {
log.Logger.Fatal(err)
Expand Down
3 changes: 2 additions & 1 deletion pkg/pkcs11/pkcs11.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@ package pkcs11

import (
"github.com/ThalesIgnite/crypto11"
"github.com/spf13/viper"
)

func InitHSMCtx() (*crypto11.Context, error) {
p11Ctx, err := crypto11.ConfigureFromFile("config/crypto11.conf")
p11Ctx, err := crypto11.ConfigureFromFile(viper.GetString("crypto-config-path"))
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 1b8b4f4

Please sign in to comment.