@@ -8,7 +8,7 @@ import { WarningIcon, Icon } from '../../icons';
88import  {  trackEvent  }  from  '../../metrics' ; 
99
1010import  {  uploadFile  }  from  '../../util/ui' ; 
11- import  {  UnreachableCheck ,   asError ,  unreachableCheck  }  from  '../../util/error' ; 
11+ import  {  asError ,  unreachableCheck  }  from  '../../util/error' ; 
1212
1313import  {  UpstreamProxyType ,  RulesStore  }  from  '../../model/rules/rules-store' ; 
1414import  {  ParsedCertificate ,  ValidationResult  }  from  '../../model/crypto' ; 
@@ -19,7 +19,8 @@ import {
1919    versionSatisfies , 
2020    CLIENT_CERT_SERVER_RANGE , 
2121    PROXY_CONFIG_RANGE , 
22-     CUSTOM_CA_TRUST_RANGE 
22+     CUSTOM_CA_TRUST_RANGE , 
23+     WILDCARD_CLIENT_CERTS 
2324}  from  '../../services/service-versions' ; 
2425
2526import  {  inputValidation  }  from  '../component-utils' ; 
@@ -69,10 +70,17 @@ const UpstreamProxyDropdown = styled(Select)`
6970    margin-right: 10px; 
7071` ; 
7172
73+ const  isValidClientCertHost  =  ( input : string ) : boolean  => 
74+     isValidHost ( input )  ||  input  ===  '*' ; 
75+ 
7276const  validateHost  =  inputValidation ( isValidHost , 
7377    "Should be a plain hostname, optionally with a specific port" 
7478) ; 
7579
80+ const  validateClientCertHost  =  inputValidation ( isValidClientCertHost , 
81+     "Should be a plain hostname, optionally with a specific port, or '*'" 
82+ ) ; 
83+ 
7684const  isValidProxyHost  =  ( host : string  |  undefined ) : boolean  => 
7785    ! ! host ?. match ( / ^ ( [ ^ / @ ] * @ ) ? [ A - Z a - z 0 - 9 \- . ] + ( : \d + ) ? $ / ) ; 
7886const  validateProxyHost  =  inputValidation ( isValidProxyHost , 
@@ -426,7 +434,7 @@ class ClientCertificateConfig extends React.Component<{ rulesStore: RulesStore }
426434                    value = { this . clientCertHostInput } 
427435                    onChange = { action ( ( e : React . ChangeEvent < HTMLInputElement > )  =>  { 
428436                        this . clientCertHostInput  =  e . target . value ; 
429-                         validateHost ( e . target ) ; 
437+                         validateClientCertHost ( e . target ) ; 
430438                    } ) } 
431439                /> 
432440                {  this . clientCertState  ===  undefined 
@@ -477,7 +485,7 @@ class ClientCertificateConfig extends React.Component<{ rulesStore: RulesStore }
477485                } 
478486                < SettingsButton 
479487                    disabled = { 
480-                         ! isValidHost ( this . clientCertHostInput )  || 
488+                         ! isValidClientCertHost ( this . clientCertHostInput )  || 
481489                        this . clientCertState  !==  'decrypted'  ||  // Not decrypted yet, or 
482490                        ! ! clientCertificateHostMap [ this . clientCertHostInput ]  // Duplicate host 
483491                    } 
@@ -488,7 +496,11 @@ class ClientCertificateConfig extends React.Component<{ rulesStore: RulesStore }
488496            </ ClientCertificatesList > 
489497            < SettingsExplanation > 
490498                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+                 } 
492504            </ SettingsExplanation > 
493505        </ > ; 
494506    } 
0 commit comments