diff --git a/cmd/helpers.go b/cmd/helpers.go index 74c79d0..dad9e98 100644 --- a/cmd/helpers.go +++ b/cmd/helpers.go @@ -181,6 +181,7 @@ func getCurrentTime(f string) string { func informDebug(debugFlag bool) { debugModeEnabled := checkDebug(debugFlag) + zerolog.SetGlobalLevel(zerolog.Disabled) if debugModeEnabled { //zerolog.SetGlobalLevel(zerolog.InfoLevel) zerolog.SetGlobalLevel(zerolog.DebugLevel) diff --git a/cmd/inventory.go b/cmd/inventory.go index 0b004ec..c54d26c 100644 --- a/cmd/inventory.go +++ b/cmd/inventory.go @@ -15,11 +15,17 @@ package cmd import ( + "encoding/csv" "encoding/json" "fmt" + "log" + "os" + "reflect" + "strconv" + "time" + "github.com/Keyfactor/keyfactor-go-client/v2/api" "github.com/spf13/cobra" - "log" ) // inventoryCmd represents the inventory command @@ -133,7 +139,11 @@ var inventoryClearCmd = &cobra.Command{ } if !force { - fmt.Printf("This will clear the inventory of ALL certificates in the store %s:%s. Are you sure you sure?! Press 'y' to continue? (y/n) ", store.ClientMachine, store.StorePath) + fmt.Printf( + "This will clear the inventory of ALL certificates in the store %s:%s. Are you sure you sure?! Press 'y' to continue? (y/n) ", + store.ClientMachine, + store.StorePath, + ) var answer string fmt.Scanln(&answer) if answer != "y" { @@ -145,7 +155,8 @@ var inventoryClearCmd = &cobra.Command{ for _, inv := range *sInvs { certs := inv.Certificates for _, cert := range certs { - st := api.CertificateStore{ //TODO: This conversion is a bit weird to have to do. Should be able to pass the store directly. + st := api.CertificateStore{ + //TODO: This conversion is a bit weird to have to do. Should be able to pass the store directly. CertificateStoreId: store.Id, Alias: cert.Thumbprint, Overwrite: true, @@ -163,12 +174,23 @@ var inventoryClearCmd = &cobra.Command{ if !dryRun { _, err := kfClient.RemoveCertificateFromStores(&removeReq) if err != nil { - fmt.Printf("Error removing certificate %s(%d) from store %s: %s\n", cert.IssuedDN, cert.Id, st.CertificateStoreId, err) + fmt.Printf( + "Error removing certificate %s(%d) from store %s: %s\n", + cert.IssuedDN, + cert.Id, + st.CertificateStoreId, + err, + ) log.Printf("[ERROR] %s", err) continue } } else { - fmt.Printf("Dry run: Would have removed certificate %s(%d) from store %s\n", cert.IssuedDN, cert.Id, st.CertificateStoreId) + fmt.Printf( + "Dry run: Would have removed certificate %s(%d) from store %s\n", + cert.IssuedDN, + cert.Id, + st.CertificateStoreId, + ) } } @@ -264,9 +286,11 @@ attempt to add all the certificate(s) meeting the specified criteria to all stor var filteredCerts []api.GetCertificateResponse for _, cn := range subjects { - cert, err := kfClient.ListCertificates(map[string]string{ - "subject": cn, - }) + cert, err := kfClient.ListCertificates( + map[string]string{ + "subject": cn, + }, + ) if err != nil { fmt.Printf("Unable to find certificate with subject: %s\n", cn) continue @@ -274,9 +298,11 @@ attempt to add all the certificate(s) meeting the specified criteria to all stor filteredCerts = append(filteredCerts, cert...) } for _, thumbprint := range thumbprints { - cert, err := kfClient.ListCertificates(map[string]string{ - "thumbprint": thumbprint, - }) + cert, err := kfClient.ListCertificates( + map[string]string{ + "thumbprint": thumbprint, + }, + ) if err != nil { fmt.Printf("Unable to find certificate with thumbprint: %s\n", thumbprint) continue @@ -284,9 +310,11 @@ attempt to add all the certificate(s) meeting the specified criteria to all stor filteredCerts = append(filteredCerts, cert...) } for _, certID := range certIDs { - cert, err := kfClient.ListCertificates(map[string]string{ - "id": certID, - }) + cert, err := kfClient.ListCertificates( + map[string]string{ + "id": certID, + }, + ) if err != nil { fmt.Printf("Unable to find certificate with ID: %s\n", certID) continue @@ -323,7 +351,8 @@ attempt to add all the certificate(s) meeting the specified criteria to all stor Immediate: boolToPointer(true), } for _, cert := range filteredCerts { - st := api.CertificateStore{ //TODO: This conversion is weird. Should be able to use the store directly. + st := api.CertificateStore{ + //TODO: This conversion is weird. Should be able to use the store directly. CertificateStoreId: store.Id, Alias: cert.Thumbprint, Overwrite: true, @@ -340,7 +369,13 @@ attempt to add all the certificate(s) meeting the specified criteria to all stor } if !dryRun { if !force { - fmt.Printf("This will add the certificate %s(%d) to certificate store %s%s's inventory. Are you sure you shouldPass to continue? (y/n) ", cert.IssuedCN, cert.Id, store.ClientMachine, store.StorePath) + fmt.Printf( + "This will add the certificate %s(%d) to certificate store %s%s's inventory. Are you sure you shouldPass to continue? (y/n) ", + cert.IssuedCN, + cert.Id, + store.ClientMachine, + store.StorePath, + ) var answer string fmt.Scanln(&answer) if answer != "y" { @@ -350,12 +385,23 @@ attempt to add all the certificate(s) meeting the specified criteria to all stor } _, err := kfClient.AddCertificateToStores(&addReq) if err != nil { - fmt.Printf("Error adding certificate %s(%d) to store %s: %s\n", cert.IssuedCN, cert.Id, st.CertificateStoreId, err) + fmt.Printf( + "Error adding certificate %s(%d) to store %s: %s\n", + cert.IssuedCN, + cert.Id, + st.CertificateStoreId, + err, + ) log.Printf("[ERROR] %s", err) continue } } else { - fmt.Printf("Dry run: Would have added certificate %s(%d) from store %s", cert.IssuedDN, cert.Id, st.CertificateStoreId) + fmt.Printf( + "Dry run: Would have added certificate %s(%d) from store %s", + cert.IssuedDN, + cert.Id, + st.CertificateStoreId, + ) } } @@ -430,9 +476,11 @@ var inventoryRemoveCmd = &cobra.Command{ var filteredCerts []api.GetCertificateResponse for _, cn := range subjects { - cert, err := kfClient.ListCertificates(map[string]string{ - "subject": cn, - }) + cert, err := kfClient.ListCertificates( + map[string]string{ + "subject": cn, + }, + ) if err != nil { fmt.Printf("Unable to find certificate with subject: %s\n", cn) continue @@ -440,9 +488,11 @@ var inventoryRemoveCmd = &cobra.Command{ filteredCerts = append(filteredCerts, cert...) } for _, thumbprint := range thumbprints { - cert, err := kfClient.ListCertificates(map[string]string{ - "thumbprint": thumbprint, - }) + cert, err := kfClient.ListCertificates( + map[string]string{ + "thumbprint": thumbprint, + }, + ) if err != nil { fmt.Printf("Unable to find certificate with thumbprint: %s\n", thumbprint) continue @@ -450,9 +500,11 @@ var inventoryRemoveCmd = &cobra.Command{ filteredCerts = append(filteredCerts, cert...) } for _, certID := range certIDs { - cert, err := kfClient.ListCertificates(map[string]string{ - "id": certID, - }) + cert, err := kfClient.ListCertificates( + map[string]string{ + "id": certID, + }, + ) if err != nil { fmt.Printf("Unable to find certificate with ID: %s\n", certID) continue @@ -490,7 +542,8 @@ var inventoryRemoveCmd = &cobra.Command{ Immediate: boolToPointer(true), } for _, cert := range filteredCerts { - st := api.CertificateStore{ //TODO: This conversion is weird. Should be able to use the store directly. + st := api.CertificateStore{ + //TODO: This conversion is weird. Should be able to use the store directly. CertificateStoreId: store.Id, Alias: cert.Thumbprint, Overwrite: true, @@ -507,7 +560,12 @@ var inventoryRemoveCmd = &cobra.Command{ } if !dryRun { if !force { - fmt.Printf("This will remove the certificate %s from certificate store %s%s's inventory. Are you sure you shouldPass to continue? (y/n) ", certToString(&cert), store.ClientMachine, store.StorePath) + fmt.Printf( + "This will remove the certificate %s from certificate store %s%s's inventory. Are you sure you shouldPass to continue? (y/n) ", + certToString(&cert), + store.ClientMachine, + store.StorePath, + ) var answer string fmt.Scanln(&answer) if answer != "y" { @@ -517,12 +575,21 @@ var inventoryRemoveCmd = &cobra.Command{ } _, err := kfClient.RemoveCertificateFromStores(&removeReq) if err != nil { - fmt.Printf("Error removing certificate %s to store %s: %s\n", certToString(&cert), st.CertificateStoreId, err) + fmt.Printf( + "Error removing certificate %s to store %s: %s\n", + certToString(&cert), + st.CertificateStoreId, + err, + ) log.Printf("[ERROR] %s", err) continue } } else { - fmt.Printf("Dry run: Would have removed certificate %s from store %s\n", certToString(&cert), st.CertificateStoreId) + fmt.Printf( + "Dry run: Would have removed certificate %s from store %s\n", + certToString(&cert), + st.CertificateStoreId, + ) } } @@ -531,6 +598,333 @@ var inventoryRemoveCmd = &cobra.Command{ }, } +var inventoryFixRFPKCS12 = &cobra.Command{ + Use: "fixrfpkcs12", + Aliases: nil, + SuggestFor: nil, + Short: "Fix RFPKCS12 stores that contain 2 or more leaf certificates, by removing the certificate with the earliest issued date.", + GroupID: "", + Long: `Fix RFPKCS12 stores that contain 2 or more leaf certificates, by removing the certificate with the earliest issued date.`, + Example: ` +# The below will create a CSV file that can be reviewed and modified before running the command with the --file option. +kfutil stores inventory fixrfpkcs12 --exp + +# The below will read the CSV file and schedule remove jobs as specified in the file where the 'Action' col is "REMOVE". +# The --force flag is *required* to actually schedule the remove jobs for the certificates. +kfutil stores inventory fixrfpkcs12 --file rfpkcs12_fix.csv --force --exp +`, + ValidArgs: nil, + ValidArgsFunction: nil, + Args: nil, + ArgAliases: nil, + BashCompletionFunction: "", + Deprecated: "", + Annotations: nil, + Version: "", + PersistentPreRun: nil, + PersistentPreRunE: nil, + PreRun: nil, + PreRunE: nil, + Run: func(cmd *cobra.Command, args []string) { + force, _ := cmd.Flags().GetBool("force") + //dryRun, _ := cmd.Flags().GetBool("dry-run") + importFile, _ := cmd.Flags().GetString("file") + //csvHeader := "Alias,Issued Date,Store Path,Client Machine,StoreId" + + authConfig := createAuthConfigFromParams(kfcHostName, kfcUsername, kfcPassword, kfcDomain, kfcAPIPath) + isExperimental := true + + _, expErr := isExperimentalFeatureEnabled(expEnabled, isExperimental) + if expErr != nil { + fmt.Println(fmt.Sprintf("WARNING this is an expEnabled feature, %s", expErr)) + log.Fatalf("[ERROR]: %s", expErr) + } + + debugModeEnabled := checkDebug(debugFlag) + log.Println("Debug mode enabled: ", debugModeEnabled) + rfpkcs12StoreType := "RFPKCS12" + + kfClient, _ := initClient(configFile, profile, "", "", noPrompt, authConfig, false) + rfpkcs12StoreTypeResponse, sTypeErr := kfClient.GetCertificateStoreTypeByName(rfpkcs12StoreType) + if sTypeErr != nil { + fmt.Printf("Error getting store type id for store type %s: %s\n", rfpkcs12StoreType, sTypeErr) + log.Fatal(sTypeErr) + return + } + + type CSVLine struct { + StoreId string + StorePath string + Action string + Alias string + IssuedDN string + Thumbprint string + IssuedDate time.Time + ExpiryDate time.Time + CertId int + } + outputFileName := "rfpkcs12_fix.csv" + var outputCSV []CSVLine + + stId := rfpkcs12StoreTypeResponse.StoreType + + if importFile != "" { + fmt.Println("Importing CSV file") + //Read CSV file into outputCSV + csvFile, csvErr := os.Open(importFile) + if csvErr != nil { + fmt.Printf("Error opening CSV file: %s\n", csvErr) + log.Fatal(csvErr) + return + } + defer csvFile.Close() + //Read CSV file + reader := csv.NewReader(csvFile) + + // Read the first line (header) + header, err := reader.Read() + if err != nil { + fmt.Printf("Error reading CSV header: %s\n", err) + log.Fatal(err) + return + } + + // Read the rest of the lines + records, err := reader.ReadAll() + if err != nil { + fmt.Println("Error reading records:", err) + return + } + + for _, record := range records { + var line CSVLine + // Use reflection to map CSV values to struct fields based on header + v := reflect.ValueOf(&line).Elem() + t := v.Type() + + for i, fieldName := range header { + for j := 0; j < t.NumField(); j++ { + field := t.Field(j) + if fieldName == field.Name { + // Convert and set the value based on the field type + switch field.Type.Kind() { + case reflect.String: + v.Field(j).SetString(record[i]) + case reflect.Int: + val, _ := strconv.Atoi(record[i]) + v.Field(j).SetInt(int64(val)) + case reflect.Struct: + if field.Type == reflect.TypeOf(time.Time{}) { + layout := "2006-01-02" // assuming the date format in the CSV is YYYY-MM-DD + parsedTime, _ := time.Parse(layout, record[i]) + v.Field(j).Set(reflect.ValueOf(parsedTime)) + } + } + } + } + } + outputCSV = append(outputCSV, line) + } + } else { + log.Println("No import file specified. Listing all RFPKCS12 stores.") + params := map[string]interface{}{ + "ClientMachine": []string{}, + "ContainerId": []int{}, + "Storepath": []string{}, + "CertStoreType": []string{}, + "AgentId": []string{}, + "ContainerName": []string{}, + "Id": []string{}, + } + params["CertStoreType"] = append(params["CertStoreType"].([]string), fmt.Sprintf("%d", stId)) + stResp, err := kfClient.ListCertificateStores(¶ms) + if err != nil { + fmt.Println("Error, unable to list certificate stores. ", err) + log.Printf("[ERROR] Unable to list certificate stores: %s\n", err) + return + } + + for _, cStore := range *stResp { + inv, iErr := kfClient.GetCertStoreInventory(cStore.Id) + if iErr != nil { + fmt.Printf("Error, unable to retrieve certificate store inventory from %v: %s\n", cStore, err) + } + if inv != nil && len(*inv) > 1 { + certs := make(map[string]string) + newestAlias := "" + var newestDate time.Time + for _, cert := range *inv { + alias := cert.Name + issuedDate := cert.Certificates[0].NotBefore + certs[alias] = issuedDate + issuedDateTime, _ := time.Parse(time.RFC3339, issuedDate) + expiresDate := cert.Certificates[0].NotAfter + expiresDateTime, _ := time.Parse(time.RFC3339, expiresDate) + + newLine := CSVLine{ + StoreId: cStore.Id, + StorePath: fmt.Sprintf("%s/%s", cStore.ClientMachine, cStore.StorePath), + Action: "", + Alias: alias, + IssuedDN: cert.Certificates[0].IssuedDN, + Thumbprint: cert.Certificates[0].Thumbprint, + IssuedDate: issuedDateTime, + ExpiryDate: expiresDateTime, + CertId: cert.Certificates[0].Id, + } + outputCSV = append(outputCSV, newLine) + if newestAlias == "" { + newestAlias = alias + newestDate, _ = time.Parse(time.RFC3339, issuedDate) + } else { + issuedDate, _ := time.Parse(time.RFC3339, issuedDate) + if issuedDate.After(newestDate) { + newestAlias = alias + newestDate = issuedDate + } + } + } + + //convert outputCSV to CSV file + + csvFile, csvErr := os.Create(outputFileName) + if csvErr != nil { + fmt.Printf("Error creating CSV file: %s\n", csvErr) + log.Fatal(csvErr) + } + defer csvFile.Close() + + csvWriter := csv.NewWriter(csvFile) + defer csvWriter.Flush() + + // Write the header + header := []string{ + "StoreId", + "StorePath", + "Action", + "Alias", + "IssuedDN", + "Thumbprint", + "IssuedDate", + "ExpiryDate", + "CertId", + } + if err := csvWriter.Write(header); err != nil { + fmt.Println("Error writing header:", err) + return + } + + for _, line := range outputCSV { + if line.Alias != newestAlias { + line.Action = "REMOVE" + } + record := []string{ + line.StoreId, + line.StorePath, + line.Action, + line.Alias, + line.IssuedDN, + line.Thumbprint, + line.IssuedDate.Format(time.RFC3339), // Format date as string (adjust format as needed) + line.ExpiryDate.Format(time.RFC3339), // Format date as string (adjust format as needed) + strconv.Itoa(line.CertId), // Convert CertId (int) to string + } + if err := csvWriter.Write(record); err != nil { + fmt.Println("Error writing record:", err) + continue + } + + } + } + //invData := make(map[string]interface{}) + //invData["StoreId"] = cStore.Id + //invData["Storepath"] = cStore.StorePath + //invData["StoreType"] = cStore.CertStoreType + //invData["ContainerName"] = cStore.ContainerName + //invData["ClientMachine"] = cStore.ClientMachine + //invData["Inventory"] = inv + //if _, ok := lkup[cStore.Id]; !ok { + // output = append(output, invData) + //} + //lkup[cStore.Id] = invData + } + } + for _, line := range outputCSV { + if line.Action == "REMOVE" { + st := api.CertificateStore{ + CertificateStoreId: line.StoreId, + Alias: line.Alias, + Overwrite: true, + EntryPassword: nil, + PfxPassword: "", + IncludePrivateKey: true, + } + var stores []api.CertificateStore + stores = append(stores, st) + schedule := &api.InventorySchedule{ + Immediate: boolToPointer(true), + } + removeReq := api.RemoveCertificateFromStore{ + CertificateId: line.CertId, + Alias: line.Alias, + CertificateStores: &stores, + InventorySchedule: schedule, + } + if force { + fmt.Printf( + "Force flag specified scheduling immediate removal of certificate '%s'(%s) from store '%s'\n", + line.Alias, + line.IssuedDN, + line.StorePath, + ) + remResp, err := kfClient.RemoveCertificateFromStores(&removeReq) + if err != nil { + fmt.Printf( + "Error removing certificate '%s'(%s) from store %s: %s\n", + line.Alias, + line.IssuedDN, + line.StorePath, + err, + ) + continue + } + fmt.Printf( + "Job %s scheduled for immediate removal of certificate %s from store %s\n", remResp, + line.Alias, line.StorePath, + ) + } else { + fmt.Println("Dry run:") + fmt.Printf( + "Would have removed certificate '%s'(%s) from store '%s'\n", + line.Alias, + line.IssuedDN, + line.StorePath, + ) + fmt.Println("To execute the removal, re-run the command with the --force flag") + } + + } + } + + }, + RunE: nil, + PostRun: nil, + PostRunE: nil, + PersistentPostRun: nil, + PersistentPostRunE: nil, + FParseErrWhitelist: cobra.FParseErrWhitelist{}, + CompletionOptions: cobra.CompletionOptions{}, + TraverseChildren: false, + Hidden: false, + SilenceErrors: false, + SilenceUsage: false, + DisableFlagParsing: false, + DisableAutoGenTag: false, + DisableFlagsInUseLine: false, + DisableSuggestions: false, + SuggestionsMinimumDistance: 0, +} + var inventoryShowCmd = &cobra.Command{ Use: "show", Aliases: nil, @@ -664,47 +1058,202 @@ func init() { dryRun bool cIDs []string subjectNames []string + importFile string ) storesCmd.AddCommand(inventoryCmd) + inventoryCmd.AddCommand(inventoryFixRFPKCS12) + inventoryFixRFPKCS12.Flags().BoolVar( + &force, + "force", + false, + "Force the removal of the certificate(s) without prompting for confirmation.", + ) + inventoryFixRFPKCS12.Flags().StringVar( + &importFile, + "file", + "", + "CSV file to import for RFPKCS12 store fix.", + ) + inventoryCmd.AddCommand(inventoryClearCmd) - inventoryClearCmd.Flags().StringSliceVar(&ids, "sid", []string{}, "The Keyfactor Command ID of the certificate store(s) remove all inventory from.") - inventoryClearCmd.Flags().StringSliceVar(&clients, "client", []string{}, "Remove all inventory from store(s) of specific client machine(s).") - inventoryClearCmd.Flags().StringSliceVar(&types, "store-type", []string{}, "Remove all inventory from store(s) of specific store type(s).") - inventoryClearCmd.Flags().StringSliceVar(&containers, "container", []string{}, "Remove all inventory from store(s) of specific container type(s).") + inventoryClearCmd.Flags().StringSliceVar( + &ids, + "sid", + []string{}, + "The Keyfactor Command ID of the certificate store(s) remove all inventory from.", + ) + inventoryClearCmd.Flags().StringSliceVar( + &clients, + "client", + []string{}, + "Remove all inventory from store(s) of specific client machine(s).", + ) + inventoryClearCmd.Flags().StringSliceVar( + &types, + "store-type", + []string{}, + "Remove all inventory from store(s) of specific store type(s).", + ) + inventoryClearCmd.Flags().StringSliceVar( + &containers, + "container", + []string{}, + "Remove all inventory from store(s) of specific container type(s).", + ) inventoryClearCmd.Flags().BoolVar(&all, "all", false, "Remove all inventory from all certificate stores.") - inventoryClearCmd.Flags().BoolVar(&force, "force", false, "Force removal of inventory without prompting for confirmation.") - inventoryClearCmd.Flags().BoolVar(&dryRun, "dry-run", false, "Do not remove inventory, only show what would be removed.") + inventoryClearCmd.Flags().BoolVar( + &force, + "force", + false, + "Force removal of inventory without prompting for confirmation.", + ) + inventoryClearCmd.Flags().BoolVar( + &dryRun, + "dry-run", + false, + "Do not remove inventory, only show what would be removed.", + ) inventoryCmd.AddCommand(inventoryAddCmd) - inventoryAddCmd.Flags().StringSliceVar(&ids, "sid", []string{}, "The Keyfactor Command ID of the certificate store(s) to add inventory to.") - inventoryAddCmd.Flags().StringSliceVar(&clients, "client", []string{}, "Add a certificate to all stores of specific client machine(s).") - inventoryAddCmd.Flags().StringSliceVar(&types, "store-type", []string{}, "Add a certificate to all stores of specific store type(s).") - inventoryAddCmd.Flags().StringSliceVar(&containers, "container", []string{}, "Add a certificate to all stores of specific container type(s).") - inventoryAddCmd.Flags().StringSliceVar(&thumbprints, "thumbprint", []string{}, "The thumbprint of the certificate(s) to add to the store(s).") - inventoryAddCmd.Flags().StringSliceVar(&cIDs, "cid", []string{}, "The Keyfactor command certificate ID(s) of the certificate to add to the store(s).") - inventoryAddCmd.Flags().StringSliceVar(&subjectNames, "cn", []string{}, "Subject name(s) of the certificate(s) to add to the store(s).") + inventoryAddCmd.Flags().StringSliceVar( + &ids, + "sid", + []string{}, + "The Keyfactor Command ID of the certificate store(s) to add inventory to.", + ) + inventoryAddCmd.Flags().StringSliceVar( + &clients, + "client", + []string{}, + "Add a certificate to all stores of specific client machine(s).", + ) + inventoryAddCmd.Flags().StringSliceVar( + &types, + "store-type", + []string{}, + "Add a certificate to all stores of specific store type(s).", + ) + inventoryAddCmd.Flags().StringSliceVar( + &containers, + "container", + []string{}, + "Add a certificate to all stores of specific container type(s).", + ) + inventoryAddCmd.Flags().StringSliceVar( + &thumbprints, + "thumbprint", + []string{}, + "The thumbprint of the certificate(s) to add to the store(s).", + ) + inventoryAddCmd.Flags().StringSliceVar( + &cIDs, + "cid", + []string{}, + "The Keyfactor command certificate ID(s) of the certificate to add to the store(s).", + ) + inventoryAddCmd.Flags().StringSliceVar( + &subjectNames, + "cn", + []string{}, + "Subject name(s) of the certificate(s) to add to the store(s).", + ) inventoryAddCmd.Flags().BoolVar(&all, "all-stores", false, "Add the certificate(s) to all certificate stores.") - inventoryAddCmd.Flags().BoolVar(&force, "force", false, "Force addition of inventory without prompting for confirmation.") + inventoryAddCmd.Flags().BoolVar( + &force, + "force", + false, + "Force addition of inventory without prompting for confirmation.", + ) inventoryAddCmd.Flags().BoolVar(&dryRun, "dry-run", false, "Do not add inventory, only show what would be added.") inventoryCmd.AddCommand(inventoryRemoveCmd) - inventoryRemoveCmd.Flags().StringSliceVar(&ids, "sid", []string{}, "The Keyfactor Command ID of the certificate store(s) to remove inventory from.") - inventoryRemoveCmd.Flags().StringSliceVar(&clients, "client", []string{}, "Remove certificate(s) from all stores of specific client machine(s).") - inventoryRemoveCmd.Flags().StringSliceVar(&types, "store-type", []string{}, "Remove certificate(s) from all stores of specific store type(s).") - inventoryRemoveCmd.Flags().StringSliceVar(&containers, "container", []string{}, "Remove certificate(s) from all stores of specific container type(s).") - inventoryRemoveCmd.Flags().StringSliceVar(&thumbprints, "thumbprint", []string{}, "The thumbprint of the certificate(s) to remove from the store(s).") - inventoryRemoveCmd.Flags().StringSliceVar(&cIDs, "cid", []string{}, "The Keyfactor command certificate ID(s) of the certificate to remove from the store(s).") - inventoryRemoveCmd.Flags().StringSliceVar(&subjectNames, "cn", []string{}, "Subject name(s) of the certificate(s) to remove from the store(s).") - inventoryRemoveCmd.Flags().BoolVar(&all, "all-stores", false, "Remove the certificate(s) from all certificate stores.") - inventoryRemoveCmd.Flags().BoolVar(&force, "force", false, "Force removal of inventory without prompting for confirmation.") - inventoryRemoveCmd.Flags().BoolVar(&dryRun, "dry-run", false, "Do not remove inventory, only show what would be removed.") + inventoryRemoveCmd.Flags().StringSliceVar( + &ids, + "sid", + []string{}, + "The Keyfactor Command ID of the certificate store(s) to remove inventory from.", + ) + inventoryRemoveCmd.Flags().StringSliceVar( + &clients, + "client", + []string{}, + "Remove certificate(s) from all stores of specific client machine(s).", + ) + inventoryRemoveCmd.Flags().StringSliceVar( + &types, + "store-type", + []string{}, + "Remove certificate(s) from all stores of specific store type(s).", + ) + inventoryRemoveCmd.Flags().StringSliceVar( + &containers, + "container", + []string{}, + "Remove certificate(s) from all stores of specific container type(s).", + ) + inventoryRemoveCmd.Flags().StringSliceVar( + &thumbprints, + "thumbprint", + []string{}, + "The thumbprint of the certificate(s) to remove from the store(s).", + ) + inventoryRemoveCmd.Flags().StringSliceVar( + &cIDs, + "cid", + []string{}, + "The Keyfactor command certificate ID(s) of the certificate to remove from the store(s).", + ) + inventoryRemoveCmd.Flags().StringSliceVar( + &subjectNames, + "cn", + []string{}, + "Subject name(s) of the certificate(s) to remove from the store(s).", + ) + inventoryRemoveCmd.Flags().BoolVar( + &all, + "all-stores", + false, + "Remove the certificate(s) from all certificate stores.", + ) + inventoryRemoveCmd.Flags().BoolVar( + &force, + "force", + false, + "Force removal of inventory without prompting for confirmation.", + ) + inventoryRemoveCmd.Flags().BoolVar( + &dryRun, + "dry-run", + false, + "Do not remove inventory, only show what would be removed.", + ) inventoryCmd.AddCommand(inventoryShowCmd) - inventoryShowCmd.Flags().StringSliceVar(&ids, "sid", []string{}, "The Keyfactor Command ID of the certificate store(s) to retrieve inventory from.") - inventoryShowCmd.Flags().StringSliceVar(&clients, "client", []string{}, "Show certificate inventories for stores of specific client machine(s).") - inventoryShowCmd.Flags().StringSliceVar(&types, "store-type", []string{}, "Show certificate inventories for stores of specific store type(s).") - inventoryShowCmd.Flags().StringSliceVar(&containers, "container", []string{}, "Show certificate inventories for stores of specific container type(s).") + inventoryShowCmd.Flags().StringSliceVar( + &ids, + "sid", + []string{}, + "The Keyfactor Command ID of the certificate store(s) to retrieve inventory from.", + ) + inventoryShowCmd.Flags().StringSliceVar( + &clients, + "client", + []string{}, + "Show certificate inventories for stores of specific client machine(s).", + ) + inventoryShowCmd.Flags().StringSliceVar( + &types, + "store-type", + []string{}, + "Show certificate inventories for stores of specific store type(s).", + ) + inventoryShowCmd.Flags().StringSliceVar( + &containers, + "container", + []string{}, + "Show certificate inventories for stores of specific container type(s).", + ) } diff --git a/docs/kfutil.md b/docs/kfutil.md index c784705..253584e 100644 --- a/docs/kfutil.md +++ b/docs/kfutil.md @@ -43,4 +43,4 @@ A CLI wrapper around the Keyfactor Platform API. * [kfutil stores](kfutil_stores.md) - Keyfactor certificate stores APIs and utilities. * [kfutil version](kfutil_version.md) - Shows version of kfutil -###### Auto generated by spf13/cobra on 8-Sep-2024 +###### Auto generated by spf13/cobra on 23-Oct-2024 diff --git a/docs/kfutil_completion.md b/docs/kfutil_completion.md index 14d566b..755ea74 100644 --- a/docs/kfutil_completion.md +++ b/docs/kfutil_completion.md @@ -42,4 +42,4 @@ See each sub-command's help for details on how to use the generated script. * [kfutil completion powershell](kfutil_completion_powershell.md) - Generate the autocompletion script for powershell * [kfutil completion zsh](kfutil_completion_zsh.md) - Generate the autocompletion script for zsh -###### Auto generated by spf13/cobra on 8-Sep-2024 +###### Auto generated by spf13/cobra on 23-Oct-2024 diff --git a/docs/kfutil_completion_bash.md b/docs/kfutil_completion_bash.md index f961da7..a1bf05c 100644 --- a/docs/kfutil_completion_bash.md +++ b/docs/kfutil_completion_bash.md @@ -61,4 +61,4 @@ kfutil completion bash * [kfutil completion](kfutil_completion.md) - Generate the autocompletion script for the specified shell -###### Auto generated by spf13/cobra on 8-Sep-2024 +###### Auto generated by spf13/cobra on 23-Oct-2024 diff --git a/docs/kfutil_completion_fish.md b/docs/kfutil_completion_fish.md index a0d386f..8b611f7 100644 --- a/docs/kfutil_completion_fish.md +++ b/docs/kfutil_completion_fish.md @@ -52,4 +52,4 @@ kfutil completion fish [flags] * [kfutil completion](kfutil_completion.md) - Generate the autocompletion script for the specified shell -###### Auto generated by spf13/cobra on 8-Sep-2024 +###### Auto generated by spf13/cobra on 23-Oct-2024 diff --git a/docs/kfutil_completion_powershell.md b/docs/kfutil_completion_powershell.md index e96bc99..fbf830c 100644 --- a/docs/kfutil_completion_powershell.md +++ b/docs/kfutil_completion_powershell.md @@ -49,4 +49,4 @@ kfutil completion powershell [flags] * [kfutil completion](kfutil_completion.md) - Generate the autocompletion script for the specified shell -###### Auto generated by spf13/cobra on 8-Sep-2024 +###### Auto generated by spf13/cobra on 23-Oct-2024 diff --git a/docs/kfutil_completion_zsh.md b/docs/kfutil_completion_zsh.md index 98b4917..3a8c798 100644 --- a/docs/kfutil_completion_zsh.md +++ b/docs/kfutil_completion_zsh.md @@ -63,4 +63,4 @@ kfutil completion zsh [flags] * [kfutil completion](kfutil_completion.md) - Generate the autocompletion script for the specified shell -###### Auto generated by spf13/cobra on 8-Sep-2024 +###### Auto generated by spf13/cobra on 23-Oct-2024 diff --git a/docs/kfutil_containers.md b/docs/kfutil_containers.md index 625c7e5..ed5cc55 100644 --- a/docs/kfutil_containers.md +++ b/docs/kfutil_containers.md @@ -38,4 +38,4 @@ A collections of APIs and utilities for interacting with Keyfactor certificate s * [kfutil containers get](kfutil_containers_get.md) - Get certificate store container by ID or name. * [kfutil containers list](kfutil_containers_list.md) - List certificate store containers. -###### Auto generated by spf13/cobra on 8-Sep-2024 +###### Auto generated by spf13/cobra on 23-Oct-2024 diff --git a/docs/kfutil_containers_get.md b/docs/kfutil_containers_get.md index fa8c3e0..b374d24 100644 --- a/docs/kfutil_containers_get.md +++ b/docs/kfutil_containers_get.md @@ -41,4 +41,4 @@ kfutil containers get [flags] * [kfutil containers](kfutil_containers.md) - Keyfactor certificate store container API and utilities. -###### Auto generated by spf13/cobra on 8-Sep-2024 +###### Auto generated by spf13/cobra on 23-Oct-2024 diff --git a/docs/kfutil_containers_list.md b/docs/kfutil_containers_list.md index 465cc19..fb96eb8 100644 --- a/docs/kfutil_containers_list.md +++ b/docs/kfutil_containers_list.md @@ -40,4 +40,4 @@ kfutil containers list [flags] * [kfutil containers](kfutil_containers.md) - Keyfactor certificate store container API and utilities. -###### Auto generated by spf13/cobra on 8-Sep-2024 +###### Auto generated by spf13/cobra on 23-Oct-2024 diff --git a/docs/kfutil_export.md b/docs/kfutil_export.md index fb69f13..f09ca61 100644 --- a/docs/kfutil_export.md +++ b/docs/kfutil_export.md @@ -52,4 +52,4 @@ kfutil export [flags] * [kfutil](kfutil.md) - Keyfactor CLI utilities -###### Auto generated by spf13/cobra on 8-Sep-2024 +###### Auto generated by spf13/cobra on 23-Oct-2024 diff --git a/docs/kfutil_helm.md b/docs/kfutil_helm.md index a7c8bf5..a7eabb9 100644 --- a/docs/kfutil_helm.md +++ b/docs/kfutil_helm.md @@ -43,4 +43,4 @@ kubectl helm uo | helm install -f - keyfactor-universal-orchestrator keyfactor/k * [kfutil](kfutil.md) - Keyfactor CLI utilities * [kfutil helm uo](kfutil_helm_uo.md) - Configure the Keyfactor Universal Orchestrator Helm Chart -###### Auto generated by spf13/cobra on 8-Sep-2024 +###### Auto generated by spf13/cobra on 23-Oct-2024 diff --git a/docs/kfutil_helm_uo.md b/docs/kfutil_helm_uo.md index eca60b9..38bb9e5 100644 --- a/docs/kfutil_helm_uo.md +++ b/docs/kfutil_helm_uo.md @@ -47,4 +47,4 @@ kfutil helm uo [-t ] [-o ] [-f ] [-e -e @,@ -o ./app/extension * [kfutil orchs](kfutil_orchs.md) - Keyfactor agents/orchestrators APIs and utilities. -###### Auto generated by spf13/cobra on 8-Sep-2024 +###### Auto generated by spf13/cobra on 23-Oct-2024 diff --git a/docs/kfutil_orchs_get.md b/docs/kfutil_orchs_get.md index 580fcd5..36d9b49 100644 --- a/docs/kfutil_orchs_get.md +++ b/docs/kfutil_orchs_get.md @@ -41,4 +41,4 @@ kfutil orchs get [flags] * [kfutil orchs](kfutil_orchs.md) - Keyfactor agents/orchestrators APIs and utilities. -###### Auto generated by spf13/cobra on 8-Sep-2024 +###### Auto generated by spf13/cobra on 23-Oct-2024 diff --git a/docs/kfutil_orchs_list.md b/docs/kfutil_orchs_list.md index 5873538..e541b05 100644 --- a/docs/kfutil_orchs_list.md +++ b/docs/kfutil_orchs_list.md @@ -40,4 +40,4 @@ kfutil orchs list [flags] * [kfutil orchs](kfutil_orchs.md) - Keyfactor agents/orchestrators APIs and utilities. -###### Auto generated by spf13/cobra on 8-Sep-2024 +###### Auto generated by spf13/cobra on 23-Oct-2024 diff --git a/docs/kfutil_orchs_logs.md b/docs/kfutil_orchs_logs.md index f65cea8..038171a 100644 --- a/docs/kfutil_orchs_logs.md +++ b/docs/kfutil_orchs_logs.md @@ -41,4 +41,4 @@ kfutil orchs logs [flags] * [kfutil orchs](kfutil_orchs.md) - Keyfactor agents/orchestrators APIs and utilities. -###### Auto generated by spf13/cobra on 8-Sep-2024 +###### Auto generated by spf13/cobra on 23-Oct-2024 diff --git a/docs/kfutil_orchs_reset.md b/docs/kfutil_orchs_reset.md index b7c5d7e..0b315ce 100644 --- a/docs/kfutil_orchs_reset.md +++ b/docs/kfutil_orchs_reset.md @@ -41,4 +41,4 @@ kfutil orchs reset [flags] * [kfutil orchs](kfutil_orchs.md) - Keyfactor agents/orchestrators APIs and utilities. -###### Auto generated by spf13/cobra on 8-Sep-2024 +###### Auto generated by spf13/cobra on 23-Oct-2024 diff --git a/docs/kfutil_pam.md b/docs/kfutil_pam.md index 45a5a4f..834be61 100644 --- a/docs/kfutil_pam.md +++ b/docs/kfutil_pam.md @@ -45,4 +45,4 @@ programmatically create, delete, edit, and list PAM Providers. * [kfutil pam types-list](kfutil_pam_types-list.md) - Returns a list of all available PAM provider types. * [kfutil pam update](kfutil_pam_update.md) - Updates an existing PAM Provider, currently only supported from file. -###### Auto generated by spf13/cobra on 8-Sep-2024 +###### Auto generated by spf13/cobra on 23-Oct-2024 diff --git a/docs/kfutil_pam_create.md b/docs/kfutil_pam_create.md index f2446b6..4a1e5f1 100644 --- a/docs/kfutil_pam_create.md +++ b/docs/kfutil_pam_create.md @@ -41,4 +41,4 @@ kfutil pam create [flags] * [kfutil pam](kfutil_pam.md) - Keyfactor PAM Provider APIs. -###### Auto generated by spf13/cobra on 8-Sep-2024 +###### Auto generated by spf13/cobra on 23-Oct-2024 diff --git a/docs/kfutil_pam_delete.md b/docs/kfutil_pam_delete.md index 133f103..a09f152 100644 --- a/docs/kfutil_pam_delete.md +++ b/docs/kfutil_pam_delete.md @@ -41,4 +41,4 @@ kfutil pam delete [flags] * [kfutil pam](kfutil_pam.md) - Keyfactor PAM Provider APIs. -###### Auto generated by spf13/cobra on 8-Sep-2024 +###### Auto generated by spf13/cobra on 23-Oct-2024 diff --git a/docs/kfutil_pam_get.md b/docs/kfutil_pam_get.md index 03c66a0..3812f01 100644 --- a/docs/kfutil_pam_get.md +++ b/docs/kfutil_pam_get.md @@ -41,4 +41,4 @@ kfutil pam get [flags] * [kfutil pam](kfutil_pam.md) - Keyfactor PAM Provider APIs. -###### Auto generated by spf13/cobra on 8-Sep-2024 +###### Auto generated by spf13/cobra on 23-Oct-2024 diff --git a/docs/kfutil_pam_list.md b/docs/kfutil_pam_list.md index 2e11dfb..507dd92 100644 --- a/docs/kfutil_pam_list.md +++ b/docs/kfutil_pam_list.md @@ -40,4 +40,4 @@ kfutil pam list [flags] * [kfutil pam](kfutil_pam.md) - Keyfactor PAM Provider APIs. -###### Auto generated by spf13/cobra on 8-Sep-2024 +###### Auto generated by spf13/cobra on 23-Oct-2024 diff --git a/docs/kfutil_pam_types-create.md b/docs/kfutil_pam_types-create.md index 7002cbe..023bf17 100644 --- a/docs/kfutil_pam_types-create.md +++ b/docs/kfutil_pam_types-create.md @@ -48,4 +48,4 @@ kfutil pam types-create [flags] * [kfutil pam](kfutil_pam.md) - Keyfactor PAM Provider APIs. -###### Auto generated by spf13/cobra on 8-Sep-2024 +###### Auto generated by spf13/cobra on 23-Oct-2024 diff --git a/docs/kfutil_pam_types-list.md b/docs/kfutil_pam_types-list.md index 6354470..51b573e 100644 --- a/docs/kfutil_pam_types-list.md +++ b/docs/kfutil_pam_types-list.md @@ -40,4 +40,4 @@ kfutil pam types-list [flags] * [kfutil pam](kfutil_pam.md) - Keyfactor PAM Provider APIs. -###### Auto generated by spf13/cobra on 8-Sep-2024 +###### Auto generated by spf13/cobra on 23-Oct-2024 diff --git a/docs/kfutil_pam_update.md b/docs/kfutil_pam_update.md index abb7db5..6467f2f 100644 --- a/docs/kfutil_pam_update.md +++ b/docs/kfutil_pam_update.md @@ -41,4 +41,4 @@ kfutil pam update [flags] * [kfutil pam](kfutil_pam.md) - Keyfactor PAM Provider APIs. -###### Auto generated by spf13/cobra on 8-Sep-2024 +###### Auto generated by spf13/cobra on 23-Oct-2024 diff --git a/docs/kfutil_status.md b/docs/kfutil_status.md index 8c30015..1b6dcc7 100644 --- a/docs/kfutil_status.md +++ b/docs/kfutil_status.md @@ -40,4 +40,4 @@ kfutil status [flags] * [kfutil](kfutil.md) - Keyfactor CLI utilities -###### Auto generated by spf13/cobra on 8-Sep-2024 +###### Auto generated by spf13/cobra on 23-Oct-2024 diff --git a/docs/kfutil_store-types.md b/docs/kfutil_store-types.md index 239320a..8bd3ccb 100644 --- a/docs/kfutil_store-types.md +++ b/docs/kfutil_store-types.md @@ -41,4 +41,4 @@ A collections of APIs and utilities for interacting with Keyfactor certificate s * [kfutil store-types list](kfutil_store-types_list.md) - List certificate store types. * [kfutil store-types templates-fetch](kfutil_store-types_templates-fetch.md) - Fetches store type templates from Keyfactor's Github. -###### Auto generated by spf13/cobra on 8-Sep-2024 +###### Auto generated by spf13/cobra on 23-Oct-2024 diff --git a/docs/kfutil_store-types_create.md b/docs/kfutil_store-types_create.md index 9b071b5..e6a87d0 100644 --- a/docs/kfutil_store-types_create.md +++ b/docs/kfutil_store-types_create.md @@ -45,4 +45,4 @@ kfutil store-types create [flags] * [kfutil store-types](kfutil_store-types.md) - Keyfactor certificate store types APIs and utilities. -###### Auto generated by spf13/cobra on 8-Sep-2024 +###### Auto generated by spf13/cobra on 23-Oct-2024 diff --git a/docs/kfutil_store-types_delete.md b/docs/kfutil_store-types_delete.md index ff64309..d572d11 100644 --- a/docs/kfutil_store-types_delete.md +++ b/docs/kfutil_store-types_delete.md @@ -44,4 +44,4 @@ kfutil store-types delete [flags] * [kfutil store-types](kfutil_store-types.md) - Keyfactor certificate store types APIs and utilities. -###### Auto generated by spf13/cobra on 8-Sep-2024 +###### Auto generated by spf13/cobra on 23-Oct-2024 diff --git a/docs/kfutil_store-types_get.md b/docs/kfutil_store-types_get.md index 2cddccc..7d54067 100644 --- a/docs/kfutil_store-types_get.md +++ b/docs/kfutil_store-types_get.md @@ -45,4 +45,4 @@ kfutil store-types get [-i | -n ] [-b * [kfutil store-types](kfutil_store-types.md) - Keyfactor certificate store types APIs and utilities. -###### Auto generated by spf13/cobra on 8-Sep-2024 +###### Auto generated by spf13/cobra on 23-Oct-2024 diff --git a/docs/kfutil_store-types_list.md b/docs/kfutil_store-types_list.md index feefa24..f8e18da 100644 --- a/docs/kfutil_store-types_list.md +++ b/docs/kfutil_store-types_list.md @@ -40,4 +40,4 @@ kfutil store-types list [flags] * [kfutil store-types](kfutil_store-types.md) - Keyfactor certificate store types APIs and utilities. -###### Auto generated by spf13/cobra on 8-Sep-2024 +###### Auto generated by spf13/cobra on 23-Oct-2024 diff --git a/docs/kfutil_store-types_templates-fetch.md b/docs/kfutil_store-types_templates-fetch.md index 558db74..3252f0e 100644 --- a/docs/kfutil_store-types_templates-fetch.md +++ b/docs/kfutil_store-types_templates-fetch.md @@ -41,4 +41,4 @@ kfutil store-types templates-fetch [flags] * [kfutil store-types](kfutil_store-types.md) - Keyfactor certificate store types APIs and utilities. -###### Auto generated by spf13/cobra on 8-Sep-2024 +###### Auto generated by spf13/cobra on 23-Oct-2024 diff --git a/docs/kfutil_stores.md b/docs/kfutil_stores.md index 11cd523..1f2fa40 100644 --- a/docs/kfutil_stores.md +++ b/docs/kfutil_stores.md @@ -43,4 +43,4 @@ A collections of APIs and utilities for interacting with Keyfactor certificate s * [kfutil stores list](kfutil_stores_list.md) - List certificate stores. * [kfutil stores rot](kfutil_stores_rot.md) - Root of trust utility -###### Auto generated by spf13/cobra on 8-Sep-2024 +###### Auto generated by spf13/cobra on 23-Oct-2024 diff --git a/docs/kfutil_stores_delete.md b/docs/kfutil_stores_delete.md index 18a6b60..9b62b92 100644 --- a/docs/kfutil_stores_delete.md +++ b/docs/kfutil_stores_delete.md @@ -43,4 +43,4 @@ kfutil stores delete [flags] * [kfutil stores](kfutil_stores.md) - Keyfactor certificate stores APIs and utilities. -###### Auto generated by spf13/cobra on 8-Sep-2024 +###### Auto generated by spf13/cobra on 23-Oct-2024 diff --git a/docs/kfutil_stores_export.md b/docs/kfutil_stores_export.md index bcd5fdf..10fd3b8 100644 --- a/docs/kfutil_stores_export.md +++ b/docs/kfutil_stores_export.md @@ -44,4 +44,4 @@ kfutil stores export [flags] * [kfutil stores](kfutil_stores.md) - Keyfactor certificate stores APIs and utilities. -###### Auto generated by spf13/cobra on 8-Sep-2024 +###### Auto generated by spf13/cobra on 23-Oct-2024 diff --git a/docs/kfutil_stores_get.md b/docs/kfutil_stores_get.md index 97a0f40..7683310 100644 --- a/docs/kfutil_stores_get.md +++ b/docs/kfutil_stores_get.md @@ -41,4 +41,4 @@ kfutil stores get [flags] * [kfutil stores](kfutil_stores.md) - Keyfactor certificate stores APIs and utilities. -###### Auto generated by spf13/cobra on 8-Sep-2024 +###### Auto generated by spf13/cobra on 23-Oct-2024 diff --git a/docs/kfutil_stores_import.md b/docs/kfutil_stores_import.md index fc7b75e..4144bca 100644 --- a/docs/kfutil_stores_import.md +++ b/docs/kfutil_stores_import.md @@ -38,4 +38,4 @@ Tools for generating import templates and importing certificate stores * [kfutil stores import csv](kfutil_stores_import_csv.md) - Create certificate stores from CSV file. * [kfutil stores import generate-template](kfutil_stores_import_generate-template.md) - For generating a CSV template with headers for bulk store creation. -###### Auto generated by spf13/cobra on 8-Sep-2024 +###### Auto generated by spf13/cobra on 23-Oct-2024 diff --git a/docs/kfutil_stores_import_csv.md b/docs/kfutil_stores_import_csv.md index 67d1239..994d744 100644 --- a/docs/kfutil_stores_import_csv.md +++ b/docs/kfutil_stores_import_csv.md @@ -48,4 +48,4 @@ kfutil stores import csv --file --store-type-id --store-t * [kfutil stores import](kfutil_stores_import.md) - Import a file with certificate store parameters and create them in keyfactor. -###### Auto generated by spf13/cobra on 8-Sep-2024 +###### Auto generated by spf13/cobra on 23-Oct-2024 diff --git a/docs/kfutil_stores_inventory.md b/docs/kfutil_stores_inventory.md index ee55cfc..38a018a 100644 --- a/docs/kfutil_stores_inventory.md +++ b/docs/kfutil_stores_inventory.md @@ -36,7 +36,9 @@ Commands related to certificate store inventory management * [kfutil stores](kfutil_stores.md) - Keyfactor certificate stores APIs and utilities. * [kfutil stores inventory add](kfutil_stores_inventory_add.md) - Adds one or more certificates to one or more certificate store inventories. +* [kfutil stores inventory fixrfpkcs12](kfutil_stores_inventory_fixrfpkcs12.md) - Fix RFPKCS12 stores that contain 2 + or more leaf certificates, by removing the certificate with the earliest issued date. * [kfutil stores inventory remove](kfutil_stores_inventory_remove.md) - Removes a certificate from the certificate store inventory. * [kfutil stores inventory show](kfutil_stores_inventory_show.md) - Show the inventory of a certificate store. -###### Auto generated by spf13/cobra on 8-Sep-2024 +###### Auto generated by spf13/cobra on 23-Oct-2024 diff --git a/docs/kfutil_stores_inventory_add.md b/docs/kfutil_stores_inventory_add.md index be3e5d9..838e900 100644 --- a/docs/kfutil_stores_inventory_add.md +++ b/docs/kfutil_stores_inventory_add.md @@ -54,4 +54,4 @@ kfutil stores inventory add [flags] * [kfutil stores inventory](kfutil_stores_inventory.md) - Commands related to certificate store inventory management -###### Auto generated by spf13/cobra on 8-Sep-2024 +###### Auto generated by spf13/cobra on 23-Oct-2024 diff --git a/docs/kfutil_stores_inventory_fixrfpkcs12.md b/docs/kfutil_stores_inventory_fixrfpkcs12.md new file mode 100644 index 0000000..306005d --- /dev/null +++ b/docs/kfutil_stores_inventory_fixrfpkcs12.md @@ -0,0 +1,58 @@ +## kfutil stores inventory fixrfpkcs12 + +Fix RFPKCS12 stores that contain 2 or more leaf certificates, by removing the certificate with the earliest issued date. + +### Synopsis + +Fix RFPKCS12 stores that contain 2 or more leaf certificates, by removing the certificate with the earliest issued date. + +``` +kfutil stores inventory fixrfpkcs12 [flags] +``` + +### Examples + +``` + +# The below will create a CSV file that can be reviewed and modified before running the command with the --file option. +kfutil stores inventory fixrfpkcs12 --exp + +# The below will read the CSV file and schedule remove jobs as specified in the file where the 'Action' col is "REMOVE". +# The --force flag is *required* to actually schedule the remove jobs for the certificates. +kfutil stores inventory fixrfpkcs12 --file rfpkcs12_fix.csv --force --exp + +``` + +### Options + +``` + --file string CSV file to import for RFPKCS12 store fix. + --force Force the removal of the certificate(s) without prompting for confirmation. + -h, --help help for fixrfpkcs12 +``` + +### Options inherited from parent commands + +``` + --api-path string API Path to use for authenticating to Keyfactor Command. (default is KeyfactorAPI) (default "KeyfactorAPI") + --auth-provider-profile string The profile to use defined in the securely stored config. If not specified the config named 'default' will be used if it exists. (default "default") + --auth-provider-type string Provider type choices: (azid) + --config string Full path to config file in JSON format. (default is $HOME/.keyfactor/command_config.json) + --debug Enable debugFlag logging. + --domain string Domain to use for authenticating to Keyfactor Command. + --exp Enable expEnabled features. (USE AT YOUR OWN RISK, these features are not supported and may change or be removed at any time.) + --format text How to format the CLI output. Currently only text is supported. (default "text") + --hostname string Hostname to use for authenticating to Keyfactor Command. + --log-insecure Log insecure API requests. (USE AT YOUR OWN RISK, this WILL log sensitive information to the console.) + --no-prompt Do not prompt for any user input and assume defaults or environmental variables are set. + --offline Will not attempt to connect to GitHub for latest release information and resources. + --password string Password to use for authenticating to Keyfactor Command. WARNING: Remember to delete your console history if providing kfcPassword here in plain text. + --profile string Use a specific profile from your config file. If not specified the config named 'default' will be used if it exists. + --username string Username to use for authenticating to Keyfactor Command. +``` + +### SEE ALSO + +* [kfutil stores inventory](kfutil_stores_inventory.md) - Commands related to certificate store inventory management + +###### Auto generated by spf13/cobra on 23-Oct-2024 diff --git a/docs/kfutil_stores_inventory_remove.md b/docs/kfutil_stores_inventory_remove.md index 706058f..27edfaa 100644 --- a/docs/kfutil_stores_inventory_remove.md +++ b/docs/kfutil_stores_inventory_remove.md @@ -50,4 +50,4 @@ kfutil stores inventory remove [flags] * [kfutil stores inventory](kfutil_stores_inventory.md) - Commands related to certificate store inventory management -###### Auto generated by spf13/cobra on 8-Sep-2024 +###### Auto generated by spf13/cobra on 23-Oct-2024 diff --git a/docs/kfutil_stores_inventory_show.md b/docs/kfutil_stores_inventory_show.md index 25948fb..cd3a748 100644 --- a/docs/kfutil_stores_inventory_show.md +++ b/docs/kfutil_stores_inventory_show.md @@ -44,4 +44,4 @@ kfutil stores inventory show [flags] * [kfutil stores inventory](kfutil_stores_inventory.md) - Commands related to certificate store inventory management -###### Auto generated by spf13/cobra on 8-Sep-2024 +###### Auto generated by spf13/cobra on 23-Oct-2024 diff --git a/docs/kfutil_stores_list.md b/docs/kfutil_stores_list.md index cedc3b2..e13d7ec 100644 --- a/docs/kfutil_stores_list.md +++ b/docs/kfutil_stores_list.md @@ -40,4 +40,4 @@ kfutil stores list [flags] * [kfutil stores](kfutil_stores.md) - Keyfactor certificate stores APIs and utilities. -###### Auto generated by spf13/cobra on 8-Sep-2024 +###### Auto generated by spf13/cobra on 23-Oct-2024 diff --git a/docs/kfutil_stores_rot.md b/docs/kfutil_stores_rot.md index ff49440..cb30b79 100644 --- a/docs/kfutil_stores_rot.md +++ b/docs/kfutil_stores_rot.md @@ -51,4 +51,4 @@ kfutil stores rot reconcile --import-csv * [kfutil stores rot generate-template](kfutil_stores_rot_generate-template.md) - For generating Root Of Trust template(s) * [kfutil stores rot reconcile](kfutil_stores_rot_reconcile.md) - Reconcile either takes in or will generate an audit report and then add/remove certs as needed. -###### Auto generated by spf13/cobra on 8-Sep-2024 +###### Auto generated by spf13/cobra on 23-Oct-2024 diff --git a/docs/kfutil_stores_rot_audit.md b/docs/kfutil_stores_rot_audit.md index 7d8a321..df9cc1b 100644 --- a/docs/kfutil_stores_rot_audit.md +++ b/docs/kfutil_stores_rot_audit.md @@ -48,4 +48,4 @@ kfutil stores rot audit [flags] * [kfutil stores rot](kfutil_stores_rot.md) - Root of trust utility -###### Auto generated by spf13/cobra on 8-Sep-2024 +###### Auto generated by spf13/cobra on 23-Oct-2024 diff --git a/docs/kfutil_stores_rot_generate-template.md b/docs/kfutil_stores_rot_generate-template.md index 054ec02..1f30785 100644 --- a/docs/kfutil_stores_rot_generate-template.md +++ b/docs/kfutil_stores_rot_generate-template.md @@ -46,4 +46,4 @@ kfutil stores rot generate-template [flags] * [kfutil stores rot](kfutil_stores_rot.md) - Root of trust utility -###### Auto generated by spf13/cobra on 8-Sep-2024 +###### Auto generated by spf13/cobra on 23-Oct-2024 diff --git a/docs/kfutil_stores_rot_reconcile.md b/docs/kfutil_stores_rot_reconcile.md index 6f45ed9..1d27793 100644 --- a/docs/kfutil_stores_rot_reconcile.md +++ b/docs/kfutil_stores_rot_reconcile.md @@ -53,4 +53,4 @@ kfutil stores rot reconcile [flags] * [kfutil stores rot](kfutil_stores_rot.md) - Root of trust utility -###### Auto generated by spf13/cobra on 8-Sep-2024 +###### Auto generated by spf13/cobra on 23-Oct-2024 diff --git a/docs/kfutil_version.md b/docs/kfutil_version.md index 383c1de..6cba39c 100644 --- a/docs/kfutil_version.md +++ b/docs/kfutil_version.md @@ -40,4 +40,4 @@ kfutil version [flags] * [kfutil](kfutil.md) - Keyfactor CLI utilities -###### Auto generated by spf13/cobra on 8-Sep-2024 +###### Auto generated by spf13/cobra on 23-Oct-2024 diff --git a/main.go b/main.go index 15e0228..d1e0870 100644 --- a/main.go +++ b/main.go @@ -17,7 +17,6 @@ package main import ( _ "embed" - "github.com/spf13/cobra/doc" "kfutil/cmd" ) @@ -33,6 +32,6 @@ func main() { cmd.Execute() } -func docs() { - doc.GenMarkdownTree(cmd.RootCmd, "./docs") -} +//func docs() { +// doc.GenMarkdownTree(cmd.RootCmd, "./docs") +//} diff --git a/pkg/version/version.go b/pkg/version/version.go index 354b351..5746b7c 100644 --- a/pkg/version/version.go +++ b/pkg/version/version.go @@ -14,4 +14,4 @@ package version -const VERSION = "1.4.0" +const VERSION = "1.5.0-rc1"