Skip to content

Commit

Permalink
Set the default session ttl in generateCert
Browse files Browse the repository at this point in the history
use default session ttl for `tctl auth sign`

leave tctl alone
  • Loading branch information
lxea committed Jun 23, 2023
1 parent 0760bc9 commit da99d31
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/auth/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -2071,6 +2071,10 @@ func generateCert(a *Server, req certRequest, caType types.CertAuthType) (*proto
var sessionTTL time.Duration
var allowedLogins []string

if req.ttl == 0 {
req.ttl = time.Duration(authPref.GetDefaultSessionTTL())
}

// If the role TTL is ignored, do not restrict session TTL and allowed logins.
// The only caller setting this parameter should be "tctl auth sign".
// Otherwise, set the session TTL to the smallest of all roles and
Expand Down

0 comments on commit da99d31

Please sign in to comment.