98
98
-m ' *'
99
99
```
100
100
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
+
101
106
In the previous command, the two properties ` tls ` and ` tls.verify ` are set
102
107
for demonstration purposes. Always enable verification in production environments.
103
108
104
109
The same behavior can be accomplished using a configuration file:
105
110
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
107
135
[INPUT]
108
136
name http
109
137
port 9999
@@ -117,6 +145,9 @@ The same behavior can be accomplished using a configuration file:
117
145
Match *
118
146
```
119
147
148
+ {% endtab %}
149
+ {% endtabs %}
150
+
120
151
## Example: enable TLS on HTTP output
121
152
122
153
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
134
165
135
166
The same behavior can be accomplished using a configuration file:
136
167
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
138
193
[INPUT]
139
194
Name cpu
140
195
Tag cpu
@@ -149,6 +204,9 @@ The same behavior can be accomplished using a configuration file:
149
204
tls.verify Off
150
205
```
151
206
207
+ {% endtab %}
208
+ {% endtabs %}
209
+
152
210
## Tips and Tricks
153
211
154
212
### Generate a self signed certificates for testing purposes
@@ -175,7 +233,32 @@ Fluent Bit supports
175
233
If you are serving multiple host names on a single IP address (for example, using
176
234
virtual hosting), you can make use of ` tls.vhost ` to connect to a specific hostname.
177
235
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
179
262
[INPUT]
180
263
Name cpu
181
264
Tag cpu
@@ -191,6 +274,9 @@ virtual hosting), you can make use of `tls.vhost` to connect to a specific hostn
191
274
tls.vhost fluent.example.com
192
275
```
193
276
277
+ {% endtab %}
278
+ {% endtabs %}
279
+
194
280
### Verify ` subjectAltName `
195
281
196
282
By default, TLS verification of host names isn't done automatically.
@@ -207,6 +293,31 @@ hostname it should fail.
207
293
To fully verify the alternative name and demonstrate the failure, enable
208
294
` tls.verify_hostname ` :
209
295
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
+
210
321
` ` ` python
211
322
[INPUT]
212
323
Name cpu
@@ -223,10 +334,13 @@ To fully verify the alternative name and demonstrate the failure, enable
223
334
tls.ca_file /path/to/fluent-x509v3-alt-name.crt
224
335
```
225
336
337
+ {% endtab %}
338
+ {% endtabs %}
339
+
226
340
This outgoing connect will fail and disconnect:
227
341
228
342
``` text
229
343
[2024/06/17 16:51:31] [error] [tls] error: unexpected EOF with reason: certificate verify failed
230
344
[2024/06/17 16:51:31] [debug] [upstream] connection #50 failed to other.fluent-aggregator.net:24224
231
345
[2024/06/17 16:51:31] [error] [output:forward:forward.0] no upstream connections available
232
- ```
346
+ ```
0 commit comments