Skip to content

Commit

Permalink
add pkcs11-config-path command line parameter (#192)
Browse files Browse the repository at this point in the history
Signed-off-by: Vasilyev, Viacheslav <viacheslav.vasilyev@accenture.com>

Co-authored-by: Vasilyev, Viacheslav <viacheslav.vasilyev@accenture.com>
  • Loading branch information
avoidik and mc-slava authored Oct 1, 2021
1 parent 9f97249 commit e3bb9cb
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("pkcs11-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("pkcs11-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("pkcs11-config-path"))
if err != nil {
return nil, err
}
Expand Down

0 comments on commit e3bb9cb

Please sign in to comment.