Add new dashboard/web server reference file (#11161)
* Init new reference * Fix broken links * Apply suggestions from code review Co-authored-by: Ilya Mashchenko <ilya@netdata.cloud> Co-authored-by: Tina Luedtke <kickoke@users.noreply.github.com> Co-authored-by: Ilya Mashchenko <ilya@netdata.cloud>
Joel Hans committed
Apr 20, 2022 at 15:55 UTC
5b251f0aa3d214e76124e8eca14942702361cd9a
3 files changed
+284
-6
docs/dashboard/customize.mdx
+3
-3
@@ -24,9 +24,9 @@ Here are a few popular settings:
24
25
### Change chart legend position
26
27
-Find this setting under the **Visual** tab. By default, Netdata places the [legend of
28
-dimensions](/docs/dashboard/dimensions-contexts-families.mdx#dimension) _below_ charts. Click this toggle to
29
-move the legend to the _right_ of charts.
27
+Find this setting under the **Visual** tab. By default, Netdata places the [legend of dimensions](/docs/dashboard/dimensions-contexts-families.mdx#dimension) _below_ charts.
28
+Click this toggle to move the legend to the _right_ of charts.
29
+
30
31
### Change theme
32
docs/dashboard/import-export-print-snapshot.mdx
+3
-3
@@ -11,9 +11,9 @@ Netdata can export snapshots of the contents of your dashboard at a given time,
11
node running Netdata. Or, you can create a print-ready version of your dashboard to save to PDF or actually print to
12
paper.
13
14
-Snapshots can be incredibly useful for diagnosing anomalies after they've already happened. Let's say Netdata triggered
15
-a warning alarm while you were asleep. In the morning, you can [pick the
16
-timeframe](/docs/dashboard/visualization-date-and-time-controls.mdx) when the alarm triggered, export a snapshot, and send it to a
14
+Snapshots can be incredibly useful for diagnosing anomalies after they've already happened. Let's say Netdata triggered a warning alarm while you were asleep. In the morning, you can [select the
15
+timeframe](/docs/dashboard/select-timeframes.mdx) when the alarm triggered, export a snapshot, and send it to a
16
+
17
colleague for further analysis.
18
19
Or, send the Netdata team a snapshot of your dashboard when [filing a bug
docs/dashboard/reference-web-server.mdx
new
+278
@@ -0,0 +1,278 @@
1
+---
2
+title: "Web server reference"
3
+description: "The Netdata Agent's local static-threaded web server serves dashboards and real-time visualizations with security and DDoS protection."
4
+type: reference
5
+custom_edit_url: https://github.com/netdata/netdata/edit/master/docs/dashboard/reference-web-server.mdx
6
+---
7
+
8
+# Web server reference
9
+
10
+The Netdata web server is `static-threaded`, with a fixed, configurable number of threads.
11
+
12
+All the threads are concurrently listening for web requests on the same sockets, and the kernel distributes the incoming
13
+requests to them. Each thread uses non-blocking I/O so it can serve any number of web requests in parallel.
14
+
15
+This web server respects the `keep-alive` HTTP header to serve multiple HTTP requests via the same connection.
16
+
17
+## Configuration
18
+
19
+From within your Netdata config directory (typically `/etc/netdata`), [use `edit-config`](/docs/configure/nodes.md) to
20
+open `netdata.conf`.
21
+
22
+```
23
+sudo ./edit-config netdata.conf
24
+```
25
+
26
+Scroll down to the `[web]` section to find the following settings.
27
+
28
+## Settings
29
+
30
+| Setting | Default | Description |
31
+| :----------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
32
+| `ssl key` | `/etc/netdata/ssl/key.pem` | Declare the location of an SSL key to [enable HTTPS](#enable-HTTPSTLS-support). |
33
+| `ssl certificate` | `/etc/netdata/ssl/cert.pem` | Declare the location of an SSL certificate to [enable HTTPS](#enable-HTTPSTLS-support). |
34
+| `tls version` | `1.3` | Choose which TLS version to use. While all versions are allowed (`1` or `1.0`, `1.1`, `1.2` and `1.3`), we recommend `1.3` for the most secure encryption. If left blank, Netdata uses the highest available protocol version on your system. |
35
+| `tls ciphers` | `none` | Choose which TLS cipher to use. Options include `TLS_AES_256_GCM_SHA384`, `TLS_CHACHA20_POLY1305_SHA256`, and `TLS_AES_128_GCM_SHA256`. If left blank, Netdata uses the default cipher list for that protocol provided by your TLS implementation. |
36
+| `ses max window` | `15` | See [single exponential smoothing](/web/api/queries/ses/README.md). |
37
+| `des max window` | `15` | See [double exponential smoothing](/web/api/queries/des/README.md). |
38
+| `mode` | `static-threaded` | Turns on (`static-threaded` or off (`none`) the static-threaded web server. See the [example](#disable-the-web-server) to turn off the web server and disable the dashboard. |
39
+| `listen backlog` | `4096` | The port backlog. Check `man 2 listen`. |
40
+| `default port` | `19999` | The listen port for the static web server. |
41
+| `web files owner` | `netdata` | The user that owns the web static files. Netdata will refuse to serve a file that is not owned by this user, even if it has read access to that file. If the user given is not found, Netdata will only serve files owned by user given in `run as user`. |
42
+| `web files group` | `netdata` | If this is set, Netdata will check if the file is owned by this group and refuse to serve the file if it's not. |
43
+| `disconnect idle clients after seconds` | `60` | The time in seconds to disconnect web clients after being totally idle. |
44
+| `timeout for first request` | `60` | How long to wait for a client to send a request before closing the socket. Prevents slow request attacks. |
45
+| `accept a streaming request every seconds` | `0` | Can be used to set a limit on how often a parent node will accept streaming requests from child nodes in a [streaming and replication setup](/streaming/README.md). |
46
+| `respect do not track policy` | `no` | If set to `yes`, Netdata will respect the user's browser preferences for [Do Not Track](https://www.eff.org/issues/do-not-track) (DNT) and storing cookies. If DNT is _enabled_ in the browser, and this option is set to `yes`, users will not be able to sign in to Netdata Cloud via their local Agent dashboard, and their node will not connect to any [registry](/registry/README.md). For certain browsers, users must disable DNT and change this option to `yes` for full functionality. |
47
+| `x-frame-options response header` | ` ` | Avoid [clickjacking attacks](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options), by ensuring that the content is not embedded into other sites. |
48
+| `allow connections from` | `localhost *` | Declare which IP addresses or full-qualified domain names (FQDNs) are allowed to connect to the web server, including the [dashboard](/docs/dashboard/dashboards-charts.mdx) or [HTTP API](/web/api/README.md). This is a global setting with higher priority to any of the ones below. |
49
+| `allow connections by dns` | `heuristic` | See the [access list examples](#access-lists) for details on using `allow` settings. |
50
+| `allow dashboard from` | `localhost *` | |
51
+| `allow dashboard by dns` | `heuristic` | |
52
+| `allow badges from` | `*` | |
53
+| `allow badges by dns` | `heuristic` | |
54
+| `allow streaming from` | `*` | |
55
+| `allow streaming by dns` | `heuristic` | |
56
+| `allow netdata.conf` | `localhost fd* 10.* 192.168.* 172.16.* 172.17.* 172.18.* 172.19.* 172.20.* 172.21.* 172.22.* 172.23.* 172.24.* 172.25.* 172.26.* 172.27.* 172.28.* 172.29.* 172.30.* 172.31.* UNKNOWN` | |
57
+| `allow netdata.conf by dns` | `no` | |
58
+| `allow management from` | `localhost` | |
59
+| `allow management by dns` | `heuristic` | |
60
+| `enable gzip compression` | `yes` | When set to `yes`, Netdata web responses will be GZIP compressed, if the web client accepts such responses. |
61
+| `gzip compression strategy` | `default` | Valid settings are `default`, `filtered`, `huffman only`, `rle` and `fixed`. |
62
+| `gzip compression level` | `3` | Valid settings are 1 (fastest) to 9 (best ratio). |
63
+| `web server threads` | ` ` | How many processor threads the web server is allowed. The default is system-specific, the minimum of `6` or the number of CPU cores. |
64
+| `web server max sockets` | ` ` | Available sockets. The default is system-specific, automatically adjusted to 50% of the max number of open files Netdata is allowed to use (via `/etc/security/limits.conf` or systemd), to allow enough file descriptors to be available for data collection. |
65
+| `custom dashboard_info.js` | ` ` | Specifies the location of a custom `dashboard.js` file. See [customizing the standard dashboard](/docs/dashboard/customize.mdx#customize-the-standard-dashboard) for details. |
66
+
67
+## Examples
68
+
69
+### Disable the web server
70
+
71
+Disable the web server by editing `netdata.conf` and setting:
72
+
73
+```
74
+[web]
75
+ mode = none
76
+```
77
+
78
+### Change the number of threads
79
+
80
+Control the number of threads and sockets with the following settings:
81
+
82
+```
83
+[web]
84
+ web server threads = 4
85
+ web server max sockets = 512
86
+```
87
+
88
+### Binding Netdata to multiple ports
89
+
90
+Netdata can bind to multiple IPs and ports, offering access to different services on each. Up to 100 sockets can be used (increase it at compile time with `CFLAGS="-DMAX_LISTEN_FDS=200" ./netdata-installer.sh ...`).
91
+
92
+The ports to bind are controlled via `[web].bind to`, like this:
93
+
94
+```
95
+[web]
96
+ default port = 19999
97
+ bind to = 127.0.0.1=dashboard^SSL=optional 10.1.1.1:19998=management|netdata.conf hostname:19997=badges [::]:19996=streaming^SSL=force localhost:19995=registry *:http=dashboard unix:/run/netdata/netdata.sock
98
+```
99
+
100
+Using the above, Netdata will bind to:
101
+
102
+- IPv4 127.0.0.1 at port 19999 (port was used from `default port`). Only the UI (dashboard) and the read API will be accessible on this port. Both HTTP and HTTPS requests will be accepted.
103
+- IPv4 10.1.1.1 at port 19998. The management API and `netdata.conf` will be accessible on this port.
104
+- All the IPs `hostname` resolves to (both IPv4 and IPv6 depending on the resolved IPs) at port 19997. Only badges will be accessible on this port.
105
+- All IPv6 IPs at port 19996. Only metric streaming requests from other Netdata agents will be accepted on this port. Only encrypted streams will be allowed (i.e. child nodes also need to be [configured for TLS](/streaming/README.md).
106
+- All the IPs `localhost` resolves to (both IPv4 and IPv6 depending the resolved IPs) at port 19996. This port will only accept registry API requests.
107
+- All IPv4 and IPv6 IPs at port `http` as set in `/etc/services`. Only the UI (dashboard) and the read API will be accessible on this port.
108
+- Unix domain socket `/run/netdata/netdata.sock`. All requests are serviceable on this socket. Note that in some OSs like Fedora, every service sees a different `/tmp`, so don't create a Unix socket under `/tmp`. `/run` or `/var/run` is suggested.
109
+
110
+The option `[web].default port` is used when an entries in `[web].bind to` do not specify a port.
111
+
112
+Note that the access permissions specified with the `=request type|request type|...` format are available from version 1.12 onwards.
113
+As shown in the example above, these permissions are optional, with the default being to permit all request types on the specified port.
114
+The request types are strings identical to the `allow X from` directives of the access lists, i.e. `dashboard`, `streaming`, `registry`, `netdata.conf`, `badges` and `management`.
115
+The access lists themselves and the general setting `allow connections from` in the next section are applied regardless of the ports that are configured to provide these services.
116
+The API requests are serviced as follows:
117
+
118
+- `dashboard` gives access to the UI, the read API and badges API calls.
119
+- `badges` gives access only to the badges API calls.
120
+- `management` gives access only to the management API calls.
121
+
122
+### Enable HTTPS/TLS support
123
+
124
+Since v1.16.0, Netdata supports encrypted HTTP connections to the web server, plus encryption of streaming data to a
125
+parent from its child nodes, via the TLS protocol.
126
+
127
+Inbound unix socket connections are unaffected, regardless of the TLS settings.
128
+
129
+> While Netdata uses Transport Layer Security (TLS) 1.2 to encrypt communications rather than the obsolete SSL protocol,
130
+> it's still common practice to refer to encrypted web connections as `SSL`. Many vendors, like Nginx and even Netdata
131
+> itself, use `SSL` in configuration files, whereas documentation will always refer to encrypted communications as `TLS`
132
+> or `TLS/SSL`.
133
+
134
+To enable TLS, provide the path to your certificate and private key in the `[web]` section of `netdata.conf`:
135
+
136
+```conf
137
+[web]
138
+ ssl key = /etc/netdata/ssl/key.pem
139
+ ssl certificate = /etc/netdata/ssl/cert.pem
140
+```
141
+
142
+Both files must be readable by the `netdata` user. If either of these files do not exist or are unreadable, Netdata will fall back to HTTP. For a parent-child connection, only the parent needs these settings.
143
+
144
+For test purposes, generate self-signed certificates with the following command:
145
+
146
+```bash
147
+openssl req -newkey rsa:2048 -nodes -sha512 -x509 -days 365 -keyout key.pem -out cert.pem
148
+```
149
+
150
+> If you use 4096 bits for your key and the certificate, Netdata will need more CPU to process the communication.
151
+> `rsa4096` can be up to 4 times slower than `rsa2048`, so we recommend using 2048 bits. Verify the difference
152
+> by running:
153
+>
154
+> ```sh
155
+> openssl speed rsa2048 rsa4096
156
+> ```
157
+
158
+### Select TLS version
159
+
160
+Beginning with version `v1.21.0`, specify the TLS version and the ciphers that you want to use:
161
+
162
+```conf
163
+[web]
164
+ tls version = 1.3
165
+ tls ciphers = TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256
166
+```
167
+
168
+If you do not specify these options, Netdata will use the highest available protocol version on your system and the default cipher list for that protocol provided by your TLS implementation.
169
+
170
+#### TLS/SSL enforcement
171
+
172
+When the certificates are defined and unless any other options are provided, a Netdata server will:
173
+
174
+- Redirect all incoming HTTP web server requests to HTTPS. Applies to the dashboard, the API, `netdata.conf` and badges.
175
+- Allow incoming child connections to use both unencrypted and encrypted communications for streaming.
176
+
177
+To change this behavior, you need to modify the `bind to` setting in the `[web]` section of `netdata.conf`. At the end of each port definition, append `^SSL=force` or `^SSL=optional`. What happens with these settings differs, depending on whether the port is used for HTTP/S requests, or for streaming.
178
+
179
+| SSL setting | HTTP requests|HTTPS requests|Unencrypted Streams|Encrypted Streams|
180
+|:---------:|:-----------:|:------------:|:-----------------:|:----------------|
181
+| none | Redirected to HTTPS|Accepted|Accepted|Accepted|
182
+| `force`| Redirected to HTTPS|Accepted|Denied|Accepted|
183
+| `optional`| Accepted|Accepted|Accepted|Accepted|
184
+
185
+Example:
186
+
187
+```
188
+[web]
189
+ bind to = *=dashboard|registry|badges|management|streaming|netdata.conf^SSL=force
190
+```
191
+
192
+For information how to configure the child to use TLS, check [securing the communication](/streaming/README.md#securing-streaming-communications) in the streaming documentation. There you will find additional details on the expected behavior for client and server nodes, when their respective TLS options are enabled.
193
+
194
+When we define the use of SSL in a Netdata agent for different ports, Netdata will apply the behavior specified on each port. For example, using the configuration line below:
195
+
196
+```
197
+[web]
198
+ bind to = *=dashboard|registry|badges|management|streaming|netdata.conf^SSL=force *:20000=netdata.conf^SSL=optional *:20001=dashboard|registry
199
+```
200
+
201
+Netdata will:
202
+
203
+- Force all HTTP requests to the default port to be redirected to HTTPS (same port).
204
+- Refuse unencrypted streaming connections from child nodes on the default port.
205
+- Allow both HTTP and HTTPS requests to port 20000 for `netdata.conf`
206
+- Force HTTP requests to port 20001 to be redirected to HTTPS (same port). Only allow requests for the dashboard, the read API and the registry on port 20001.
207
+
208
+#### TLS/SSL errors
209
+
210
+When you start using Netdata with TLS, you may find errors in the Netdata log, which is stored at `/var/log/netdata/error.log` by default.
211
+
212
+Most of the time, these errors are due to incompatibilities between your browser's options related to TLS/SSL protocols and Netdata's internal configuration. The most common error is `error:00000006:lib(0):func(0):EVP lib`.
213
+
214
+In the near future, Netdata will allow our users to change the internal configuration to avoid similar errors. Until then, we're recommending only the most common and safe encryption protocols listed above.
215
+
216
+### Access lists
217
+
218
+Netdata supports access lists in `netdata.conf`:
219
+
220
+```
221
+[web]
222
+ allow connections from = localhost *
223
+ allow dashboard from = localhost *
224
+ allow badges from = *
225
+ allow streaming from = *
226
+ allow netdata.conf from = localhost fd* 10.* 192.168.* 172.16.* 172.17.* 172.18.* 172.19.* 172.20.* 172.21.* 172.22.* 172.23.* 172.24.* 172.25.* 172.26.* 172.27.* 172.28.* 172.29.* 172.30.* 172.31.*
227
+ allow management from = localhost
228
+```
229
+
230
+`*` does string matches on the IPs or FQDNs of the clients.
231
+
232
+- `allow connections from` matches anyone that connects on the Netdata port(s).
233
+ So, if someone is not allowed, it will be connected and disconnected immediately, without reading even
234
+ a single byte from its connection. This is a global setting with higher priority to any of the ones below.
235
+
236
+- `allow dashboard from` receives the request and examines if it is a static dashboard file or an API call the
237
+ dashboards do.
238
+
239
+- `allow badges from` checks if the API request is for a badge. Badges are not matched by `allow dashboard from`.
240
+
241
+- `allow streaming from` checks if the child willing to stream metrics to this Netdata is allowed.
242
+ This can be controlled per API KEY and MACHINE GUID in `stream.conf`.
243
+ The setting in `netdata.conf` is checked before the ones in `stream.conf`.
244
+
245
+- `allow netdata.conf from` checks the IP to allow `http://netdata.host:19999/netdata.conf`.
246
+ The IPs listed are all the private IPv4 addresses, including link local IPv6 addresses. Keep in mind that connections to Netdata API ports are filtered by `allow connections from`. So, IPs allowed by `allow netdata.conf from` should also be allowed by `allow connections from`.
247
+
248
+- `allow management from` checks the IPs to allow API management calls. Management via the API is currently supported for [health](/web/api/health/README.md#health-management-api)
249
+
250
+In order to check the FQDN of the connection without opening the Netdata agent to DNS-spoofing, a reverse-dns record
251
+must be setup for the connecting host. At connection time the reverse-dns of the peer IP address is resolved, and
252
+a forward DNS resolution is made to validate the IP address against the name-pattern.
253
+
254
+Please note that this process can be expensive on a machine that is serving many connections. Each access list has an
255
+associated configuration option to turn off DNS-based patterns completely to avoid incurring this cost at run-time:
256
+
257
+```
258
+ allow connections by dns = heuristic
259
+ allow dashboard by dns = heuristic
260
+ allow badges by dns = heuristic
261
+ allow streaming by dns = heuristic
262
+ allow netdata.conf by dns = no
263
+ allow management by dns = heuristic
264
+```
265
+
266
+The three possible values for each of these options are `yes`, `no` and `heuristic`. The `heuristic` option disables
267
+the check when the pattern only contains IPv4/IPv6 addresses or `localhost`, and enables it when wildcards are
268
+present that may match DNS FQDNs.
269
+
270
+## DDoS protection
271
+
272
+If you publish your Netdata web server to the internet, you may want to apply some protection against DDoS:
273
+
274
+1. Use the `static-threaded` web server (it is the default)
275
+2. Use reasonable `[web].web server max sockets` (the default is)
276
+3. Don't use all your CPU cores for Netdata (lower `[web].web server threads`)
277
+4. Run the `netdata` process with a low process scheduling priority (the default is the lowest)
278
+5. If possible, proxy Netdata via a full featured web server (Nginx, Apache, etc)