vcert icon indicating copy to clipboard operation
vcert copied to clipboard

vcert enroll does not enforce timeout flag

Open dx0xm opened this issue 3 years ago • 4 comments

PROBLEM SUMMARY

vcert enroll does not enforce timeout flag. No matter what value you enter it always use 180 (3 minutes) timeout

commands.go have this error on line 356 req.Timeout = time.Duration(180) * time.Second should be req.Timeout = time.Duration(flags.timeout) * time.Second

confirmed working on local make build

STEPS TO REPRODUCE

vcert enroll --timeout 300

EXPECTED RESULTS

It should enforce timeout flag

ACTUAL RESULTS

not enforcing flag

ENVIRONMENT DETAILS

linux using vcert latest version but it may happen on other OS flavours as the error is within the main command code

COMMENTS/WORKAROUNDS

I apologize in advance for not doing a fork and submit a merge myself.

dx0xm avatar Dec 08 '22 03:12 dx0xm

Hi @dx0xm , thank you for reaching out. The timeout flag is provided during enrollment for both TLS and SSH certificates here https://github.com/Venafi/vcert/blob/master/cmd/vcert/commands.go#L357 and here https://github.com/Venafi/vcert/blob/master/cmd/vcert/commands.go#L500 , respectively. Not sure if there is some other place where you expected that flag to take effect.

luispresuelVenafi avatar Dec 08 '22 04:12 luispresuelVenafi

Hi @luispresuelVenafi , the flag is provided but not working for tls certificates.

This line: https://github.com/Venafi/vcert/blob/master/cmd/vcert/commands.go#L357 does not work because the flag is not used in here: https://github.com/Venafi/vcert/blob/master/cmd/vcert/commands.go#L356

It always uses the default 3m timeout. I can confirm it can be fixed if your replace https://github.com/Venafi/vcert/blob/master/cmd/vcert/commands.go#L356 with req.Timeout = time.Duration(flags.timeout) * time.Second

dx0xm avatar Dec 08 '22 05:12 dx0xm