Skip to content

#2098 URLFrontier: optional TLS for the channels to the frontier - #2175

Open
rzo1 wants to merge 2 commits into
apache:mainfrom
rzo1:fix-2098-urlfrontier-tls
Open

rzo1 wants to merge 2 commits into
apache:mainfrom
rzo1:fix-2098-urlfrontier-tls

Conversation

@rzo1

@rzo1 rzo1 commented Sep 19, 2026

Copy link
Copy Markdown
Contributor

Fixes #2098.

The gRPC channels built in ManagedChannelUtil (used by the Spout, StatusUpdaterBolt and QueueRegulatorBolt) can now use TLS. Plaintext stays the default.

  • urlfrontier.tls.enabled: TLS on or off, default false
  • urlfrontier.tls.trust.cert.collection: PEM file of trusted certificates; the JVM trust store is used if not set
  • urlfrontier.tls.client.cert.chain, urlfrontier.tls.client.private.key and the optional urlfrontier.tls.client.private.key.password: client certificate for mutual TLS

A half-configured client certificate or an unreadable file fails the component at startup. No new dependencies. The tests cover TLS and mutual TLS round trips against a local gRPC server using certificates generated during the test.

ManagedChannelUtil built every gRPC channel with usePlaintext() and the
module had no setting for transport security, so the URLs and their
metadata, which can include cookies, always crossed the network in the
clear, and a frontier which requires TLS could not be reached at all.
Spout, StatusUpdaterBolt and QueueRegulatorBolt all create their channel
there.

The channel is now built with Grpc.newChannelBuilder and credentials read
from the topology configuration. urlfrontier.tls.enabled switches to TLS
channel credentials. The server certificate is checked against the PEM
file in urlfrontier.tls.trust.cert.collection, or against the JVM trust
store if that key is not set. urlfrontier.tls.client.cert.chain and
urlfrontier.tls.client.private.key (with an optional
urlfrontier.tls.client.private.key.password) add a client certificate for
mutual TLS. Setting only one of the two, or naming a file which cannot be
read, fails the component at startup with a message naming the key or
the file.

Plaintext stays the default so that existing deployments keep working;
the INFO line logged when a plaintext channel is created names the key
that enables TLS. The three
components pass their configuration to createChannel. No new dependency
is needed: the TLS credentials come from grpc-api and the transport from
the grpc-netty-shaded jar the module already has.

The new test covers the credentials built for each configuration and
runs TLS and mutual TLS round trips against a local gRPC server with
certificates generated at test time, as well as the failing cases of an
untrusted server certificate, a plaintext client and a missing client
certificate.
@rzo1 rzo1 added this to the 4.0.0 milestone Sep 19, 2026
@rzo1 rzo1 self-assigned this Sep 19, 2026
@rzo1
rzo1 requested review from dpol1 and jnioche September 19, 2026 17:40
@jnioche

jnioche commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

@rzo1 is it even possible to run URLFrontier with TLS at the moment? if so, do you have any instructions on how to do so?

@rzo1

rzo1 commented Sep 22, 2026

Copy link
Copy Markdown
Contributor Author

No, the frontier server doesn't do TLS at the moment. It only listens in plaintext, so today you'd need a TLS terminating proxy in front of it. I've opened crawler-commons/url-frontier#219 to add TLS to the server, the channels between nodes and the CLI client. Once that's released, the settings in this PR connect to it directly, without a proxy.

@dpol1 dpol1 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.

LGTM. Two notes on the README, the first follows from the question above.

## Transport security

The gRPC channels to the frontier are plaintext unless TLS is enabled. Plaintext is kept as the
default so that existing deployments keep working. The channel carries the URLs and their metadata, so enable TLS whenever the

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.

can you add what you said above? URLFrontier 2.6 needs a TLS proxy in front of it, until crawler-commons/url-frontier#219 is released

Comment thread external/urlfrontier/README.md Outdated
The server certificate must be valid for the host name in `urlfrontier.address` or
`urlfrontier.host`. Setting only one of `urlfrontier.tls.client.cert.chain` and
`urlfrontier.tls.client.private.key`, or pointing a key at a file which cannot be read, fails
the component at startup. The settings apply to `Spout`, `StatusUpdaterBolt` and

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.

a failed handshake doesn't fail the startup: Spout and StatusUpdaterBolt use withWaitForReady() without a deadline and just wait. worth a line here

This branch has not been deployed

No deployments
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.

URLFrontier channels are always plaintext and the module has no TLS option

3 participants