Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ prost = "0.14"
validator = { version = "0.20.0", features = ["derive"] }
prost-types = "0.14"
rand = "0.8.5"
rdkafka = { version = "0.37.0", features = ["cmake-build", "ssl"] }
rdkafka = { version = "0.37.0", features = ["cmake-build", "ssl", "curl"] }
sentry_arroyo = { version = "=2.45.0", features = ["ssl"] }
rmp-serde = "1.3"
sentry = { version = "0.41.0", default-features = false, features = [
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
FROM ghcr.io/getsentry/image-mirror-library-rust:1.96.1-trixie AS build

RUN apt-get update && apt-get upgrade -y
RUN apt-get install -y cmake pkg-config libssl-dev librdkafka-dev protobuf-compiler
RUN apt-get install -y cmake pkg-config libssl-dev libcurl4-openssl-dev librdkafka-dev protobuf-compiler

RUN USER=root cargo new --bin taskbroker
WORKDIR /taskbroker
Expand Down Expand Up @@ -40,7 +40,7 @@ FROM debian:trixie-slim
RUN groupadd taskbroker --gid 1000 && useradd --gid taskbroker --uid 1000 taskbroker

# Necessary for libssl bindings
RUN apt-get update && apt-get upgrade -y && apt-get install -y libssl-dev libsqlite3-dev libsqlite3-0 openssl ca-certificates
RUN apt-get update && apt-get upgrade -y && apt-get install -y libssl-dev libsqlite3-dev libsqlite3-0 openssl ca-certificates libcurl4

EXPOSE 50051

Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,13 @@ kafka_clusters:
# sasl_mechanism: scram-sha-256
# sasl_username: ...
# sasl_password: ...
# or OAUTHBEARER with tokens from an OIDC endpoint, eg. Google Managed
# Kafka's local auth server:
# sasl_mechanism: OAUTHBEARER
# sasl_oauthbearer_method: oidc
# sasl_oauthbearer_token_endpoint_url: http://localhost:14293
# sasl_oauthbearer_client_id: ...
# sasl_oauthbearer_client_secret: ...

kafka_topics:
taskworker:
Expand Down
24 changes: 24 additions & 0 deletions src/config/kafka.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,14 @@ pub struct ClusterConfig {
pub ssl_certificate_location: Option<String>,
/// The location to the private key file
pub ssl_key_location: Option<String>,
/// How librdkafka gets OAUTHBEARER tokens, eg. oidc
pub sasl_oauthbearer_method: Option<String>,
/// The OIDC token endpoint, eg. a local auth server
pub sasl_oauthbearer_token_endpoint_url: Option<String>,
/// The OIDC client id
pub sasl_oauthbearer_client_id: Option<String>,
/// The OIDC client secret
pub sasl_oauthbearer_client_secret: Option<String>,
}

impl ClusterConfig {
Expand All @@ -76,6 +84,10 @@ impl ClusterConfig {
|| self.ssl_ca_location.is_some()
|| self.ssl_certificate_location.is_some()
|| self.ssl_key_location.is_some()
|| self.sasl_oauthbearer_method.is_some()
|| self.sasl_oauthbearer_token_endpoint_url.is_some()
|| self.sasl_oauthbearer_client_id.is_some()
|| self.sasl_oauthbearer_client_secret.is_some()
}

/// Apply this cluster's `bootstrap.servers` and any configured sasl/ssl
Expand Down Expand Up @@ -105,5 +117,17 @@ impl ClusterConfig {
if let Some(ref ssl_private_key_location) = self.ssl_key_location {
config.set("ssl.key.location", ssl_private_key_location);
}
if let Some(ref method) = self.sasl_oauthbearer_method {
config.set("sasl.oauthbearer.method", method);
}
if let Some(ref url) = self.sasl_oauthbearer_token_endpoint_url {
config.set("sasl.oauthbearer.token.endpoint.url", url);
}
if let Some(ref client_id) = self.sasl_oauthbearer_client_id {
config.set("sasl.oauthbearer.client.id", client_id);
}
if let Some(ref client_secret) = self.sasl_oauthbearer_client_secret {
config.set("sasl.oauthbearer.client.secret", client_secret);
}
}
}
13 changes: 13 additions & 0 deletions src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,7 @@ impl Config {

for cluster in config.kafka_clusters.values_mut() {
redact_optional(&mut cluster.sasl_password);
redact_optional(&mut cluster.sasl_oauthbearer_client_secret);
}

// Redact strings
Expand Down Expand Up @@ -594,6 +595,10 @@ impl Config {
.kafka_ssl_certificate_location
.clone(),
ssl_key_location: self.deprecated.kafka_ssl_key_location.clone(),
sasl_oauthbearer_method: None,
sasl_oauthbearer_token_endpoint_url: None,
sasl_oauthbearer_client_id: None,
sasl_oauthbearer_client_secret: None,
},
);
assert!(
Expand Down Expand Up @@ -623,6 +628,10 @@ impl Config {
.kafka_deadletter_ssl_certificate_location
.clone(),
ssl_key_location: self.deprecated.kafka_deadletter_ssl_key_location.clone(),
sasl_oauthbearer_method: None,
sasl_oauthbearer_token_endpoint_url: None,
sasl_oauthbearer_client_id: None,
sasl_oauthbearer_client_secret: None,
},
);
assert!(
Expand Down Expand Up @@ -1723,6 +1732,10 @@ kafka_clusters:
ssl_ca_location: None,
ssl_certificate_location: None,
ssl_key_location: None,
sasl_oauthbearer_method: None,
sasl_oauthbearer_token_endpoint_url: None,
sasl_oauthbearer_client_id: None,
sasl_oauthbearer_client_secret: None,
})
);
assert!(!clusters.contains_key("default"));
Expand Down
Loading