Skip to content

Commit 3533c94

Browse files
authored
Adding YAML examples to administration transport security docs. Fixes #1759. (#1760)
Signed-off-by: Eric D. Schabell <[email protected]>
1 parent 6c6d6e0 commit 3533c94

File tree

1 file changed

+118
-4
lines changed

1 file changed

+118
-4
lines changed

administration/transport-security.md

Lines changed: 118 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,12 +98,40 @@ TLS:
9898
-m '*'
9999
```
100100

101+
{% hint style="info" %}
102+
See Tips & Trick section below for details on generating `self_signed.crt` and `self_signed.key` files shown in these
103+
examples.
104+
{% endhint %}
105+
101106
In the previous command, the two properties `tls` and `tls.verify` are set
102107
for demonstration purposes. Always enable verification in production environments.
103108

104109
The same behavior can be accomplished using a configuration file:
105110

106-
```python
111+
{% tabs %}
112+
113+
{% tab title="fluent-bit.yaml" %}
114+
115+
```yaml
116+
pipeline:
117+
inputs:
118+
- name: http
119+
port: 9999
120+
tls: on
121+
tls.verify: off
122+
tls.cert_file: self_signed.crt
123+
tls.key_file: self_signed.key
124+
125+
outputs:
126+
- name: stdout
127+
match: '*'
128+
```
129+
130+
{% endtab %}
131+
132+
{% tab title="fluent-bit.conf" %}
133+
134+
```text
107135
[INPUT]
108136
name http
109137
port 9999
@@ -117,6 +145,9 @@ The same behavior can be accomplished using a configuration file:
117145
Match *
118146
```
119147

148+
{% endtab %}
149+
{% endtabs %}
150+
120151
## Example: enable TLS on HTTP output
121152

122153
By default, the HTTP output plugin uses plain TCP. Run the following command to enable
@@ -134,7 +165,31 @@ for demonstration purposes. Always enable verification in production environment
134165

135166
The same behavior can be accomplished using a configuration file:
136167

137-
```python
168+
{% tabs %}
169+
170+
{% tab title="fluent-bit.yaml" %}
171+
172+
```yaml
173+
pipeline:
174+
inputs:
175+
- name: cpu
176+
tag: cpu
177+
178+
outputs:
179+
- name: http
180+
match: '*'
181+
host: 192.168.2.3
182+
port: 80
183+
uri: /something
184+
tls: on
185+
tls.verify: off
186+
```
187+
188+
{% endtab %}
189+
190+
{% tab title="fluent-bit.conf" %}
191+
192+
```text
138193
[INPUT]
139194
Name cpu
140195
Tag cpu
@@ -149,6 +204,9 @@ The same behavior can be accomplished using a configuration file:
149204
tls.verify Off
150205
```
151206

207+
{% endtab %}
208+
{% endtabs %}
209+
152210
## Tips and Tricks
153211

154212
### Generate a self signed certificates for testing purposes
@@ -175,7 +233,32 @@ Fluent Bit supports
175233
If you are serving multiple host names on a single IP address (for example, using
176234
virtual hosting), you can make use of `tls.vhost` to connect to a specific hostname.
177235

178-
```python
236+
{% tabs %}
237+
238+
{% tab title="fluent-bit.yaml" %}
239+
240+
```yaml
241+
pipeline:
242+
inputs:
243+
- name: cpu
244+
tag: cpu
245+
246+
outputs:
247+
- name: forward
248+
match: '*'
249+
host: 192.168.10.100
250+
port: 24224
251+
tls: on
252+
tls.verify: off
253+
tls.ca_file: '/etc/certs/fluent.crt'
254+
tls.vhost: 'fluent.example.com'
255+
```
256+
257+
{% endtab %}
258+
259+
{% tab title="fluent-bit.conf" %}
260+
261+
```text
179262
[INPUT]
180263
Name cpu
181264
Tag cpu
@@ -191,6 +274,9 @@ virtual hosting), you can make use of `tls.vhost` to connect to a specific hostn
191274
tls.vhost fluent.example.com
192275
```
193276

277+
{% endtab %}
278+
{% endtabs %}
279+
194280
### Verify `subjectAltName`
195281

196282
By default, TLS verification of host names isn't done automatically.
@@ -207,6 +293,31 @@ hostname it should fail.
207293
To fully verify the alternative name and demonstrate the failure, enable
208294
`tls.verify_hostname`:
209295

296+
{% tabs %}
297+
298+
{% tab title="fluent-bit.yaml" %}
299+
300+
```yaml
301+
pipeline:
302+
inputs:
303+
- name: cpu
304+
tag: cpu
305+
306+
outputs:
307+
- name: forward
308+
match: '*'
309+
host: other.fluent-aggregator.net
310+
port: 24224
311+
tls: on
312+
tls.verify: on
313+
tls.verify_hostname: on
314+
tls.ca_file: '/path/to/fluent-x509v3-alt-name.crt'
315+
```
316+
317+
{% endtab %}
318+
319+
{% tab title="fluent-bit.conf" %}
320+
210321
```python
211322
[INPUT]
212323
Name cpu
@@ -223,10 +334,13 @@ To fully verify the alternative name and demonstrate the failure, enable
223334
tls.ca_file /path/to/fluent-x509v3-alt-name.crt
224335
```
225336

337+
{% endtab %}
338+
{% endtabs %}
339+
226340
This outgoing connect will fail and disconnect:
227341

228342
```text
229343
[2024/06/17 16:51:31] [error] [tls] error: unexpected EOF with reason: certificate verify failed
230344
[2024/06/17 16:51:31] [debug] [upstream] connection #50 failed to other.fluent-aggregator.net:24224
231345
[2024/06/17 16:51:31] [error] [output:forward:forward.0] no upstream connections available
232-
```
346+
```

0 commit comments

Comments
 (0)