Skip to content

Commit d2a3f94

Browse files
committed
Cleanup
1 parent def501d commit d2a3f94

File tree

1 file changed

+40
-42
lines changed
  • internal/ingress/annotations/authtls

1 file changed

+40
-42
lines changed

internal/ingress/annotations/authtls/main.go

Lines changed: 40 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -45,49 +45,47 @@ var (
4545
redirectRegex = regexp.MustCompile(`^(@[A-Za-z0-9_-]+|((https?://)?[A-Za-z0-9\-.]+(:\d+)?)?(/[A-Za-z0-9\-_.]+)*/?)$`)
4646
)
4747

48-
var (
49-
authTLSAnnotations = parser.Annotation{
50-
Group: "authentication",
51-
Annotations: parser.AnnotationFields{
52-
annotationAuthTLSSecret: {
53-
Validator: parser.ValidateRegex(parser.BasicCharsRegex, true),
54-
Scope: parser.AnnotationScopeLocation,
55-
Risk: parser.AnnotationRiskMedium, // Medium as it allows a subset of chars
56-
Documentation: `This annotation defines the secret that contains the certificate chain of allowed certs`,
57-
},
58-
annotationAuthTLSVerifyClient: {
59-
Validator: parser.ValidateRegex(authVerifyClientRegex, true),
60-
Scope: parser.AnnotationScopeLocation,
61-
Risk: parser.AnnotationRiskMedium, // Medium as it allows a subset of chars
62-
Documentation: `This annotation enables verification of client certificates. Can be "on", "off", "optional" or "optional_no_ca"`,
63-
},
64-
annotationAuthTLSVerifyDepth: {
65-
Validator: parser.ValidateInt,
66-
Scope: parser.AnnotationScopeLocation,
67-
Risk: parser.AnnotationRiskLow,
68-
Documentation: `This annotation defines validation depth between the provided client certificate and the Certification Authority chain.`,
69-
},
70-
annotationAuthTLSErrorPage: {
71-
Validator: parser.ValidateRegex(redirectRegex, true),
72-
Scope: parser.AnnotationScopeLocation,
73-
Risk: parser.AnnotationRiskHigh,
74-
Documentation: `This annotation defines the URL/Page that user should be redirected in case of a Certificate Authentication Error`,
75-
},
76-
annotationAuthTLSPassCertToUpstream: {
77-
Validator: parser.ValidateBool,
78-
Scope: parser.AnnotationScopeLocation,
79-
Risk: parser.AnnotationRiskLow,
80-
Documentation: `This annotation defines if the received certificates should be passed or not to the upstream server in the header "ssl-client-cert"`,
81-
},
82-
annotationAuthTLSMatchCN: {
83-
Validator: parser.CommonNameAnnotationValidator,
84-
Scope: parser.AnnotationScopeLocation,
85-
Risk: parser.AnnotationRiskHigh,
86-
Documentation: `This annotation adds a sanity check for the CN of the client certificate that is sent over using a string / regex starting with "CN="`,
87-
},
48+
var authTLSAnnotations = parser.Annotation{
49+
Group: "authentication",
50+
Annotations: parser.AnnotationFields{
51+
annotationAuthTLSSecret: {
52+
Validator: parser.ValidateRegex(parser.BasicCharsRegex, true),
53+
Scope: parser.AnnotationScopeLocation,
54+
Risk: parser.AnnotationRiskMedium, // Medium as it allows a subset of chars
55+
Documentation: `This annotation defines the secret that contains the certificate chain of allowed certs`,
8856
},
89-
}
90-
)
57+
annotationAuthTLSVerifyClient: {
58+
Validator: parser.ValidateRegex(authVerifyClientRegex, true),
59+
Scope: parser.AnnotationScopeLocation,
60+
Risk: parser.AnnotationRiskMedium, // Medium as it allows a subset of chars
61+
Documentation: `This annotation enables verification of client certificates. Can be "on", "off", "optional" or "optional_no_ca"`,
62+
},
63+
annotationAuthTLSVerifyDepth: {
64+
Validator: parser.ValidateInt,
65+
Scope: parser.AnnotationScopeLocation,
66+
Risk: parser.AnnotationRiskLow,
67+
Documentation: `This annotation defines validation depth between the provided client certificate and the Certification Authority chain.`,
68+
},
69+
annotationAuthTLSErrorPage: {
70+
Validator: parser.ValidateRegex(redirectRegex, true),
71+
Scope: parser.AnnotationScopeLocation,
72+
Risk: parser.AnnotationRiskHigh,
73+
Documentation: `This annotation defines the URL/Page that user should be redirected in case of a Certificate Authentication Error`,
74+
},
75+
annotationAuthTLSPassCertToUpstream: {
76+
Validator: parser.ValidateBool,
77+
Scope: parser.AnnotationScopeLocation,
78+
Risk: parser.AnnotationRiskLow,
79+
Documentation: `This annotation defines if the received certificates should be passed or not to the upstream server in the header "ssl-client-cert"`,
80+
},
81+
annotationAuthTLSMatchCN: {
82+
Validator: parser.CommonNameAnnotationValidator,
83+
Scope: parser.AnnotationScopeLocation,
84+
Risk: parser.AnnotationRiskHigh,
85+
Documentation: `This annotation adds a sanity check for the CN of the client certificate that is sent over using a string / regex starting with "CN="`,
86+
},
87+
},
88+
}
9189

9290
// Config contains the AuthSSLCert used for mutual authentication
9391
// and the configured ValidationDepth

0 commit comments

Comments
 (0)