|
| 1 | +# Preset Policy - URL lists |
| 2 | + |
| 3 | +Preset policy can also be based on URL lists based instead of IP. This is very useful when dealing with outbound user |
| 4 | +access to internet websites. |
| 5 | + |
| 6 | +## Building a Sanctioned URL List-based policy |
| 7 | + |
| 8 | +For URL category based policy, most of the time a "sanctioned" policy is simply based on the requesting user. |
| 9 | + |
| 10 | +So your policy may look like this: |
| 11 | + |
| 12 | +source user group | destination website |
| 13 | +--- |---------------------| |
| 14 | +Human Resources | www.facebook.com |
| 15 | + |
| 16 | +!!! note |
| 17 | + This automation does not resolve users to user-groups. That's up to you. |
| 18 | + |
| 19 | +## Creating the URL List |
| 20 | + |
| 21 | +Create the URL Category as a URL list in Panorama. |
| 22 | + |
| 23 | + |
| 24 | + |
| 25 | +## Defining the preset security rule |
| 26 | + |
| 27 | +Now, create a new security rule that references the created URL category. |
| 28 | + |
| 29 | +It's up to you how much you "lock down" this policy. You could use specific applications, IPs, ports...whatever makes |
| 30 | +sense for your environment. |
| 31 | + |
| 32 | + |
| 33 | + |
| 34 | +## Create a Policy Tasks File |
| 35 | + |
| 36 | +(for more information on this, see [creating a policy tasks file](preset_policy.md#create-a-policy-tasks-file)) |
| 37 | + |
| 38 | +```yaml title="user_outbound_policy.yml" |
| 39 | +--- |
| 40 | +- name: Match Users Internet Policy |
| 41 | + ansible.builtin.set_fact: |
| 42 | + policy_match: true # Set the fact that we did match a policy |
| 43 | + destination_url_category: PRESET_USER_OUTBOUND_URLS # In this case, the policy preset is a URL Category type |
| 44 | + device_group: Lab # Finally, we set the device group! |
| 45 | + when: |
| 46 | + - "source_user_group == 'Human Resources'" |
| 47 | + - url is defined |
| 48 | +``` |
| 49 | +
|
| 50 | +## Including the policy |
| 51 | +
|
| 52 | +(for more information on this, see [including your sanctioned policy](preset_policy.md#including-the-policy)) |
| 53 | +
|
| 54 | +```yaml title="add_policy.yml" |
| 55 | +# Outbound User access to websites |
| 56 | +- name: Test against outbound user access |
| 57 | + ansible.builtin.include_tasks: |
| 58 | + file: preset/user_outbound_policy.yml |
| 59 | +``` |
| 60 | +
|
| 61 | +## Running the playbook |
| 62 | +
|
| 63 | +Note that nothing changes from the point of execution. You still run the same playbook, and as long as you're including |
| 64 | +`add_policy.yml`, any policies that define a destination_url_category will correctly update the category. |
| 65 | + |
| 66 | +```shell |
| 67 | +ansible-playbook playbooks/orchestrator/lab_policy.yml |
| 68 | +``` |
0 commit comments