Este producto no es compatible con el sitio Datadog seleccionado. ().

App and API Protection se encuentra en versión preliminar en el sitio de Datadog Government US1-FED.

Puede hacer un seguimiento de la protección de aplicaciones y API para aplicaciones .NET que se ejecutan en Docker, Kubernetes, Amazon ECS y AWS Fargate.

Prerequisites

1-Click Enablement
If your service is running with an Agent with Remote Configuration enabled and a tracing library version that supports it, hover over the Not Enabled indicator in the AAP Status column and click Enable AAP. There's no need to re-launch the service with the DD_APPSEC_ENABLED=true or --enable-appsec flags.

Habilitación de la detección de amenazas

Comience

  1. Actualice su biblioteca .NET de Datadog al menos a la versión 2.2.0 para la arquitectura de su sistema operativo de destino.

    Para verificar que las versiones del lenguaje y el marco de trabajo de su servicio sean compatibles con las capacidades de AAP, consulte Compatibilidad.

  2. Habilite AAP configurando la variable de entorno DD_APPSEC_ENABLED en true. Por ejemplo, en Windows autohospedado, ejecute el siguiente fragmento de PowerShell como parte de su script de inicio de la aplicación:

    $target=[System.EnvironmentVariableTarget]::Process
    [System.Environment]::SetEnvironmentVariable("DD_APPSEC_ENABLED","true",$target)
    

    O uno de los siguientes métodos, dependiendo de dónde se ejecute su aplicación:

    En una consola de Windows:

    rem Set environment variables
    SET CORECLR_ENABLE_PROFILING=1
    SET CORECLR_PROFILER={846F5F1C-F9AE-4B07-969E-05C26BC060D8}
    SET DD_APPSEC_ENABLED=true
    
    rem Start application
    dotnet.exe example.dll
    

    Ejecute el siguiente comando de PowerShell como administrador para configurar las variables de entorno necesarias en el registro HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment y reinicie IIS.

    $target=[System.EnvironmentVariableTarget]::Machine
    [System.Environment]::SetEnvironmentVariable("DD_APPSEC_ENABLED","true",$target)
    net stop was /y
    net start w3svc
    

    O, exclusivamente para servicios de IIS, en WAS y W3SVC con PowerShell como administrador, ejecute:

    $appsecPart = "DD_APPSEC_ENABLED=true"
    [string[]] $defaultvariable = @("CORECLR_ENABLE_PROFILING=1", "CORECLR_PROFILER={846F5F1C-F9AE-4B07-969E-05C26BC060D8}", $appsecPart)
    
    function Add-AppSec {
    
        param (
            $path
        )
        $v = (Get-ItemProperty -Path $path).Environment
        If ($v -eq $null) {
            Set-ItemProperty -Path $path -Name "Environment" -Value $defaultvariable
        }
        ElseIf (-not ($v -match $appsecPart)) {
            $v += " " + $appsecPart;
            Set-ItemProperty -Path $path -Name "Environment" -Value $v
        }
    }
    Add-AppSec -path "HKLM:SYSTEM\CurrentControlSet\Services\WAS\"
    Add-AppSec -path "HKLM:SYSTEM\CurrentControlSet\Services\W3SVC\"
    
    net stop was /y
    net start w3svc
    

    O, para evitar editar las claves del registro, edite la configuración de la aplicación en el archivo web.config de su aplicación:

    <configuration>
      <appSettings>
            <add key="DD_APPSEC_ENABLED" value="true"/>
      </appSettings>
    </configuration>
    

    Esto también se puede hacer a nivel de grupos de aplicaciones de IIS en el archivo applicationHost.config, generalmente en C:\Windows\System32\inetsrv\config\:

    <system.applicationHost>
    
        <applicationPools>
            <add name="DefaultAppPool">
                <environmentVariables>
                    <add name="DD_APPSEC_ENABLED" value="true" />
                </environmentVariables>
                (...)
    

    Agregue lo siguiente a la configuración de su aplicación:

    DD_APPSEC_ENABLED=true
    

    Actualice su contenedor de configuración para APM agregando el siguiente argumento en su comando docker run:

    docker run [...] -e DD_APPSEC_ENABLED=true [...]
    

    Agregue el siguiente valor de variable de entorno al Dockerfile de su contenedor:

    ENV DD_APPSEC_ENABLED=true
    

    Actualice su archivo de configuración de implementación para APM y agregue la variable de entorno AAP:

    spec:
      template:
        spec:
          containers:
            - name: <CONTAINER_NAME>
              image: <CONTAINER_IMAGE>/<TAG>
              env:
                - name: DD_APPSEC_ENABLED
                  value: "true"
    

    Actualice su archivo JSON de definición de tarea de ECS agregando esto en la sección de entorno:

    "environment": [
      ...,
      {
        "name": "DD_APPSEC_ENABLED",
        "value": "true"
      }
    ]
    

    Agregue la siguiente línea al Dockerfile de su contenedor:

    ENV DD_APPSEC_ENABLED=true
    
  3. Reinicie la aplicación realizando un ciclo completo de parada e inicio.

    After this configuration is complete, the library collects security data from your application and sends it to the Agent. The Agent sends the data to Datadog, where out-of-the-box detection rules flag attacker techniques and potential misconfigurations so you can take steps to remediate.

  4. To see App and API Protection threat detection in action, send known attack patterns to your application. For example, trigger the Security Scanner Detected rule by running a file that contains the following curl script:

    for ((i=1;i<=250;i++)); 
    do
    # Target existing service's routes
    curl https://your-application-url/existing-route -A dd-test-scanner-log;
    # Target non existing service's routes
    curl https://your-application-url/non-existing-route -A dd-test-scanner-log;
    done

    Note: The dd-test-scanner-log value is supported in the most recent releases.

    A few minutes after you enable your application and send known attack patterns to it, threat information appears in the Application Signals Explorer and vulnerability information appears in the Vulnerabilities explorer.

Uso de AAP sin rastreo de APM

Si desea utilizar App and API Protection sin la funcionalidad de traza de APM, puede desplegar con la traza deshabilitada:

  1. Configure su SDK con la variable de entorno DD_APM_TRACING_ENABLED=false además de la variable de entorno DD_APPSEC_ENABLED=true.
  2. Esta configuración reducirá la cantidad de datos de APM enviados a Datadog al mínimo requerido por los productos App and API Protection.

Para obtener más detalles, consulte [Standalone App and API Protection][standalone_billing_guide]. [standalone_billing_guide]: /security/application_security/guide/standalone_application_security/

4. Verify setup

To verify that App and API Protection is working correctly:

  1. Send some traffic to your application
  2. Check the Application Signals Explorer in Datadog
  3. Look for security signals and vulnerabilities

Lecturas adicionales