Skip to content

Commit 25f3d7d

Browse files
committed
feat: Kafka Public CA for SASL
[FLEET-6161]
1 parent 5b3a584 commit 25f3d7d

File tree

3 files changed

+146
-7
lines changed

3 files changed

+146
-7
lines changed

docs/platform/concepts/tls-ssl-certificates.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,17 @@ are exceptions:
3838
the database, but does not verify the server certificate. For more
3939
information, see the [PostgreSQL
4040
documentation](https://www.postgresql.org/docs/current/ssl-tcp.html)
41-
- **Aiven for Apache Kafka®** requires the Aiven project CA
42-
certificate, and also the client key and certificate.
41+
- **Aiven for Apache Kafka®** supports different authentication methods:
42+
- Client certificate: The client requires the Aiven project CA and
43+
also the client key and certificate.
44+
- SASL over SSL: The client authenticates using a service user name
45+
and password. By default the communication is encrypted using the
46+
project CA certificate. The user configuration `letsencrypt_sasl`
47+
also allows to authenticate using a public CA instead of a project CA.
48+
For more information, see the [Kafka documentation](https://aiven.io/docs/products/kafka/howto/kafka-sasl-auth)
4349

4450
For these services you can
45-
[Download CA certificates](/docs/platform/concepts/tls-ssl-certificates#download-ca-certificates)
51+
[Download the project CA certificates](/docs/platform/concepts/tls-ssl-certificates#download-ca-certificates)
4652
from **Overview** page of your service.
4753

4854
:::note

docs/products/kafka/howto/kafka-sasl-auth.md

Lines changed: 113 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import ConsoleLabel from "@site/src/components/ConsoleIcons"
88
import ConsoleIcon from "@site/src/components/ConsoleIcons"
99
import RelatedPages from "@site/src/components/RelatedPages";
1010

11-
Aiven for Apache Kafka® provides [multiple authentication methods](/docs/products/kafka/concepts/auth-types) to secure your Apache Kafka® data, including the highly secure Simple Authentication and Security Layer ([SASL](https://en.wikipedia.org/wiki/Simple_Authentication_and_Security_Layer)).
11+
Aiven for Apache Kafka® provides [multiple authentication methods](/docs/products/kafka/concepts/auth-types) to secure your Apache Kafka® data, including the highly secure Simple Authentication and Security Layer ([SASL](https://en.wikipedia.org/wiki/Simple_Authentication_and_Security_Layer)) over SSL.
1212

1313
## Enable SASL authentication
1414

@@ -19,7 +19,7 @@ Aiven for Apache Kafka® provides [multiple authentication methods](/docs/produc
1919
Aiven for Apache Kafka service.
2020
1. Click <ConsoleLabel name="Service settings"/>.
2121
1. Scroll to **Advanced configuration** and click **Configure**.
22-
1. In the **Advanced configuration** window, set `kafka_authentication_methods.sasl` to
22+
In the **Advanced configuration** window, set `kafka_authentication_methods.sasl` to
2323
**Enabled**.
2424
1. Click **Save configurations**.
2525

@@ -180,6 +180,117 @@ Parameters:
180180

181181
:::
182182

183+
## Enable public CA for SASL authentication
184+
185+
After [enabling SASL authentication](#enable-sasl-authentication), enable
186+
the Public CA for SASL authentication if clients connecting to Kafka can't
187+
install or trust the default Project CA.
188+
189+
<Tabs groupId="config-methods">
190+
<TabItem value="console" label="Aiven Console" default>
191+
192+
1. Access the [Aiven Console](https://console.aiven.io) and select your
193+
Aiven for Apache Kafka service.
194+
1. Click <ConsoleLabel name="Service settings"/>.
195+
1. Scroll to **Cloud and network**, click **[...]** and select
196+
**More network configurations**.
197+
1. In the **Network configuration** window, click **Add configuration options**
198+
and select `letsencrypt_sasl` for enabling public CA for SASL authentication
199+
via regular routes or `letsencrypt_sasl_privatelink` via PrivateLink connection.
200+
1. Set the configuration value to **Enabled**.
201+
1. Click **Save configurations**.
202+
203+
The **Connection information** in the <ConsoleLabel name="overview"/> page now
204+
allows SASL connections using either **Project CA** or **Public CA**.
205+
206+
</TabItem>
207+
<TabItem value="cli" label="CLI">
208+
209+
Enable public CA for SASL authentication for your Aiven for Apache Kafka service using
210+
[Aiven CLI](/docs/tools/cli):
211+
212+
1. Get the name of the Aiven for Apache Kafka service:
213+
214+
```bash
215+
avn service list
216+
```
217+
218+
Note the `SERVICE_NAME` corresponding to your Aiven for Apache Kafka service.
219+
220+
1. Enable public CA for SASL authentication:
221+
222+
```bash
223+
avn service update SERVICE_NAME -c CONFIG_NAME=true
224+
```
225+
226+
Parameters:
227+
228+
- `SERVICE_NAME`: Name of your Aiven for Apache Kafka service.
229+
- `CONFIG_NAME`: Name of the configuration parameter to set. Use `letsencrypt_sasl`
230+
for enabling public CA for SASL authentication via regular routes or
231+
`letsencrypt_sasl_privatelink` via PrivateLink connection.
232+
233+
</TabItem>
234+
<TabItem value="api" label="API">
235+
236+
Use the [ServiceUpdate](https://api.aiven.io/doc/#tag/Service/operation/ServiceUpdate)
237+
API to enable public CA for SASL authentication on an existing service:
238+
239+
```bash
240+
curl -X PUT "https://console.aiven.io/v1/project/{project_name}/service/{service_name}" \
241+
-H "Authorization: Bearer <API_TOKEN>" \
242+
-H "Content-Type: application/json" \
243+
-d '{"user_config": {"letsencrypt_sasl": true}}' # or letsencrypt_sasl_privatelink for PrivateLink
244+
```
245+
</TabItem>
246+
<TabItem value="terraform" label="Terraform">
247+
248+
1. Create or update your [Aiven for Apache Kafka service resource](https://registry.terraform.io/providers/aiven/aiven/latest/docs/resources/kafka):
249+
250+
```hcl
251+
resource "aiven_kafka" "example_kafka" {
252+
plan = "business-4"
253+
project = data.aiven_project.example_project.project
254+
service_name = "example-kafka"
255+
256+
kafka_user_config {
257+
letsencrypt_sasl = true # or letsencrypt_sasl_privatelink for PrivateLink
258+
}
259+
}
260+
```
261+
262+
1. In order to figure out the right `port` to use for a specific route,
263+
access the [read-only `components`](https://registry.terraform.io/providers/aiven/aiven/latest/docs/data-sources/kafka#components-4)
264+
and specify appropriate filters to the [`aiven_service_component` data source](https://registry.terraform.io/providers/aiven/aiven/latest/docs/data-sources/service_component)
265+
for example:
266+
267+
```hcl
268+
data "aiven_service_component" "sc1" {
269+
project = aiven_kafka.example_project.project
270+
service_name = aiven_kafka.example_kafka.service_name
271+
component = "kafka"
272+
route = "dynamic"
273+
kafka_authentication_method = "sasl"
274+
kafka_ssl_ca = "letsencrypt"
275+
}
276+
```
277+
278+
</TabItem>
279+
</Tabs>
280+
281+
:::note
282+
283+
- The public certificate is issued and validated by [Let's Encrypt](https://letsencrypt.org)
284+
(a widely trusted Certification Authority) for the service domain.
285+
For more information, see [How It Works](https://letsencrypt.org/how-it-works)
286+
287+
- When enabling public CA for SASL authentication via PrivateLink connection, the
288+
network can take several minutes to configure until clients are able to connect.
289+
This is due to the dynamical allocation of a new port, and corresponding update of
290+
the Load Balancer route table.
291+
292+
:::
293+
183294
<RelatedPages/>
184295

185296
- [Enable OAUTH2/OIDC authentication for Aiven for Apache Kafka](/docs/products/kafka/howto/enable-oidc)

static/includes/config-kafka.md

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,11 +220,22 @@ import Link from '@docusaurus/Link'
220220
</table>
221221
</td>
222222
</tr>
223+
<tr>
224+
<td>
225+
<div className="param"><p className="name"><Link id="letsencrypt_sasl"/><Link to="#letsencrypt_sasl"><strong>letsencrypt_sasl</strong></Link></p><p><code className="type">boolean,null</code></p></div>
226+
<p className="title">Use Let's Encrypt CA for Kafka SASL</p>
227+
<div className="description"><p>Use a Let's Encrypt certificate authority (CA) for Kafka SASL authentication. (Default: False)</p></div>
228+
<table className="service-param-children">
229+
<tbody>
230+
</tbody>
231+
</table>
232+
</td>
233+
</tr>
223234
<tr>
224235
<td>
225236
<div className="param"><p className="name"><Link id="letsencrypt_sasl_privatelink"/><Link to="#letsencrypt_sasl_privatelink"><strong>letsencrypt_sasl_privatelink</strong></Link></p><p><code className="type">boolean,null</code></p></div>
226-
<p className="title">Use Letsencrypt CA for Kafka SASL via Privatelink</p>
227-
<div className="description"><p>Use Letsencrypt CA for Kafka SASL via Privatelink</p></div>
237+
<p className="title">Use Let's Encrypt CA for Kafka SASL via Privatelink</p>
238+
<div className="description"><p>Use a Let's Encrypt certificate authority (CA) for Kafka SASL authentication via Privatelink. (Default: False)</p></div>
228239
<table className="service-param-children">
229240
<tbody>
230241
</tbody>
@@ -827,6 +838,17 @@ import Link from '@docusaurus/Link'
827838
</table>
828839
</td>
829840
</tr>
841+
<tr>
842+
<td>
843+
<div className="param"><p className="name"><Link id="sasl_oauthbearer_allowed_urls"/><Link to="#sasl_oauthbearer_allowed_urls"><strong>sasl_oauthbearer_allowed_urls</strong></Link></p><p><code className="type">array</code></p></div>
844+
<p className="title">Allowed URLs for SASL OAUTHBEARER</p>
845+
<div className="description"><p>List of allowed URLs for SASL OAUTHBEARER authentication. Only HTTPS URLs are allowed for security reasons.</p></div>
846+
<table className="service-param-children">
847+
<tbody>
848+
</tbody>
849+
</table>
850+
</td>
851+
</tr>
830852
<tr>
831853
<td>
832854
<div className="param"><p className="name"><Link id="kafka_rest"/><Link to="#kafka_rest"><strong>kafka_rest</strong></Link></p><p><code className="type">boolean</code></p></div>

0 commit comments

Comments
 (0)