You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note: userPrivateKey is the actual Private Key and not a path to a file. You can also just store the serverAddress and your Private Key, if your Password is not set it will prompt you for it every time. MFA settings can also be save permenantly this ways
36
+
Notes:
37
+
- You can set the Private Key using the flags `--userPrivateKey` or `--userPrivateKeyFile` where `--userPrivateKey` takes the actual private key and `--userPrivateKeyFile` loads the content of a file as the PrivateKey, `--userPrivateKeyFile` overwrites the value of `--userPrivateKey`.
38
+
- You can also just store the serverAddress and your Private Key, if your Password is not set it will prompt you for it every time.
39
+
- MFA settings can also be save permenantly this ways
Copy file name to clipboardExpand all lines: cmd/root.go
+20-3Lines changed: 20 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,7 @@ package cmd
2
2
3
3
import (
4
4
"fmt"
5
+
"io/ioutil"
5
6
"os"
6
7
"path/filepath"
7
8
"time"
@@ -16,9 +17,10 @@ var cfgFile string
16
17
17
18
// rootCmd represents the base command when called without any subcommands
18
19
varrootCmd=&cobra.Command{
19
-
Use: "passbolt",
20
-
Short: "A CLI tool to interact with Passbolt.",
21
-
Long: `A CLI tool to interact with Passbolt.`,
20
+
Use: "passbolt",
21
+
Short: "A CLI tool to interact with Passbolt.",
22
+
Long: `A CLI tool to interact with Passbolt.`,
23
+
SilenceUsage: true,
22
24
}
23
25
24
26
// Execute adds all child commands to the root command and sets flags appropriately.
@@ -43,6 +45,7 @@ func init() {
43
45
rootCmd.PersistentFlags().Duration("timeout", time.Minute, "Timeout for the Context")
44
46
rootCmd.PersistentFlags().String("serverAddress", "", "Passbolt Server Address (https://passbolt.example.com)")
45
47
rootCmd.PersistentFlags().String("userPrivateKey", "", "Passbolt User Private Key")
48
+
rootCmd.PersistentFlags().String("userPrivateKeyFile", "", "Passbolt User Private Key File, if set then the userPrivateKey will be Overwritten with the File Content")
46
49
rootCmd.PersistentFlags().String("userPassword", "", "Passbolt User Password")
47
50
rootCmd.PersistentFlags().String("mfaMode", "interactive-totp", "How to Handle MFA, the following Modes exist: none, interactive-totp and noninteractive-totp")
48
51
rootCmd.PersistentFlags().String("totpToken", "", "Token to generate TOTP's, only used in nointeractive-totp mode")
@@ -91,4 +94,18 @@ func initConfig() {
91
94
// update Config file Permissions
92
95
os.Chmod(viper.ConfigFileUsed(), 0600)
93
96
}
97
+
98
+
// Read in Private Key from File if userprivatekeyfile is set
0 commit comments