Debian Codegraph @

docs/security-best-practices.md

raw
1 # Security
2
3 The OpenTelemetry Collector defaults to operating in a secure manner but is
4 configuration driven. This document captures important security aspects and
5 considerations for the Collector. This document is intended for component
6 developers. It assumes at least a basic understanding of the Collector
7 architecture and functionality.
8
9 > Note: Please review the
10 > [configuration documentation](https://opentelemetry.io/docs/collector/configuration/)
11 > prior to this security document.
12
13 Security documentation for end users can be found on the OpenTelemetry
14 documentation website:
15
16 - [Collector configuration best practices](https://opentelemetry.io/docs/security/config-best-practices/)
17 - [Collector hosting best practices](https://opentelemetry.io/docs/security/hosting-best-practices/)
18
19 ## TL;DR
20
21 - Configuration
22 - MUST come from the central configuration file
23 - SHOULD use configuration helpers
24 - Permissions
25 - SHOULD minimize privileged access
26 - MUST document what requires privileged access and why
27 - Receivers/Exporters
28 - MUST default to encrypted connections
29 - SHOULD leverage helper functions
30 - Extensions
31 - SHOULD NOT expose sensitive health or telemetry data by default
32
33 > For more information about securing the OpenTelemetry Collector, see
34 > [this blog post](https://medium.com/opentelemetry/securing-your-opentelemetry-collector-1a4f9fa5bd6f).
35
36 ## Configuration
37
38 The Collector binary does not contain an embedded or default configuration and
39 MUST NOT start without a configuration file being specified. The configuration
40 file passed to the Collector MUST be validated prior to being loaded. If an
41 invalid configuration is detected, the Collector MUST fail to start as a
42 protective mechanism.
43
44 Component developers MUST get configuration information from the Collector's
45 configuration file. Component developers SHOULD leverage
46 [configuration helper functions](https://github.com/open-telemetry/opentelemetry-collector/tree/main/config).
47
48 When defining Go structs for configuration data that may contain sensitive
49 information, use the `configopaque` package to define fields with the
50 `configopaque.String` type. This ensures that the data is masked when serialized
51 to prevent accidental exposure.
52
53 > For more information, see the
54 > [configopaque](https://pkg.go.dev/go.opentelemetry.io/collector/config/configopaque)
55 > documentation.
56
57 ## Permissions
58
59 The Collector supports running as a custom user and SHOULD NOT be run as a
60 root/admin user. For the majority of use-cases, the Collector SHOULD NOT require
61 privileged access to function. Some components MAY require privileged access or
62 external permissions, including network access or RBAC.
63
64 Component developers SHOULD minimize privileged access requirements and MUST
65 document what requires privileged access and why.
66
67 ## Receivers and Exporters
68
69 Receivers and Exporters can be either push or pull-based. In either case, the
70 connection established SHOULD be over a secure and authenticated channel.
71
72 Component developers MUST default to encrypted connections (using the
73 `insecure: false` configuration setting) and SHOULD leverage
74 [gRPC](https://github.com/open-telemetry/opentelemetry-collector/tree/main/config/configgrpc)
75 and
76 [http](https://github.com/open-telemetry/opentelemetry-collector/tree/main/config/confighttp)
77 helper functions.
78
79 ## Safeguards against denial of service attacks
80
81 See the [Collector configuration security documentation](https://opentelemetry.io/docs/security/config-best-practices/#protect-against-denial-of-service-attacks) to learn how to safeguard against denial of service attacks.
82
83 ## Extensions
84
85 Component developers SHOULD NOT expose health or telemetry data outside the
86 Collector by default.