From cf998c96b6f10b18c7d0dcabd4d8f8a7ba689298 Mon Sep 17 00:00:00 2001 From: Jen Bammel <135041996+cisco-jbammel@users.noreply.github.com> Date: Thu, 2 May 2024 14:06:39 -0400 Subject: [PATCH] Updating policy files to reflect the current Duo Desktop policy structure (#267) * Update policies.py to use Duo Desktop section The Duo Desktop section replaced the device_health_app section in the official admin API docs, but this example was never updated to reflect that. This commit updates this to use the correct section. * Update policies_advanced.py to use Duo Desktop The Duo Desktop section replaced the device_health_app section in the official admin API docs, but this example was never updated to reflect that. This commit updates this to use the correct section. * Remove the prompt_to_install, its not a param anymore * Ensuring the prompt_to_install param isn't there, as that got removed * Ensuring the old device_health_app function is still there for backwards compatibility * Ensuring device_health_app function is maintained for backwards compatibility --- examples/Admin/policies.py | 17 ++++++++++++----- examples/Admin/policies_advanced.py | 18 ++++++++++++------ 2 files changed, 24 insertions(+), 11 deletions(-) diff --git a/examples/Admin/policies.py b/examples/Admin/policies.py index 031720f..fd3262a 100755 --- a/examples/Admin/policies.py +++ b/examples/Admin/policies.py @@ -82,15 +82,22 @@ def update_policy_with_device_health_app(policy_key, print_response=False): """ Update a given policy to include Duo Device Health App policy settings. Requires Access or Beyond editions. + NOTE: this function is deprecated, please use update_policy_with_duo_desktop + """ + return update_policy_with_duo_desktop(policy_key, print_response) + +def update_policy_with_duo_desktop(policy_key, print_response=False): + """ + Update a given policy to include Duo Desktop policy + settings. Requires Access or Beyond editions. """ json_request = { "sections": { - "device_health_app": { + "duo_desktop": { "enforce_encryption": ["windows"], "enforce_firewall": ["windows"], - "prompt_to_install": ["windows"], - "requires_DHA": ["windows"], + "requires_duo_desktop": ["windows"], "windows_endpoint_security_list": ["cisco-amp"], "windows_remediation_note": "Please install Windows agent", }, @@ -139,8 +146,8 @@ def main(): policy_key_a = create_empty_policy("Test New Policy - a") policy_key_b = create_empty_policy("Test New Policy - b") - # Update policy with Duo Device Health App settings. - update_policy_with_device_health_app(policy_key_b) + # Update policy with Duo Desktop settings. + update_policy_with_duo_desktop(policy_key_b) # Create an empty policy and delete it. policy_key_c = create_empty_policy("Test New Policy - c") diff --git a/examples/Admin/policies_advanced.py b/examples/Admin/policies_advanced.py index 82bb30d..7117de0 100755 --- a/examples/Admin/policies_advanced.py +++ b/examples/Admin/policies_advanced.py @@ -85,20 +85,26 @@ def bulk_delete_section(policy_keys, print_response=False): pretty = json.dumps(response, indent=4, sort_keys=True, default=str) print(pretty) - def update_policy_with_device_health_app(policy_key, print_response=False): """ Update a given policy to include Duo Device Health App policy settings. Requires Access or Beyond editions. + NOTE: this function is deprecated, please use update_policy_with_duo_desktop + """ + return update_policy_with_duo_desktop(policy_key, print_response) + +def update_policy_with_duo_desktop(policy_key, print_response=False): + """ + Update a given policy to include Duo Desktop policy + settings. Requires Access or Beyond editions. """ json_request = { "sections": { - "device_health_app": { + "duo_desktop": { "enforce_encryption": ["windows"], "enforce_firewall": ["windows"], - "prompt_to_install": ["windows"], - "requires_DHA": ["windows"], + "requires_duo_desktop": ["windows"], "windows_endpoint_security_list": ["cisco-amp"], "windows_remediation_note": "Please install Windows agent", }, @@ -148,8 +154,8 @@ def main(): policy_key_a = create_empty_policy("Test New Policy - a") policy_key_b = create_empty_policy("Test New Policy - b") - # Update policy with Duo Device Health App settings. - update_policy_with_device_health_app(policy_key_b) + # Update policy with Duo Desktop settings. + update_policy_with_duo_desktop(policy_key_b) # Create an empty policy and delete it. policy_key_c = create_empty_policy("Test New Policy - c")