Skip to content

fix: serve real TLS in XMPP chat proxy#5

Open
rooteksec wants to merge 1 commit into
KebsCS:mainfrom
rooteksec:fix/xmpp-tls-required
Open

fix: serve real TLS in XMPP chat proxy#5
rooteksec wants to merge 1 commit into
KebsCS:mainfrom
rooteksec:fix/xmpp-tls-required

Conversation

@rooteksec
Copy link
Copy Markdown

The recent Riot client patch ignores chat.use_tls.enabled=false and chat.allow_bad_cert.enabled=true in clientconfig, so the chat proxy now needs to serve TLS with a publicly valid certificate for the host that replaces chat.host. Same approach as Deceive and RadiantConnect.

Changes:

  • New ChatCert.py loads a PFX from a configurable URL, caches it locally, builds an SSLContext with the full intermediate chain (skipping intermediates causes the client to RST the handshake with WinError 64 on Windows).

  • ConfigProxy rewrites chat.host and chat.affinities to the proxy host and passes ssl_context to ChatProxy.start_client_proxy.

  • ChatProxy.start_client_proxy accepts an optional ssl_context.

  • Defaults work zero-config (cert hosted on Cloudflare R2, renewed monthly via Actions). Overridable via LCD_PFX_URL / LCD_CHAT_PROXY_HOST env vars or chat_cert_config.json next to ChatCert.py.

Closes #4

The recent Riot client patch ignores chat.use_tls.enabled=false and chat.allow_bad_cert.enabled=true in clientconfig, so the chat proxy now needs to serve TLS with a publicly valid certificate for the host that replaces chat.host. Same approach as Deceive and RadiantConnect.

Changes:

- New ChatCert.py loads a PFX from a configurable URL, caches it locally, builds an SSLContext with the full intermediate chain (skipping intermediates causes the client to RST the handshake with WinError 64 on Windows).

- ConfigProxy rewrites chat.host and chat.affinities to the proxy host and passes ssl_context to ChatProxy.start_client_proxy.

- ChatProxy.start_client_proxy accepts an optional ssl_context.

- Defaults work zero-config (cert hosted on Cloudflare R2, renewed monthly via Actions). Overridable via LCD_PFX_URL / LCD_CHAT_PROXY_HOST env vars or chat_cert_config.json next to ChatCert.py.

Closes KebsCS#4
@KebsCS
Copy link
Copy Markdown
Owner

KebsCS commented May 14, 2026

Thank you for the PR, I have a few questions

Comment thread CHAT_PROXY_SETUP.md
5. **Create**.
6. Copy the **Access Key ID**, **Secret Access Key**, and the **Account ID** (visible in the S3 API URL, e.g. `https://<account-id>.r2.cloudflarestorage.com`). Only shown once.

## Step 6 — Create the renewal workflow in GitHub
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Is it possible to have a cert that doesn't need renewal? Or has a very long time expiry date?

Comment on lines +16 to +17
DEFAULT_PFX_URL = "https://pfx.lolcert.online/localhost.pfx"
DEFAULT_CHAT_PROXY_HOST = "localhost.lolcert.online"
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Is it possible to use a public, well-known domain instead? I’m thinking it would be too easy for the client to block a private one. It would also be a headache for me to maintain or update it if it’s not my own or something widely used.

I found this: https://gist.github.com/tinogomes/c425aa2a56d289f16a1f4fcb8a65ea65
Or a /etc/hosts file like the gist suggests?

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

{
"pfx_url": "https://your-host.example.com/localhost.pfx",
"chat_proxy_host": "localhost.your-domain.example.com"
}
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

If we go with this method, I'd rather not make it configurable. Most of the code relies on undocumented APIs and should work out of the box. In my opinion, changing the domain directly in a Python file is simple enough

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Not sure if this is a GitHub issue, but this file doesn't load for me now

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.

Chat xmpp proxy is not working

2 participants