Pull request: 4927-imp-ui
Updates #4927. Squashed commit of the following: commit 510143325805133e379ebc207cdc6bff59c94ade Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Tue Nov 22 15:00:13 2022 +0300 home: imp err commit fd65a9914494b6dccdee7c0f0aa08bce80ce0945 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon Nov 21 18:53:39 2022 +0300 client: imp validation ui
This commit is contained in:
@@ -393,6 +393,7 @@
|
|||||||
"encryption_issuer": "Issuer",
|
"encryption_issuer": "Issuer",
|
||||||
"encryption_hostnames": "Hostnames",
|
"encryption_hostnames": "Hostnames",
|
||||||
"encryption_reset": "Are you sure you want to reset encryption settings?",
|
"encryption_reset": "Are you sure you want to reset encryption settings?",
|
||||||
|
"encryption_warning": "Warning",
|
||||||
"topline_expiring_certificate": "Your SSL certificate is about to expire. Update <0>Encryption settings</0>.",
|
"topline_expiring_certificate": "Your SSL certificate is about to expire. Update <0>Encryption settings</0>.",
|
||||||
"topline_expired_certificate": "Your SSL certificate is expired. Update <0>Encryption settings</0>.",
|
"topline_expired_certificate": "Your SSL certificate is expired. Update <0>Encryption settings</0>.",
|
||||||
"form_error_port_range": "Enter port number in the range of 80-65535",
|
"form_error_port_range": "Enter port number in the range of 80-65535",
|
||||||
|
|||||||
@@ -56,6 +56,26 @@ const clearFields = (change, setTlsConfig, t) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const validationMessage = (warningValidation, isWarning) => {
|
||||||
|
if (!warningValidation) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isWarning) {
|
||||||
|
return (
|
||||||
|
<div className="col-12">
|
||||||
|
<p><Trans>encryption_warning</Trans>: {warningValidation}</p>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="col-12">
|
||||||
|
<p className="text-danger">{warningValidation}</p>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
let Form = (props) => {
|
let Form = (props) => {
|
||||||
const {
|
const {
|
||||||
t,
|
t,
|
||||||
@@ -95,6 +115,8 @@ let Form = (props) => {
|
|||||||
|| !valid_cert
|
|| !valid_cert
|
||||||
|| !valid_pair;
|
|| !valid_pair;
|
||||||
|
|
||||||
|
const isWarning = valid_key && valid_cert && valid_pair;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<form onSubmit={handleSubmit}>
|
<form onSubmit={handleSubmit}>
|
||||||
<div className="row">
|
<div className="row">
|
||||||
@@ -382,11 +404,7 @@ let Form = (props) => {
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{warning_validation && (
|
{validationMessage(warning_validation, isWarning)}
|
||||||
<div className="col-12">
|
|
||||||
<p className="text-danger">{warning_validation}</p>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="btn-list mt-2">
|
<div className="btn-list mt-2">
|
||||||
|
|||||||
@@ -513,6 +513,11 @@ func validateCertChain(certs []*x509.Certificate, srvName string) (err error) {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// errNoIPInCert is the error that is returned from [parseCertChain] if the leaf
|
||||||
|
// certificate doesn't contain IPs.
|
||||||
|
const errNoIPInCert errors.Error = `certificates has no IP addresses; ` +
|
||||||
|
`DNS-over-TLS won't be advertised via DDR`
|
||||||
|
|
||||||
// parseCertChain parses the certificate chain from raw data, and returns it.
|
// parseCertChain parses the certificate chain from raw data, and returns it.
|
||||||
// If ok is true, the returned error, if any, is not critical.
|
// If ok is true, the returned error, if any, is not critical.
|
||||||
func parseCertChain(chain []byte) (parsedCerts []*x509.Certificate, ok bool, err error) {
|
func parseCertChain(chain []byte) (parsedCerts []*x509.Certificate, ok bool, err error) {
|
||||||
@@ -535,8 +540,7 @@ func parseCertChain(chain []byte) (parsedCerts []*x509.Certificate, ok bool, err
|
|||||||
log.Info("tls: number of certs: %d", len(parsedCerts))
|
log.Info("tls: number of certs: %d", len(parsedCerts))
|
||||||
|
|
||||||
if !aghtls.CertificateHasIP(parsedCerts[0]) {
|
if !aghtls.CertificateHasIP(parsedCerts[0]) {
|
||||||
err = errors.Error(`certificate has no IP addresses` +
|
err = errNoIPInCert
|
||||||
`, this may cause issues with DNS-over-TLS clients`)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return parsedCerts, true, err
|
return parsedCerts, true, err
|
||||||
|
|||||||
Reference in New Issue
Block a user