mirror of
https://github.com/pomerium/pomerium.git
synced 2025-08-03 00:40:25 +02:00
authorize/evaluator/opa: set client tls cert usage explicitly (#1026)
This commit is contained in:
parent
f8491b48ee
commit
e27ee4dd32
1 changed files with 7 additions and 1 deletions
|
@ -10,6 +10,7 @@ import (
|
|||
"github.com/rakyll/statik/fs"
|
||||
|
||||
_ "github.com/pomerium/pomerium/authorize/evaluator/opa/policy" // load static assets
|
||||
"github.com/pomerium/pomerium/internal/log"
|
||||
)
|
||||
|
||||
var isValidClientCertificateCache, _ = lru.New2Q(100)
|
||||
|
@ -41,10 +42,15 @@ func isValidClientCertificate(ca, cert string) (bool, error) {
|
|||
}
|
||||
|
||||
_, verifyErr := xcert.Verify(x509.VerifyOptions{
|
||||
Roots: roots,
|
||||
Roots: roots,
|
||||
KeyUsages: []x509.ExtKeyUsage{x509.ExtKeyUsageClientAuth},
|
||||
})
|
||||
valid := verifyErr == nil
|
||||
|
||||
if verifyErr != nil {
|
||||
log.Debug().Err(verifyErr).Msg("client certificate failed verification: %w")
|
||||
}
|
||||
|
||||
isValidClientCertificateCache.Add(cacheKey, valid)
|
||||
|
||||
return valid, nil
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue