GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Unify TLS configuration by jhl221123 · Pull Request #3902 · apache/logging-log4j2

Conversation

@jhl221123

@jhl221123 jhl221123 commented Aug 28, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor
  • Introduced TlsConfiguration interface
  • Defaulted verifyHostname to true
  • Repurposed Http.verifyHostname as a toggle for backward compatibility

Related to #2792

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@jhl221123
Unify TLS configuration
8e0d5b5
- Introduced TlsConfiguration interface
- Defaulted verifyHostname to true
- Repurposed Http.verifyHostname as a toggle for backward compatibility
@github-project-automation github-project-automation Bot added this to Log4j bug tracker Aug 28, 2025
@github-project-automation github-project-automation Bot moved this to To triage in Log4j bug tracker Aug 28, 2025
vy
vy requested changes Sep 6, 2025
View reviewed changes

@vy vy left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

@jhl221123, thanks so much for the PR! 🙇 I've a question: In @ppkarwasz's original proposal, there is also the following item:

Currently if the user configures an SSL element, all the log4j2.ssl* configuration properties are ignored. I think those properties should still be used to provide default values for SSL.

@jhl221123, do you plan to update this PR to reflect this too?

@ppkarwasz, I'm not able to see the value of a new TlsConfiguration interface here. The fact that it contains a getSslContext method (note the Ssl in the name!) makes it even more clumsy. I know that SSL keyword is superseded by TLS, but from an API point of view in the Java ecosystem, is it really? What will be the benefit of introducing TlsFoo as long as we will have SslFoo and SslBar around for functionality, backward compatibility, etc. reasons?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread log4j-core/src/main/java/org/apache/logging/log4j/core/appender/HttpAppender.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread log4j-core/src/main/java/org/apache/logging/log4j/core/appender/HttpAppender.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

@jhl221123

jhl221123 commented Sep 8, 2025

Copy link
Copy Markdown
Contributor Author

@vy Thanks for the feedback!

@jhl221123, do you plan to update this PR to reflect this too?

Absolutely! But I noticed in #2792 you mentioned that it might be better to handle this in a separate PR. Which approach would you prefer: should I continue updating this PR, or would it be better to open a separate one for it?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jhl221123
Apply feedback from review
3000e89
- Update HttpAppender deprecation warning message
- Make isVerifyHostname() simple
@ppkarwasz

ppkarwasz commented Sep 11, 2025

Copy link
Copy Markdown
Member

I'm not able to see the value of a new TlsConfiguration interface here. The fact that it contains a getSslContext method (note the Ssl in the name!) makes it even more clumsy. I know that SSL keyword is superseded by TLS, but from an API point of view in the Java ecosystem, is it really? What will be the benefit of introducing TlsFoo as long as we will have SslFoo and SslBar around for functionality, backward compatibility, etc. reasons?

I don't see the point in calling it TlsConfiguration instead of SslConfiguration either, except the fact that the SslConfiguration name is already used.

Where I do see value, though, is in introducing an interface rather than tying everything to the concrete SslConfiguration class. That opens the door for third-party Log4j Core plugins to provide their own TLS material without having to subclass Log4j internals.

Most popular Java HTTP clients (HttpsURLConnection, Java 11+ HttpClient, OkHttp, Apache HttpClient) can all be configured with essentially three knobs:

public interface TlsConfiguration {
    SSLContext getSslContext();
    HostnameVerifier getHostnameVerifier();
    /** Optional **/
    SSLParameters getSslParameters();
}

Jakarta Mail is the only outlier that still needs an isVerifyHostName() flag.

With such an abstraction, you could, for example, plug in Spring Boot’s SslBundle to supply the key/trust material. That would make it straightforward to integrate Log4j into environments where TLS credentials are managed externally (e.g. centralized config via Spring Cloud).

Each host would only need to declare which SslBundle to use, and Log4j could obtain everything else through the interface.

@rgoers: does this kind of abstraction line up with what you’d find useful in practice?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions

github-actions Bot commented Sep 11, 2025

Copy link
Copy Markdown
Contributor
Job Requested goals Build Tool Version Build Outcome Build Scan®
build-macos-latest clean install 3.9.8 ❌ Build Scan PUBLISHED
build-ubuntu-latest clean install 3.9.8 ❌ Build Scan PUBLISHED
build-windows-latest clean install 3.9.8 ❌ Build Scan PUBLISHED
Generated by gradle/develocity-actions
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vy

vy commented Sep 18, 2025

Copy link
Copy Markdown
Member

@ppkarwasz, thanks for clarifying the use case in mind. That certainly helps with setting the feature's intended context.

Where I do see value, though, is in introducing an interface rather than tying everything to the concrete SslConfiguration class.

I understand and share your preference for an interface, yet given the current state of the code, wouldn't it be less intrusive to provide a similar adapter pattern support by adding a sufficient SslConfiguration.create(SSLContext, HostnameVerifier, SSLParameters) factory method?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jhl221123 jhl221123 mentioned this pull request Dec 28, 2025
📢오픈소스 기여모임 - 운영진 소개 opensource-contributors-group/opensource-contributors#2
Open
This was referenced Sep 18, 2026
Fail closed when a KeyStore or TrustStore element of Ssl cannot be loaded #4332
Open
Uniformize TLS configuration #2792
Open
@ppkarwasz

ppkarwasz commented Sep 25, 2026

Copy link
Copy Markdown
Member

A related detail in the SMTP appender (log4j-core and log4j-jakarta-smtp):
when an <Ssl> element is present, SmtpManager always sets

properties.setProperty(prefix + ".ssl.checkserveridentity", Boolean.toString(sslConfiguration.isVerifyHostName()));

so a verifyHostName left at its default also overrides the default of the mail implementation,
instead of only applying when the user sets it.
With the default changed to true this becomes harmless,
but writing the property only when verifyHostName is set explicitly would avoid overriding the library default either way.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ramanathan1504 ramanathan1504 added deprecation Deprecates public API configuration Affects the configuration system in a general way enhancement Additions or updates to features java Pull requests that update Java code port-to-main labels Nov 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@vy vy vy requested changes

Requested changes must be addressed to merge this pull request.

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

configuration Affects the configuration system in a general way deprecation Deprecates public API enhancement Additions or updates to features java Pull requests that update Java code port-to-main

Projects

Log4j bug tracker
Status: To triage

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@jhl221123 @ppkarwasz @vy @ramanathan1504
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.