Skip to content

Commit

Permalink
Generalize gRPC authentication chunk
Browse files Browse the repository at this point in the history
So it can be used both for opentelemetry and loki drivers
  • Loading branch information
eldarnash committed Sep 26, 2023
1 parent fe14ad8 commit 8129921
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 11 deletions.
2 changes: 1 addition & 1 deletion content/chapter-destinations/destination-loki/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ The `loki()` destination has the following options.
{ "target_service_accounts", KW_TARGET_SERVICE_ACCOUNTS },
-->

{{< include-headless "chunk/opentelemetry-authentication.md" >}}
{{< include-headless "chunk/grpc-authentication.md" >}}
<!-- FIXME generalize the authentication chunk, now it refers only to opentelemetry -->

## keep-alive()
Expand Down
2 changes: 1 addition & 1 deletion content/chapter-destinations/opentelemetry/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ log non_otel_to_otel_tls {
};
```

{{< include-headless "chunk/opentelemetry-authentication.md" >}}
{{< include-headless "chunk/grpc-authentication.md" >}}

{{< include-headless "chunk/option-destination-threaded-batching.md" >}}

Expand Down
2 changes: 1 addition & 1 deletion content/chapter-sources/opentelemetry/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ log otel_forward_mode_alts {
};
```

{{< include-headless "chunk/opentelemetry-authentication.md" >}}
{{< include-headless "chunk/grpc-authentication.md" >}}

## `port()` {#port}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
---
---
<!-- This file is under the copyright of Axoflow, and licensed under Apache License 2.0, except for using the Axoflow and AxoSyslog trademarks. -->
## `auth()` {#auth}

You can set authentication in the `auth()` option of the `opentelemetry()` driver. By default, authentication is disabled (`auth(insecure())`).
<!-- Used in the opentelemetry() and loki() drivers -->
## auth() {#auth}

You can set authentication in the `auth()` option of the driver. By default, authentication is disabled (`auth(insecure())`).

The following authentication methods are available in the `auth()` block:

### `adc()` {#adc}
### adc() {#adc}

[Application Default Credentials (ADC)](https://cloud.google.com/docs/authentication/application-default-credentials). This authentication method is only available for destinations.

### `alts()` {#alts}
### alts() {#alts}

[Application Layer Transport Security (ALTS)](https://grpc.io/docs/languages/cpp/alts/) is a simple to use authentication, only available within Google's infrastructure. It accepts the `target-service-account()` option, where you can list service accounts to match against when authenticating the server.

{{< tabpane text=true right=true >}}
{{% tab header="Driver:" disabled=true /%}}
{{% tab header="`opentelemetry()`" lang="opentelemetry" %}}
```shell
source {
opentelemetry(
Expand All @@ -23,18 +28,33 @@ source {
);
};
```
{{% /tab %}}
{{% tab header="`loki()`" lang="loki" %}}
```shell
destination {
loki(
port(12345)
auth(alts())
);
};
```
{{% /tab %}}
{{< /tabpane >}}

### `insecure()` {#insecure}
### insecure() {#insecure}

This is the default method, authentication is disabled (`auth(insecure())`).

### `tls()` {#tls}
### tls() {#tls}

<!-- FIXME xinclude these from the other tls blocks -->

`tls()` accepts the `key-file()`, `cert-file()`, `ca-file()` and `peer-verify()` (possible values:
`required-trusted`, `required-untrusted`, `optional-trusted` and `optional-untrusted`) options.

{{< tabpane text=true right=true >}}
{{% tab header="Driver:" disabled=true /%}}
{{% tab header="`opentelemetry()`" lang="opentelemetry" %}}
```shell
destination {
opentelemetry(
Expand All @@ -49,8 +69,26 @@ destination {
);
};
```
{{% /tab %}}
{{% tab header="`loki()`" lang="loki" %}}
```shell
destination {
loki(
url("your-loki-server:12346")
auth(
tls(
ca-file("/path/to/ca.pem")
key-file("/path/to/key.pem")
cert-file("/path/to/cert.pem")
)
)
);
};
```
{{% /tab %}}
{{< /tabpane >}}

> Note:
>
> - `tls(peer-verify())` is not available for the `opentelemetry()` destination.
> - The `opentelemetry()` drivers have a different `tls()` block implementation from the `network()` or `http()` drivers. Most features are the same.
> - `tls(peer-verify())` is not available for the `opentelemetry()` and `loki()` destination.
> - The gRPC-based drivers (`opentelemetry()` and `loki()`) have a different `tls()` block implementation from the `network()` or `http()` drivers. Most features are the same.

0 comments on commit 8129921

Please sign in to comment.