[GH-ISSUE #549] Unable to set idleLockTimeout without idleKillTimeout #137

Closed
opened 2026-05-07 00:19:19 +02:00 by BreizhHardware · 1 comment

Originally created by @alexdupre on GitHub (Apr 8, 2025).
Original GitHub issue: https://github.com/ovh/the-bastion/issues/549

The following code seems to have a couple of issues:

  1. idleLockTimeout is re-set to 0 if the idleKillTimeout is disabled (0 is less than any value)
  2. the log message says setting 'idleKillTimeout' to 0 while it's actually idleLockTimeout
    github.com/ovh/the-bastion@2851d6f42c/lib/perl/OVH/Bastion/configuration.inc (L529-L538)
Originally created by @alexdupre on GitHub (Apr 8, 2025). Original GitHub issue: https://github.com/ovh/the-bastion/issues/549 The following code seems to have a couple of issues: 1. `idleLockTimeout` is re-set to `0` if the `idleKillTimeout` is disabled (0 is less than any value) 2. the log message says `setting 'idleKillTimeout' to 0` while it's actually `idleLockTimeout` https://github.com/ovh/the-bastion/blob/2851d6f42c2afd31e7d578720bb1f33105b4ec95/lib/perl/OVH/Bastion/configuration.inc#L529-L538
Author
Owner

@speed47 commented on GitHub (Jul 7, 2025):

Thanks for the report, indeed there was a logic error here, plus a misleading log, both were probably typos:

     # ... if kill timeout is lower than lock timeout, just unset lock timeout
-    if ($C->{'idleKillTimeout'} <= $C->{'idleLockTimeout'} && $C->{'idleLockTimeout'} != 0) {
+    if ($C->{'idleKillTimeout'} <= $C->{'idleLockTimeout'} && $C->{'idleKillTimeout'} != 0) {
         push @errors,
             "Configuration error: option 'idleKillTimeout' ("
           . $C->{'idleKillTimeout'}
           . ") is <= 'idleLockTimeout' ("
           . $C->{'idleLockTimeout'}
-          . "), setting 'idleKillTimeout' to 0";
+          . "), setting 'idleLockTimeout' to 0";
         $C->{'idleLockTimeout'} = 0;
     }

With this logic, all cases are now correct:

Okay lock 0 and kill 0 make sense
Okay lock 2 and kill 0 make sense
Okay lock 10 and kill 0 make sense
Okay lock 0 and kill 3 make sense
Okay lock 2 and kill 3 make sense
Configuration error: option 'idleKillTimeout' (3) is <= 'idleLockTimeout' (10), setting 'idleLockTimeout' to 0
Okay lock 0 and kill 10 make sense
Okay lock 2 and kill 10 make sense
Configuration error: option 'idleKillTimeout' (10) is <= 'idleLockTimeout' (10), setting 'idleLockTimeout' to 0
<!-- gh-comment-id:3044374725 --> @speed47 commented on GitHub (Jul 7, 2025): Thanks for the report, indeed there was a logic error here, plus a misleading log, both were probably typos: ```diff # ... if kill timeout is lower than lock timeout, just unset lock timeout - if ($C->{'idleKillTimeout'} <= $C->{'idleLockTimeout'} && $C->{'idleLockTimeout'} != 0) { + if ($C->{'idleKillTimeout'} <= $C->{'idleLockTimeout'} && $C->{'idleKillTimeout'} != 0) { push @errors, "Configuration error: option 'idleKillTimeout' (" . $C->{'idleKillTimeout'} . ") is <= 'idleLockTimeout' (" . $C->{'idleLockTimeout'} - . "), setting 'idleKillTimeout' to 0"; + . "), setting 'idleLockTimeout' to 0"; $C->{'idleLockTimeout'} = 0; } ``` With this logic, all cases are now correct: ``` Okay lock 0 and kill 0 make sense Okay lock 2 and kill 0 make sense Okay lock 10 and kill 0 make sense Okay lock 0 and kill 3 make sense Okay lock 2 and kill 3 make sense Configuration error: option 'idleKillTimeout' (3) is <= 'idleLockTimeout' (10), setting 'idleLockTimeout' to 0 Okay lock 0 and kill 10 make sense Okay lock 2 and kill 10 make sense Configuration error: option 'idleKillTimeout' (10) is <= 'idleLockTimeout' (10), setting 'idleLockTimeout' to 0 ```
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/the-bastion#137
No description provided.