Configuring security settings

Learn how to configure the security settings available in the Cloudera Workflow Orchestrator engine configuration.

  1. Secure baseline configurations: While configuring Cloudera Workflow Orchestrator, keep the following options at their defaults unless a workload specifically requires a change. For more information about configuring the Cloudera Workflow Orchestrator engine, see Deploying Cloudera Workflow Orchestrator on Anywhere Cloud.
    • In the Disabled Operators field, maintain the default list. Removing Kubernetes or virtual-environment operators expands the capabilities of DAG code.
    • Make sure that the Enable operational MCP writes checkbox is disabled.
    • Make sure that the Enable DAG authoring via CWO Assist checkbox is disabled. If DAG authoring is required, use a separate, narrowly scoped token.
    • Make sure that the Enable Installing Additional Python Packages, Enable Custom Image, and the Kerberos related fields are disabled or empty.
    • Use read-only Git credentials and least-privilege object-storage credentials.
  2. Integrations and secrets: Configuration of external integrations introduces potential security risks. Follow these constraints when modifying integration settings:
    • Git credentials: The system uses the Git Username and Git Password/Token for DAG synchronization. Use read-only repository credentials and use a narrowly scoped token.
    • DAG authoring token: This token allows Cloudera Workflow Orchestrator to create draft pull requests. Use a narrowly scoped token and manually review draft PRs before merging.
    • Operational MCP writes: The Enable operational MCP writes configuration enables actions like triggering, clearing, or pausing DAGs. Enable this checkbox only if you enforce a strict approval policy.
    • Kerberos: The Keytab is a long-lived credential. Protect it and restrict the principal.
    • Python packages: Enabling additional Python packages installs them directly into the Airflow runtime. Use trusted indexes, pinned versions, Custom Python Packages Credentials, and a CA Certificate.
    • Remote logging: Keep access keys and IAM roles at least-privilege. Use a remote logging CA Certificate for private CAs instead of disabling certificate verification.
  3. Custom image requirements: The system treats custom images as executable production code. The DAG processor, triggerer, and worker pods use this image, meaning the code within the image inherits all permissions and network paths available to those pods. Before you enable a custom image, apply these practices:
    1. Build the image from the released Cloudera Workflow Orchestrator base image that matches the deployed Cloudera Workflow Orchestrator version.
    2. Add only necessary packages, pin package versions, and review transitive dependencies.
    3. Generate an SBOM and scan the complete image, including the base layers for vulnerabilities.
    4. Sign the new image and reference it by an immutable digest (example, image@sha256:...) or a release tag. Do not use tags like latest or dev.
    5. Promote the exact scanned and signed artifact through environments using restricted registry write access.

    For more information about building a custom image, see Building you custom image.

  4. Airflow configuration overrides: The Airflow Configuration Overrides configuration supersede the default Cloudera Workflow Orchestrator configuration. This is a high-risk setting. Leave it empty unless you use it for settings without a dedicated Cloudera Workflow Orchestrator input field and review each line for security impacts.
    • Do not override the following configurations:
      • core.auth_manager
      • core.fernet_key
      • api.secret_key
      • api_auth.jwt_secret
      • api_auth.jwt_expiration_time
      • execution_api.jwt_expiration_time
      • api.enable_swagger_ui
      • api.expose_config
      • api.expose_stacktrace
      • core.executor
      • kubernetes_executor.pod_template_file
      • kubernetes_executor.multi_namespace_mode
      • kubernetes.multi_namespace_mode
      • database.sql_alchemy_conn
      • logging.remote_logging
      • logging.remote_base_log_folder
      • logging.remote_log_conn_id
      • logging.encrypt_s3_logs
    • Review changes to these resource fields closely:
      • core.parallelism
      • core.max_active_tasks_per_dag
      • scheduler.max_tis_per_query
      • kubernetes_executor.worker_container_repository
      • kubernetes_executor.worker_container_tag
      • core.dags_folder
      • dag_processor.dag_bundle_config_list
  5. Fernet key rotation: Airflow uses the Fernet key to encrypt sensitive values stored in the metadata database, including connection passwords, variables, and trigger keyword arguments. Rotate a replacement key through Airflow rather than replacing the Secret directly, which makes existing encrypted values unreadable.

    During the transition, Airflow decrypts existing values with the old key and encrypts new values with the new key. Keep the old key available until the rotation completes, verification passes, and all components roll out. If you lose either key, you cannot recover the values encrypted with that key from Airflow alone.

  6. High-level rotation flow:
    1. Prepare the change:
      1. Install the cryptography package on your computer.
      2. Identify the current Fernet Secret.
      3. Generate a new Fernet key.
    2. Enter the dual-key phase: Update the live Secret to new-key,old-key format and restart the Cloudera Workflow Orchestrator components so every Airflow process decrypts with either key.
    3. Re-encrypt Airflow metadata: Run airflow rotate-fernet-key command once to rewrite encrypted connections, variables, and trigger data with the new key.
    4. Verify the rotation: Test representative connections, variables, DAGs, and trigger behavior, and check the logs for Fernet or decryption errors.
    5. Complete the rotation:
      1. Update the live Secret to new-key only.
      2. Restart the Cloudera Workflow Orchestrator components again.
      3. Verify representative DAG execution.
    6. Clean up temporary files: Retain the old key only in the approved recovery record and remove temporary local key files.
  7. Open the terminal on your device.
  8. Identify the Cloudera Workflow Orchestrator instance namespace.
    kubectl get namespaces
    export NAMESPACE="[***CWO_NAMESPACE***]"
  9. Retrieve the release label used by the Cloudera Workflow Orchestrator deployments in that namespace.
    kubectl -n "$NAMESPACE" get deployments \
    -o custom-columns='NAME:.metadata.name,RELEASE:.metadata.labels.release'
    
    export RELEASE="[***RELEASE_LABEL_FROM_OUTPUT***]"
  10. Locate the Fernet Secret in the namespace.
    kubectl -n "$NAMESPACE" get secrets \
    -o custom-columns='NAME:.metadata.name,TYPE:.type' | grep -i fernet
    
    export SECRET_NAME="[***FERNET_SECRET_NAME***]"

    For a chart-generated secret, the name is normally [***RELEASE***]-fernet-key or [***RELEASE***]-airflow-fernet-key.

  11. Create a restricted temporary working directory, verify your Python 3.12 environment, and decode the current Fernet key into a local file.
    export PYTHON_BIN="${PYTHON_BIN:-python3.12}"
    export WORK_DIR="$(mktemp -d)"
    umask 077
    chmod 700 "$WORK_DIR"
    export OLD_KEY_FILE="$WORK_DIR/old-key"
    export NEW_KEY_FILE="$WORK_DIR/new-key"
    export ROTATED_KEY_FILE="$WORK_DIR/rotated-key"
    
    "$PYTHON_BIN" -c 'import sys; v=sys.version_info[:2]; assert v==(3,12), f"need Python 3.12, got {sys.version}"'
    "$PYTHON_BIN" -c 'from cryptography.fernet import Fernet'
    
    # Read the current key from Kubernetes
    kubectl -n "$NAMESPACE" get secret "$SECRET_NAME" \
      -o jsonpath='{.data.fernet-key}' | base64 -d > "$OLD_KEY_FILE"
    
    chmod 600 "$OLD_KEY_FILE"
  12. Create a new key file using the cryptography library.
    "$PYTHON_BIN" -c \
      'from cryptography.fernet import Fernet; print(Fernet.generate_key().decode())' > "$NEW_KEY_FILE"
    chmod 600 "$NEW_KEY_FILE"
  13. Validate both keys and combine them into the new-key,old-key format.
    "$PYTHON_BIN" - "$OLD_KEY_FILE" "$NEW_KEY_FILE" "$ROTATED_KEY_FILE" <<'PY'
    import os
    import sys
    
    from cryptography.fernet import Fernet
    
    old_key_file, new_key_file, rotated_key_file = sys.argv[1:]
    old_key = open(old_key_file, encoding="utf-8").read().strip()
    new_key = open(new_key_file, encoding="utf-8").read().strip()
    if not old_key or not new_key or "," in old_key or "," in new_key:
        raise SystemExit("invalid Fernet key file")
    Fernet(old_key.encode())
    Fernet(new_key.encode())
    with open(rotated_key_file, "w", encoding="utf-8") as output:
        output.write(f"{new_key},{old_key}\n")
    os.chmod(rotated_key_file, 0o600)
    PY
  14. Encode the combined key file and update the live Kubernetes Secret. Place the new key first.
    # Patch the Secret with new-key,old-key
    FERNET_KEY_B64="$("$PYTHON_BIN" - "$ROTATED_KEY_FILE" <<'PY'
    import base64
    import sys
    
    with open(sys.argv[1], "rb") as key_file:
        print(base64.b64encode(key_file.read()).decode())
    PY
    )"
    
    kubectl -n "$NAMESPACE" patch secret "$SECRET_NAME" --type merge \
      -p "{\"data\":{\"fernet-key\":\"${FERNET_KEY_B64}\"}}"
    unset FERNET_KEY_B64
  15. Restart all Cloudera Workflow Orchestrator deployments so the pods read the updated secret, and wait for all Cloudera Workflow Orchestrator components to become ready before continuing.
    for deployment in $(kubectl -n "$NAMESPACE" get deployments -l "release=$RELEASE" -o name); do kubectl -n "$NAMESPACE" rollout restart "$deployment"
    done
    
    for deployment in $(kubectl -n "$NAMESPACE" get deployments -l "release=$RELEASE" -o name); do kubectl -n "$NAMESPACE" rollout status "$deployment" --timeout=10m
    done
  16. Run airflow rotate-fernet-key command on a single API server pod to re-encrypt stored connections, variables, and trigger data with the first key. Do not run this command concurrently from multiple pods.
    export API_DEPLOYMENT=<API server deployment name>
    kubectl -n "$NAMESPACE" exec "deployment/$API_DEPLOYMENT" -c api-server -- airflow rotate-fernet-key
  17. Verify that decryption works before you remove the old key by completing the following checks:
    • Retrieve a connection that contains a password.
    • Read a variable that contains a sensitive value.
    • Run a DAG that uses a connection or variable.
    • Check the API-server and scheduler logs for Fernet or decryption errors.
  18. Encode the single new key and patch the Kubernetes Secret to remove the old key.
    cp "$NEW_KEY_FILE" "$ROTATED_KEY_FILE"
    chmod 600 "$ROTATED_KEY_FILE"
    test -s "$ROTATED_KEY_FILE"
    
    FERNET_KEY_B64="$("$PYTHON_BIN" - "$ROTATED_KEY_FILE" <<'PY'
    import base64
    import sys
    
    with open(sys.argv[1], "rb") as key_file:
        print(base64.b64encode(key_file.read()).decode())
    PY
    )"
    kubectl -n "$NAMESPACE" patch secret "$SECRET_NAME" --type merge \
      -p "{\"data\":{\"fernet-key\":\"${FERNET_KEY_B64}\"}}"
    unset FERNET_KEY_B64
  19. Restart all Cloudera Workflow Orchestrator deployments again.
    kubectl -n "$NAMESPACE" get deployments -l "release=$RELEASE" -o name
    for deployment in $(kubectl -n "$NAMESPACE" get deployments -l "release=$RELEASE" -o name); do
      kubectl -n "$NAMESPACE" rollout restart "$deployment"
    done
    for deployment in $(kubectl -n "$NAMESPACE" get deployments -l "release=$RELEASE" -o name); do
      kubectl -n "$NAMESPACE" rollout status "$deployment" --timeout=10m
    done
  20. Verify that the same representative DAG still succeeds.