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

tls-expire(api): add TLS cert expiration check #1059

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

skrashevich
Copy link
Contributor

  • Refactor of certificate loading into its own function:

    • Extracted the previous inline certificate loading code from tlsListen into a new, dedicated function LoadCertificate. This function is responsible for loading a TLS certificate from given file paths or directly from string content, ensuring better testability and separation of concerns.
    • Now, LoadCertificate returns both tls.Certificate and error, which improves error handling allowing the calling function to take decisions based on the error returned.
  • Enhanced TLS Certificate Loading and Validating in tlsListen:

    • Integrated the new LoadCertificate function in the tlsListen function.
    • Added error logging right after certificate loading to immediately catch and log issues pertaining to file access or content issues without proceeding further.
    • Performed certificate expiration check after loading the certificate; logs an error if the certificate has expired, otherwise logs the expiry date. This preemptive check helps avoid runtime surprises related to expired certificates.
  • Improved logging:

    • Added additional log entries such as trace logs for beginning of the listening process and informative logs for successful listening setup including certificate expiry details. This enhancement aids in better observability and debugging capabilities of the listening process.

@AlexxIT AlexxIT added the doubt label Apr 23, 2024
@AlexxIT
Copy link
Owner

AlexxIT commented Apr 23, 2024

I still think that running TLS on the go2rtc side is not a core functionality at all. And in a normal setup it should be given to special software - nginx or similar.

@felipecrs
Copy link
Contributor

felipecrs commented Apr 30, 2024

@AlexxIT I agree with you, it's not worth implementing these features in go2rtc.

However, @skrashevich implemented it already. I'd probably take it, since it's free. 😅

@AlexxIT
Copy link
Owner

AlexxIT commented Apr 30, 2024

Every line of code is not free. It can increase support time. Time of reading code. Time of adding new code, that can be affected. Time of answering on questions about this functionality.

@felipecrs
Copy link
Contributor

That's 100% true.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants