Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

crypto change subject alternate errors to warning #1545

Merged
merged 2 commits into from
Jan 12, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions asyncua/crypto/uacrypto.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,14 +341,14 @@ def check_certificate(cert: x509.Certificate, application_uri: str, hostname: Op
san = cert.extensions.get_extension_for_class(x509.SubjectAlternativeName)
san_uri = san.value.get_values_for_type(x509.UniformResourceIdentifier)
if application_uri not in san_uri:
_logger.error(f'certificate does not contain the application uri ({application_uri}). Most applications will reject a connection without it.')
_logger.warning(f'certificate does not contain the application uri ({application_uri}). Most applications will reject a connection without it.')
err = True
if hostname is not None:
san_dns_names = san.value.get_values_for_type(x509.DNSName)
if hostname not in san_dns_names:
_logger.error(f'certificate does not contain the hostname in DNSNames {hostname}. Some applications will check this.')
_logger.warning(f'certificate does not contain the hostname in DNSNames {hostname}. Some applications will check this.')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you are at it, one should not use fstring for logging....

err = True
except x509.ExtensionNotFound:
_logger.error('certificate has no SubjectAlternativeName this is need for application verification!')
_logger.warning('certificate has no SubjectAlternativeName this is need for application verification!')
err = True
return err
Loading