Skip to content

Commit

Permalink
Updating policy files to reflect the current Duo Desktop policy struc…
Browse files Browse the repository at this point in the history
…ture (#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
  • Loading branch information
cisco-jbammel authored May 2, 2024
1 parent 2ca810a commit cf998c9
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 11 deletions.
17 changes: 12 additions & 5 deletions examples/Admin/policies.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
},
Expand Down Expand Up @@ -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")
Expand Down
18 changes: 12 additions & 6 deletions examples/Admin/policies_advanced.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
},
Expand Down Expand Up @@ -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")
Expand Down

0 comments on commit cf998c9

Please sign in to comment.