Skip to content

Commit 3ca1c9a

Browse files
committed
feat(kmip): add kmip flags for pykmip compatibility
Signed-off-by: Pierre-Henri Symoneaux <[email protected]>
1 parent 7f6a315 commit 3ca1c9a

22 files changed

+250
-176
lines changed

cmd/okms/kmip/register.go

+8
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,8 @@ VALUE can be either plain text, a '-' to read from stdin, or a filename prefixed
155155
name := cmd.Flags().String("name", "", "Optional name for the certificate")
156156
description := cmd.Flags().String("description", "", "Set the description attribute")
157157
comment := cmd.Flags().String("comment", "", "Set the comment attribute")
158+
publicKeyId := cmd.Flags().String("public-key", "", "Set a link to the certificates public key")
159+
parent := cmd.Flags().String("parent", "", "Set a link to the parent signing certificate")
158160

159161
cmd.Run = func(cmd *cobra.Command, args []string) {
160162
cert := flagsmgmt.BytesFromArg(args[0], 16_000)
@@ -175,6 +177,12 @@ VALUE can be either plain text, a '-' to read from stdin, or a filename prefixed
175177
if *comment != "" {
176178
req = req.WithAttribute(kmip.AttributeNameComment, *comment)
177179
}
180+
if *publicKeyId != "" {
181+
req = req.WithLink(kmip.LinkTypePublicKeyLink, *publicKeyId)
182+
}
183+
if *parent != "" {
184+
req = req.WithLink(kmip.LinkTypeCertificateLink, *parent)
185+
}
178186
resp := exit.OnErr2(req.ExecContext(cmd.Context()))
179187

180188
if cmd.Flag("output").Value.String() == string(flagsmgmt.JSON_OUTPUT_FORMAT) {

cmd/okms/kmip/root.go

+10-3
Original file line numberDiff line numberDiff line change
@@ -25,23 +25,30 @@ var kmipClient *kmipclient.Client
2525
func SetupKmipFlags(command *cobra.Command, cust CustomizeFunc) {
2626
debug := command.PersistentFlags().BoolP("debug", "d", false, "Activate debug mode")
2727
// retry := command.PersistentFlags().Uint32("retry", 4, "Maximum number of HTTP retries")
28-
// timeout := command.PersistentFlags().Duration("timeout", okms.DefaultHTTPClientTimeout, "Timeout duration for HTTP requests")
28+
timeout := command.PersistentFlags().Duration("timeout", 0, "Timeout duration for KMIP requests")
29+
noCcv := command.PersistentFlags().Bool("no-ccv", false, "Disable kmip client correlation value")
30+
tls12Ciphers := command.PersistentFlags().StringArray("tls12-ciphers", nil, "List of TLS 1.2 ciphers to use")
2931

3032
f := func(*[]kmipclient.Option) {}
3133
if cust != nil {
3234
f = cust(command)
3335
}
3436

3537
config.SetupEndpointFlags(command, "kmip", func(command *cobra.Command, cfg config.EndpointConfig) {
36-
middlewares := []kmipclient.Middleware{
37-
kmipclient.CorrelationValueMiddleware(uuid.NewString),
38+
middlewares := []kmipclient.Middleware{}
39+
if !*noCcv {
40+
middlewares = append(middlewares, kmipclient.CorrelationValueMiddleware(uuid.NewString))
3841
}
3942
if *debug {
4043
middlewares = append(middlewares, kmipclient.DebugMiddleware(os.Stderr, ttlv.MarshalXML))
4144
}
45+
if *timeout > 0 {
46+
middlewares = append(middlewares, kmipclient.TimeoutMiddleware(*timeout))
47+
}
4248
opts := []kmipclient.Option{
4349
kmipclient.WithTlsConfig(cfg.TlsConfig("")),
4450
kmipclient.WithMiddlewares(middlewares...),
51+
kmipclient.WithTlsCipherSuiteNames(*tls12Ciphers...),
4552
}
4653
f(&opts)
4754
kmipClient = exit.OnErr2(kmipclient.Dial(

doc/okms_keys_list.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ okms keys list [flags]
99
### Options
1010

1111
```
12-
-A, --all List all keys (including deactivated and deleted ones)
13-
-h, --help help for list
14-
--page-size int32 Number of keys to fetch per page (between 10 and 500) (default 100)
12+
-A, --all List all keys (including deactivated and deleted ones)
13+
-h, --help help for list
14+
--page-size uint32 Number of keys to fetch per page (between 10 and 500) (default 100)
1515
```
1616

1717
### Options inherited from parent commands

doc/okms_kmip.md

+11-8
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,17 @@ Manage kmip objects
55
### Options
66

77
```
8-
--auth-method mtls Authentication method to use
9-
--ca string Path to CA bundle
10-
--cert string Path to certificate
11-
-d, --debug Activate debug mode
12-
--endpoint string Endpoint address to kmip
13-
-h, --help help for kmip
14-
--key string Path to key file
15-
--output text|json The formatting style for command output. (default text)
8+
--auth-method mtls Authentication method to use
9+
--ca string Path to CA bundle
10+
--cert string Path to certificate
11+
-d, --debug Activate debug mode
12+
--endpoint string Endpoint address to kmip
13+
-h, --help help for kmip
14+
--key string Path to key file
15+
--no-ccv Disable kmip client correlation value
16+
--output text|json The formatting style for command output. (default text)
17+
--timeout duration Timeout duration for KMIP requests
18+
--tls12-ciphers stringArray List of TLS 1.2 ciphers to use
1619
```
1720

1821
### Options inherited from parent commands

doc/okms_kmip_activate.md

+12-9
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,18 @@ okms kmip activate ID [flags]
1515
### Options inherited from parent commands
1616

1717
```
18-
--auth-method mtls Authentication method to use
19-
--ca string Path to CA bundle
20-
--cert string Path to certificate
21-
-c, --config string Path to a non default configuration file
22-
-d, --debug Activate debug mode
23-
--endpoint string Endpoint address to kmip
24-
--key string Path to key file
25-
--output text|json The formatting style for command output. (default text)
26-
--profile string Name of the profile (default "default")
18+
--auth-method mtls Authentication method to use
19+
--ca string Path to CA bundle
20+
--cert string Path to certificate
21+
-c, --config string Path to a non default configuration file
22+
-d, --debug Activate debug mode
23+
--endpoint string Endpoint address to kmip
24+
--key string Path to key file
25+
--no-ccv Disable kmip client correlation value
26+
--output text|json The formatting style for command output. (default text)
27+
--profile string Name of the profile (default "default")
28+
--timeout duration Timeout duration for KMIP requests
29+
--tls12-ciphers stringArray List of TLS 1.2 ciphers to use
2730
```
2831

2932
### SEE ALSO

doc/okms_kmip_attributes.md

+12-9
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,18 @@ Manage an object's attributes
1111
### Options inherited from parent commands
1212

1313
```
14-
--auth-method mtls Authentication method to use
15-
--ca string Path to CA bundle
16-
--cert string Path to certificate
17-
-c, --config string Path to a non default configuration file
18-
-d, --debug Activate debug mode
19-
--endpoint string Endpoint address to kmip
20-
--key string Path to key file
21-
--output text|json The formatting style for command output. (default text)
22-
--profile string Name of the profile (default "default")
14+
--auth-method mtls Authentication method to use
15+
--ca string Path to CA bundle
16+
--cert string Path to certificate
17+
-c, --config string Path to a non default configuration file
18+
-d, --debug Activate debug mode
19+
--endpoint string Endpoint address to kmip
20+
--key string Path to key file
21+
--no-ccv Disable kmip client correlation value
22+
--output text|json The formatting style for command output. (default text)
23+
--profile string Name of the profile (default "default")
24+
--timeout duration Timeout duration for KMIP requests
25+
--tls12-ciphers stringArray List of TLS 1.2 ciphers to use
2326
```
2427

2528
### SEE ALSO

doc/okms_kmip_attributes_get.md

+12-9
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,18 @@ okms kmip attributes get ID [flags]
1515
### Options inherited from parent commands
1616

1717
```
18-
--auth-method mtls Authentication method to use
19-
--ca string Path to CA bundle
20-
--cert string Path to certificate
21-
-c, --config string Path to a non default configuration file
22-
-d, --debug Activate debug mode
23-
--endpoint string Endpoint address to kmip
24-
--key string Path to key file
25-
--output text|json The formatting style for command output. (default text)
26-
--profile string Name of the profile (default "default")
18+
--auth-method mtls Authentication method to use
19+
--ca string Path to CA bundle
20+
--cert string Path to certificate
21+
-c, --config string Path to a non default configuration file
22+
-d, --debug Activate debug mode
23+
--endpoint string Endpoint address to kmip
24+
--key string Path to key file
25+
--no-ccv Disable kmip client correlation value
26+
--output text|json The formatting style for command output. (default text)
27+
--profile string Name of the profile (default "default")
28+
--timeout duration Timeout duration for KMIP requests
29+
--tls12-ciphers stringArray List of TLS 1.2 ciphers to use
2730
```
2831

2932
### SEE ALSO

doc/okms_kmip_create.md

+12-9
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,18 @@ Create kmip keys
1111
### Options inherited from parent commands
1212

1313
```
14-
--auth-method mtls Authentication method to use
15-
--ca string Path to CA bundle
16-
--cert string Path to certificate
17-
-c, --config string Path to a non default configuration file
18-
-d, --debug Activate debug mode
19-
--endpoint string Endpoint address to kmip
20-
--key string Path to key file
21-
--output text|json The formatting style for command output. (default text)
22-
--profile string Name of the profile (default "default")
14+
--auth-method mtls Authentication method to use
15+
--ca string Path to CA bundle
16+
--cert string Path to certificate
17+
-c, --config string Path to a non default configuration file
18+
-d, --debug Activate debug mode
19+
--endpoint string Endpoint address to kmip
20+
--key string Path to key file
21+
--no-ccv Disable kmip client correlation value
22+
--output text|json The formatting style for command output. (default text)
23+
--profile string Name of the profile (default "default")
24+
--timeout duration Timeout duration for KMIP requests
25+
--tls12-ciphers stringArray List of TLS 1.2 ciphers to use
2326
```
2427

2528
### SEE ALSO

doc/okms_kmip_create_key-pair.md

+12-9
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,18 @@ okms kmip create key-pair [flags]
2626
### Options inherited from parent commands
2727

2828
```
29-
--auth-method mtls Authentication method to use
30-
--ca string Path to CA bundle
31-
--cert string Path to certificate
32-
-c, --config string Path to a non default configuration file
33-
-d, --debug Activate debug mode
34-
--endpoint string Endpoint address to kmip
35-
--key string Path to key file
36-
--output text|json The formatting style for command output. (default text)
37-
--profile string Name of the profile (default "default")
29+
--auth-method mtls Authentication method to use
30+
--ca string Path to CA bundle
31+
--cert string Path to certificate
32+
-c, --config string Path to a non default configuration file
33+
-d, --debug Activate debug mode
34+
--endpoint string Endpoint address to kmip
35+
--key string Path to key file
36+
--no-ccv Disable kmip client correlation value
37+
--output text|json The formatting style for command output. (default text)
38+
--profile string Name of the profile (default "default")
39+
--timeout duration Timeout duration for KMIP requests
40+
--tls12-ciphers stringArray List of TLS 1.2 ciphers to use
3841
```
3942

4043
### SEE ALSO

doc/okms_kmip_create_symmetric.md

+12-9
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,18 @@ okms kmip create symmetric [flags]
2323
### Options inherited from parent commands
2424

2525
```
26-
--auth-method mtls Authentication method to use
27-
--ca string Path to CA bundle
28-
--cert string Path to certificate
29-
-c, --config string Path to a non default configuration file
30-
-d, --debug Activate debug mode
31-
--endpoint string Endpoint address to kmip
32-
--key string Path to key file
33-
--output text|json The formatting style for command output. (default text)
34-
--profile string Name of the profile (default "default")
26+
--auth-method mtls Authentication method to use
27+
--ca string Path to CA bundle
28+
--cert string Path to certificate
29+
-c, --config string Path to a non default configuration file
30+
-d, --debug Activate debug mode
31+
--endpoint string Endpoint address to kmip
32+
--key string Path to key file
33+
--no-ccv Disable kmip client correlation value
34+
--output text|json The formatting style for command output. (default text)
35+
--profile string Name of the profile (default "default")
36+
--timeout duration Timeout duration for KMIP requests
37+
--tls12-ciphers stringArray List of TLS 1.2 ciphers to use
3538
```
3639

3740
### SEE ALSO

doc/okms_kmip_destroy.md

+12-9
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,18 @@ okms kmip destroy ID [flags]
1616
### Options inherited from parent commands
1717

1818
```
19-
--auth-method mtls Authentication method to use
20-
--ca string Path to CA bundle
21-
--cert string Path to certificate
22-
-c, --config string Path to a non default configuration file
23-
-d, --debug Activate debug mode
24-
--endpoint string Endpoint address to kmip
25-
--key string Path to key file
26-
--output text|json The formatting style for command output. (default text)
27-
--profile string Name of the profile (default "default")
19+
--auth-method mtls Authentication method to use
20+
--ca string Path to CA bundle
21+
--cert string Path to certificate
22+
-c, --config string Path to a non default configuration file
23+
-d, --debug Activate debug mode
24+
--endpoint string Endpoint address to kmip
25+
--key string Path to key file
26+
--no-ccv Disable kmip client correlation value
27+
--output text|json The formatting style for command output. (default text)
28+
--profile string Name of the profile (default "default")
29+
--timeout duration Timeout duration for KMIP requests
30+
--tls12-ciphers stringArray List of TLS 1.2 ciphers to use
2831
```
2932

3033
### SEE ALSO

doc/okms_kmip_get.md

+12-9
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,18 @@ okms kmip get ID [flags]
1515
### Options inherited from parent commands
1616

1717
```
18-
--auth-method mtls Authentication method to use
19-
--ca string Path to CA bundle
20-
--cert string Path to certificate
21-
-c, --config string Path to a non default configuration file
22-
-d, --debug Activate debug mode
23-
--endpoint string Endpoint address to kmip
24-
--key string Path to key file
25-
--output text|json The formatting style for command output. (default text)
26-
--profile string Name of the profile (default "default")
18+
--auth-method mtls Authentication method to use
19+
--ca string Path to CA bundle
20+
--cert string Path to certificate
21+
-c, --config string Path to a non default configuration file
22+
-d, --debug Activate debug mode
23+
--endpoint string Endpoint address to kmip
24+
--key string Path to key file
25+
--no-ccv Disable kmip client correlation value
26+
--output text|json The formatting style for command output. (default text)
27+
--profile string Name of the profile (default "default")
28+
--timeout duration Timeout duration for KMIP requests
29+
--tls12-ciphers stringArray List of TLS 1.2 ciphers to use
2730
```
2831

2932
### SEE ALSO

doc/okms_kmip_locate.md

+12-9
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,18 @@ okms kmip locate [flags]
1818
### Options inherited from parent commands
1919

2020
```
21-
--auth-method mtls Authentication method to use
22-
--ca string Path to CA bundle
23-
--cert string Path to certificate
24-
-c, --config string Path to a non default configuration file
25-
-d, --debug Activate debug mode
26-
--endpoint string Endpoint address to kmip
27-
--key string Path to key file
28-
--output text|json The formatting style for command output. (default text)
29-
--profile string Name of the profile (default "default")
21+
--auth-method mtls Authentication method to use
22+
--ca string Path to CA bundle
23+
--cert string Path to certificate
24+
-c, --config string Path to a non default configuration file
25+
-d, --debug Activate debug mode
26+
--endpoint string Endpoint address to kmip
27+
--key string Path to key file
28+
--no-ccv Disable kmip client correlation value
29+
--output text|json The formatting style for command output. (default text)
30+
--profile string Name of the profile (default "default")
31+
--timeout duration Timeout duration for KMIP requests
32+
--tls12-ciphers stringArray List of TLS 1.2 ciphers to use
3033
```
3134

3235
### SEE ALSO

doc/okms_kmip_register.md

+12-9
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,18 @@ Register a kmip object
1111
### Options inherited from parent commands
1212

1313
```
14-
--auth-method mtls Authentication method to use
15-
--ca string Path to CA bundle
16-
--cert string Path to certificate
17-
-c, --config string Path to a non default configuration file
18-
-d, --debug Activate debug mode
19-
--endpoint string Endpoint address to kmip
20-
--key string Path to key file
21-
--output text|json The formatting style for command output. (default text)
22-
--profile string Name of the profile (default "default")
14+
--auth-method mtls Authentication method to use
15+
--ca string Path to CA bundle
16+
--cert string Path to certificate
17+
-c, --config string Path to a non default configuration file
18+
-d, --debug Activate debug mode
19+
--endpoint string Endpoint address to kmip
20+
--key string Path to key file
21+
--no-ccv Disable kmip client correlation value
22+
--output text|json The formatting style for command output. (default text)
23+
--profile string Name of the profile (default "default")
24+
--timeout duration Timeout duration for KMIP requests
25+
--tls12-ciphers stringArray List of TLS 1.2 ciphers to use
2326
```
2427

2528
### SEE ALSO

0 commit comments

Comments
 (0)