Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add pkcs11-config-path command line parameter #192

Merged
merged 1 commit into from
Oct 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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