Cortex XDR Custom SecOps Integration

Cortex XDR Custom SecOps Integration

The Cortex XDR Custom SecOps Integration allows you to poll and push adversary-related events to your Cortex XDR deployment. After configuring the integration, your Cortex deployment will be able to receive and process Lumu events. Using it lets you see adversarial activity detected by Lumu, giving your Security Operations team more visibility.


SecOps integration between Cortex XDR and Lumu

Requirements

  1. A Cortex XDR Pro per GB (Datalake) subscription and Web access.
  2. Lumu Defender API key
    1. To retrieve an API token, please refer to the Defender API document.
  3. A Docker-enabled host.
    1. This host will be used to deploy the integration component. It must have Internet visibility over the Lumu Defender API endpoints and the Cortex XDR Instance.
  4. Component and Script package
    1. Contact the Lumu support team to request for indication or visit the documentation component in DockerHub site.

    Contacted hosts

    Ensure your integration host can communicate with the following hosts. These are required for the operation of this integration.

    1. Cortex XDR instance subdomain
    2. defender.lumu.io
    3. docker.io
    4. docker.com

    Notes
    Cortex XDR gives you a subdomain within xdr.us.paloaltonetworks.com, save it for the integration configuration file

    Integration’s overview

    The integration pushes Lumu adversary-related events into your Cortex XDR deployment after being configured by leveraging the Parsed event API. Once Lumu reports an event, your Cortex XDR deployment will see Lumu detections as alerts.

    Preliminary setup - Cortex XDR Console

    To set up the integration, you must prepare your Cortex XDR deployment to communicate with the Lumu integration. To do this, you need to: 
    1. Create a Custom Role
    2. Create an API Key

    Create a Custom Role

    Notes
    To preserve the principle of least privilege, we encourage you to create a dedicated custom role for the integration. This role will only be granted the features needed to make the integration work.

    To create a new role, log in to your Cortex XDR console. Go to Settings > Configurations > Access Management > Roles, and follow these steps.

    1. Click on the New Role Button
    2. Fill in the Role Name and Description fields
    3. Under the Components tab, go to the CONFIGURATIONS section. Then, change the External Alerts Mapping and Public API items to View/Edit

    Create an API Key

    You need to create an API key dedicated to run the integration script. To create it, go to Settings > Configurations > Integrations > API Keys, and follow these steps.

    1. Click on the New Key button
    2. Under the Role Name field, select the previously created role
    3. Under the Security Level section, select the Standard option
    4. Define an expiration date for the key by clicking the Enable Expiration Date checkbox 
    5. Then, copy the generated secret. This secret will not be shown again, make sure you store it in a safe place.
    6. From the API Keys window, extract the ID number of the created key and Copy the API URL using the button at the upper right corner. Store these values safely, they will be used during the Set up the configuration parameters step.

    Notes
    We recommend you define an expiration date for the API key. Bear in mind that you need to renew and reconfigure the integration before the key expires to keep the integration working.

    Preliminary setup - Lumu portal

    You must  collect the following information from the Lumu portal:

    • Lumu Defender API key

    • Company UUID

    Log in to your Lumu portal and run the following data collection procedures.

    Collect the Lumu Defender API key

    To collect the Lumu Defender API key, refer to the Defender API document.

    Collect your Lumu company UUID

    To collect your Lumu company UUID, log in to your Lumu portal. Once you are in the main window, copy the string below your company name.

    Deploy the integration

    Follow the steps of the following section to deploy the integration

    Set up the Management Script

    Lumu prepared a short snippet that allows you to manage your integration. Create a file named manage.sh in your integration host. Copy and paste the following code.
    Code Snippet
    #!/usr/bin/env bash

    RED='\033[0;31m'
    GREEN='\033[0;32m'
    CYAN='\033[0;36m'
    YELLOW='\033[1;33m'
    BOLD='\033[1m'
    RESET='\033[0m'

    info() { echo -e "${CYAN}[INFO]${RESET} $*"; }
    success() { echo -e "${GREEN}[OK]${RESET} $*"; }
    warn() { echo -e "${YELLOW}[WARN]${RESET} $*"; }
    error() { echo -e "${RED}[ERROR]${RESET} $*" >&2; }
    prompt() { echo -e "${BOLD}${YELLOW}$*${RESET}"; }

    IMG=lumutools/cortex-xdr-secops:latest
    INTEGRATION_NAME=lumu-cortex-xdr-secops
    INTEGRATION_DIR=${HOME}/CortexXDRSecOps
    VOLUME_DATA=${INTEGRATION_DIR}/data:/app/data
    VOLUME_CONFIG=${INTEGRATION_DIR}/data/.config.toml:/app/.config.toml:ro

    mkdir -p "${INTEGRATION_DIR}/data"
    chmod -R o+w "${INTEGRATION_DIR}/data" > /dev/null 2>&1

    run_config() {
    info "Running configuration script ..."
    if docker run --rm -it -v "${INTEGRATION_DIR}/data:/app/data" "${IMG}" bash run_config; then
    success "Configuration completed."
    else
    error "Configuration script failed."; return 1
    fi
    }

    start_integration() {
    if [[ ! -f "${INTEGRATION_DIR}/data/.config.toml" ]]; then
    error "Please configure the integration first."; return 1
    fi

    info "Setting up integration '${INTEGRATION_NAME}' ..."
    if ! docker container inspect "${INTEGRATION_NAME}" &>/dev/null; then
    info "Integration '${INTEGRATION_NAME}' does not exist. Creating ..."
    if ! docker create \
    -v "${VOLUME_DATA}" \
    -v "${VOLUME_CONFIG}" \
    --restart unless-stopped \
    --log-driver json-file \
    --log-opt max-size=30m \
    --log-opt max-file=3 \
    --name "${INTEGRATION_NAME}" \
    "${IMG}" bash run_component; then
    error "Failed to create integration."; return 1
    fi
    else
    warn "Integration '${INTEGRATION_NAME}' already exists. Skipping create."
    fi
    if docker start "${INTEGRATION_NAME}"; then
    success "Integration started."
    else
    error "Failed to start integration."; return 1
    fi
    }

    check_status() {
    info "Checking status of integrations ..."
    if [[ ! -f "${INTEGRATION_DIR}/data/.status.ndjson" ]]; then
    error "Status check failed. Verify if your integration has been deployed."; return 1
    fi
    if docker run --rm -it -v "${VOLUME_DATA}":ro "${IMG}" bash run_status; then
    success "Status check completed."
    else
    error "Status check failed."; return 1
    fi
    }

    show_logs() {
    info "Showing logs for '${INTEGRATION_NAME}' ..."
    docker logs --tail 100 -f "${INTEGRATION_NAME}"
    }

    usage() {
    echo ""
    prompt " CORTEX XDR (SECOPS) INTEGRATION MANAGEMENT"
    echo -e " ${BOLD}Usage:${RESET} $0 "
    echo ""
    echo -e " ${CYAN}config${RESET} Run configuration"
    echo -e " ${CYAN}start${RESET} Start integration"
    echo -e " ${CYAN}status${RESET} Check integration status"
    echo -e " ${CYAN}logs${RESET} Show integration logs"
    echo ""
    }

    case "${1}" in
    config) run_config ;;
    start) start_integration ;;
    status) check_status ;;
    logs) show_logs ;;
    *) usage
    [[ -n "${1}" ]] && error "Unknown command '${1}'."
    exit 1 ;;
    esac

    Using the Management Script

    With the management script, you can:
    1. Configure the integration.
    2. Start the integration.
    3. Check the status of the integration.
    4. Check the audit logs of the integration.
    You can check these options by running the following command:
    bash manage.sh

    When running the configuration options, a wizard will guide you through a series of prompts. If the provided credentials are correct, the wizard will confirm this. If the credentials fail, you will receive an error message and have the option to re-enter the credentials or proceed despite the error.

    Set up the configuration parameters

    Execute the following command and type in all parameters gathered during the Preliminary Setup. Fix any errors in your inputs if prompted. 
    bash manage.sh config
    AlertYou must fill in the configuration data carefully. If there are any mistakes or missing data, you’ll receive errors during the deployment and runtime of the integration.
    Notes We strongly recommend correcting any credential errors before attempting to start the integration using the start command.

    Run the Integration

    You are ready to run the integration. You can start it by running this command:
    bash manage.sh start

    Notes If you have run this process before, you may receive warning messages about the existence of components. To ensure you have the latest version of the integration, we recommend removing the existing integration containers before entering the start command.

    Check the integration status

    You can check the integration status after it has been activated. Run the following command to check its current status.
    bash manage.sh status

    If the script reports errors during the integration operation, head to the Show logs section to check how to collect additional details.
    Notes Monitor the console output for any unexpected errors. If there are any errors present, fix them and run the command again. Check the Troubleshooting section for further reference.

    Show logs

    NotesWe kindly request you to, when issuing a support case, attach the integration logs collected using the steps described in this section.
    bash manage.sh logs

    Expected results

    After running the component, you will see the detection made by Lumu in the Alerts section. 
    If there are any incidents created by those alerts, they can be seen in the Incident section. 

    NotesThe integration starts syncing new incidents from the moment you activate the integration, it does not work retroactively. Make sure your integration script is running all the time to ensure maximum coverage.

    Troubleshooting

    You can use the Management Script for general troubleshooting. Here, you will find additional commands to run additional diagnostics if they are needed.
    • Stopping the integration
      Run the following command if you need to stop the integration.
      docker stop lumu-cortex-xdr-secops
    • Starting the integration
      Run the following command to start the integration.
      docker start lumu-cortex-xdr-secops

    Known issues

    In this section, we collect all the potential issues you will find after you run the troubleshooting commands from the above section.

        Docker permission execution

        If you got some error building the integration related to docker: permission denied while trying to connect to the Docker daemon socket, there is an official documentation post installation to fix this issue, visit the official documentation.