Skip to content

fix: skip TLS hostname verification when rejectUnauthorized=false - #86

Merged
SanjulaGanepola merged 8 commits into
Mapepire-IBMi:mainfrom
wyattmog:fix/reject-unauthorized-skip-hostname-verification
Jul 17, 2026
Merged

fix: skip TLS hostname verification when rejectUnauthorized=false#86
SanjulaGanepola merged 8 commits into
Mapepire-IBMi:mainfrom
wyattmog:fix/reject-unauthorized-skip-hostname-verification

Conversation

@wyattmog

@wyattmog wyattmog commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Related to ibmi-mcp-server-lite#17

rejectUnauthorized=false now skips TLS hostname verification in addition to certificate chain validation. motivated by TLS hostname verification in ibmi-mcp-server-lite: users setting ignore-unauthorized: true expect full TLS relaxation during development/self-signed cert scenarios, but connections still failed with No subject alternative names matching ... when the connect host did not match the Mapepire certificate SAN (DNS alias, loopback name, or IP).

Changes

  • Updated: SqlJob - override onSetSSLParameters on the WebSocketClient in getChannel(); when rejectUnauthorized=false, clear endpointIdentificationAlgorithm; when true (default), call super.onSetSSLParameters() so HTTPS hostname verification stays enabled
  • Updated: ConnectTest - rejectUnauthorizedFalseConnectsWhenCertificateDoesNotMatchHost (connect via resolved IP with rejectUnauthorized=false; expects success)
  • Updated: ConnectTest - rejectUnauthorizedTrueFailsWhenCertificateDoesNotMatchHost (same SAN mismatch with rejectUnauthorized=true + pinned CA; expects hostname verification failure)

Testing

# Reproduction / fix verification (requires config.properties + reachable IBM i)
mvn test '-Dtest=ConnectTest#rejectUnauthorizedFalseConnectsWhenCertificateDoesNotMatchHost'
mvn test '-Dtest=ConnectTest#rejectUnauthorizedTrueFailsWhenCertificateDoesNotMatchHost'

rejectUnauthorized=false already skipped certificate chain validation but Java-WebSocket still enabled HTTPS endpoint identification, causing SAN mismatches to fail. overrides onSetSSLParameters to clear endpoint identification when rejectUnauthorized is false

Signed-off-by: Wyatt Mogelson <wyattmog@icloud.com>

@rousseauc1 rousseauc1 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Looks good.

@SanjulaGanepola

Copy link
Copy Markdown
Member

@wyattmog Thanks for the change, I can review and merge this tomorrow

SanjulaGanepola and others added 2 commits July 17, 2026 11:41
Signed-off-by: Sanjula Ganepola <Sanjula.Ganepola@ibm.com>

@SanjulaGanepola SanjulaGanepola left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@wyattmog Changes look good. Thanks

Signed-off-by: Sanjula Ganepola <Sanjula.Ganepola@ibm.com>
Signed-off-by: Sanjula Ganepola <Sanjula.Ganepola@ibm.com>
Signed-off-by: Sanjula Ganepola <Sanjula.Ganepola@ibm.com>
Signed-off-by: Sanjula Ganepola <Sanjula.Ganepola@ibm.com>
@SanjulaGanepola
SanjulaGanepola merged commit 0656bf9 into Mapepire-IBMi:main Jul 17, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants