You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/en/security/application_security/setup/go/_index.md
+41-17Lines changed: 41 additions & 17 deletions
Original file line number
Diff line number
Diff line change
@@ -32,33 +32,37 @@ You can monitor App and API Protection for Go apps running in Docker, Kubernetes
32
32
33
33
# Prerequisite
34
34
35
-
- Your service is [supported][2].
36
-
- You have one of the latest two version of [Go][4] installed (following the [Official Release Policy][5])
35
+
- Your service framework and tools are [compatible][2] with the [Application & API Protection (AAP)][1] product.
36
+
- Your deployment environment is [supported][5].
37
+
- You have one of the latest two version of [Go][4] installed (following the [Official Release Policy][5]).
37
38
38
-
## Enabling threat detection
39
+
## Enabling Application & API Protection (AAP)
39
40
### Get started
40
41
41
-
1.**Add to your program's go.mod dependencies** the latest version of the Datadog Go library (version 1.53.0 or later). {{% tracing-go-v2 %}}
42
+
1.**Install Orchestrion**:
42
43
43
-
```shell
44
-
$ go get -v -u github.com/DataDog/dd-trace-go/v2/ddtrace/tracer
44
+
```console
45
+
$ go install github.com/DataDog/orchestrion@latest
46
+
```
47
+
48
+
2.**Register Orchestrion as a Go module** in your project directory:
49
+
```console
50
+
$ orchestrion pin
45
51
```
46
52
47
-
2. Datadog has a series of pluggable packages which provide out-of-the-box support for instrumenting a series of Go libraries and frameworks.
48
-
A list of these packages can be found in the [compatibility requirements][1] page. Import these packages into your application and follow the configuration instructions listed alongside each integration.
53
+
3. Datadog has a series of pluggable packages which provide out-of-the-box support for instrumenting a series of Go libraries and frameworks.
54
+
A list of these packages can be found in the [compatibility requirements][1] page.
55
+
Import these packages into your application and follow the configuration instructions listed alongside each integration.
49
56
50
-
3.**Recompile your program** with AAP enabled:
57
+
4.**Recompile your program** with Orchestrion:
51
58
```console
52
-
$ go build -v -tags appsec my-program
59
+
$ orchestrion go build my-program
53
60
```
61
+
More options on how to use orchestrion can be found in the [Orchestrion usage][7].
54
62
55
-
**Notes**:
56
-
- The Go build tag `appsec` is not necessary if CGO is enabled with `CGO_ENABLED=1`.
57
-
- Datadog WAF needs the following shared libraries on Linux: `libc.so.6` and `libpthread.so.0`.
58
-
- When using the build tag `appsec` and CGO is disabled, the produced binary is still linked dynamically to these libraries.
59
-
- The Go build tag `datadog.no_waf` can be used to disable AAP at build time in any situation where the requirements above are a hinderance.
63
+
Note: If you are building without CGO on linux. Please read [Building Go applications with CGO disabled][6] for more information.
60
64
61
-
4.**Redeploy your Go service and enable AAP** by setting the `DD_APPSEC_ENABLED` environment variable to `true`:
65
+
5.**Redeploy your Go service and enable AAP** by setting the `DD_APPSEC_ENABLED` environment variable to `true`:
62
66
```console
63
67
$ env DD_APPSEC_ENABLED=true ./my-program
64
68
```
@@ -83,7 +87,7 @@ Add the following environment variable value to your application container's Doc
83
87
ENV DD_APPSEC_ENABLED=true
84
88
```
85
89
86
-
A more detailed guide on how to create a fiting dockerfile is available [here][3]
90
+
A more detailed guide on how to create a fitting dockerfile is available [here][3].
87
91
88
92
{{% /tab %}}
89
93
{{% tab "Kubernetes" %}}
@@ -121,10 +125,28 @@ Update your application's ECS task definition JSON file, by adding this in the e
121
125
122
126
{{< /tabs >}}
123
127
128
+
{{% app_and_api_protection_verify_setup %}}
129
+
124
130
{{% appsec-getstarted-2 %}}
125
131
126
132
{{< img src="/security/application_security/appsec-getstarted-threat-and-vuln_2.mp4" alt="Video showing Signals explorer and details, and Vulnerabilities explorer and details." video="true" >}}
127
133
134
+
### Building without CGO
135
+
136
+
If you are building your Go application without CGO, you can still enable AAP by following these steps:
137
+
138
+
1.**Add the `appsec` build tag** when compiling your application:
139
+
```console
140
+
$ CGO_ENABLED=0 orchestrion go build -tags appsec my-program
141
+
```
142
+
143
+
Using `CGO_ENABLED=0` usually guarantees a statically-linked binary. This will NOT be the case in this setup.
144
+
145
+
2.**Install `libc.so.6` and `libpthread.so.0`** on your system, as these libraries are required by the Datadog WAF:
146
+
This can be done by installing the `glibc` package on your system via your package manager. Read more on [Creating a Dockerfile for AAP][3]
147
+
148
+
3.**Redeploy your Go service** with the `DD_APPSEC_ENABLED=true` environment variable set, as described above.
149
+
128
150
## Using AAP without APM tracing
129
151
130
152
If you want to use Application & API Protection without APM tracing functionality, you can deploy with tracing disabled:
@@ -144,3 +166,5 @@ For more details, see [Standalone App and API Protection][standalone_billing_gui
* The first stage uses [Orchestrion][5] compile-time instrumentation to instrument the Go application with the App and API Protection features.
61
64
* The flag `-tags appsec` or CGO being enabled are requirements at build time for C++ Datadog's WAF. If none of these requirements are met, your service will be marked as not compatible is Datadog's UI.
62
65
* the `libc6-compat` package is required because Datadog's WAF needs the following shared libraries on Linux: `libc.so.6` and `libpthread.so.0`. If you are using `CGO_ENABLED=0` and `-tags` appsec at the same time and those shared libraries are not present at runtime you app will refuse to start with the error `No such file or directory`.
63
66
@@ -84,3 +87,4 @@ If you encounter issues while setting up App and API Protection for your applica
0 commit comments