@@ -8,7 +8,7 @@ import { WarningIcon, Icon } from '../../icons';
8
8
import { trackEvent } from '../../metrics' ;
9
9
10
10
import { uploadFile } from '../../util/ui' ;
11
- import { UnreachableCheck , asError , unreachableCheck } from '../../util/error' ;
11
+ import { asError , unreachableCheck } from '../../util/error' ;
12
12
13
13
import { UpstreamProxyType , RulesStore } from '../../model/rules/rules-store' ;
14
14
import { ParsedCertificate , ValidationResult } from '../../model/crypto' ;
@@ -19,7 +19,8 @@ import {
19
19
versionSatisfies ,
20
20
CLIENT_CERT_SERVER_RANGE ,
21
21
PROXY_CONFIG_RANGE ,
22
- CUSTOM_CA_TRUST_RANGE
22
+ CUSTOM_CA_TRUST_RANGE ,
23
+ WILDCARD_CLIENT_CERTS
23
24
} from '../../services/service-versions' ;
24
25
25
26
import { inputValidation } from '../component-utils' ;
@@ -69,10 +70,17 @@ const UpstreamProxyDropdown = styled(Select)`
69
70
margin-right: 10px;
70
71
` ;
71
72
73
+ const isValidClientCertHost = ( input : string ) : boolean =>
74
+ isValidHost ( input ) || input === '*' ;
75
+
72
76
const validateHost = inputValidation ( isValidHost ,
73
77
"Should be a plain hostname, optionally with a specific port"
74
78
) ;
75
79
80
+ const validateClientCertHost = inputValidation ( isValidClientCertHost ,
81
+ "Should be a plain hostname, optionally with a specific port, or '*'"
82
+ ) ;
83
+
76
84
const isValidProxyHost = ( host : string | undefined ) : boolean =>
77
85
! ! host ?. match ( / ^ ( [ ^ / @ ] * @ ) ? [ A - Z a - z 0 - 9 \- . ] + ( : \d + ) ? $ / ) ;
78
86
const validateProxyHost = inputValidation ( isValidProxyHost ,
@@ -426,7 +434,7 @@ class ClientCertificateConfig extends React.Component<{ rulesStore: RulesStore }
426
434
value = { this . clientCertHostInput }
427
435
onChange = { action ( ( e : React . ChangeEvent < HTMLInputElement > ) => {
428
436
this . clientCertHostInput = e . target . value ;
429
- validateHost ( e . target ) ;
437
+ validateClientCertHost ( e . target ) ;
430
438
} ) }
431
439
/>
432
440
{ this . clientCertState === undefined
@@ -477,7 +485,7 @@ class ClientCertificateConfig extends React.Component<{ rulesStore: RulesStore }
477
485
}
478
486
< SettingsButton
479
487
disabled = {
480
- ! isValidHost ( this . clientCertHostInput ) ||
488
+ ! isValidClientCertHost ( this . clientCertHostInput ) ||
481
489
this . clientCertState !== 'decrypted' || // Not decrypted yet, or
482
490
! ! clientCertificateHostMap [ this . clientCertHostInput ] // Duplicate host
483
491
}
@@ -488,7 +496,11 @@ class ClientCertificateConfig extends React.Component<{ rulesStore: RulesStore }
488
496
</ ClientCertificatesList >
489
497
< SettingsExplanation >
490
498
These certificates will be used for client TLS authentication, if requested by the server, when
491
- connecting to their corresponding hostname.
499
+ connecting to their corresponding hostname. {
500
+ versionSatisfies ( serverVersion . value , WILDCARD_CLIENT_CERTS )
501
+ ? < > Use < code > *</ code > to use a certificate for all hosts.</ >
502
+ : ''
503
+ }
492
504
</ SettingsExplanation >
493
505
</ > ;
494
506
}
0 commit comments