Configure the Web Reputation module to define its behavior for a policy. When designing
the module’s behavior and implementing it using the API, use the background information
and guidance that is provided in Block access to malicious URLs with Web Reputation.
Policy objects contain two objects that you use to configure the Web Reputation module:
WebReputationPolicyExtension
: Controls the module state (on or off).PolicySettings
: Policy settings include many Web Reputation-related settings that control the runtime behavior of the module, such as the allowed and blocked URLs and domains, the ports to monitor, security level, and the use of Smart Protection Server.
The following JSON represents the data structure of a
WebReputationPolicyExtension
object:{ "state": "off", "moduleStatus": {...} }
The
moduleStatus
property is read-only. It provides the runtime status of the Web Reputation module.
(See Report on Computer Status.)General steps
Generally, use the following steps to configure the Web Reputation module:
Procedure
- Create a
WebReputationPolicyExtension
object and set the properties. - Create a
PolicySettings
object to configure runtime settings of the module. - Create a
Policy
object and add theWebReputationPolicyExtension
andPolicySettings
objects. - Use a
PoliciesApi
object to add or update the policy on Server & Workload Protection.
What to do next
TipIf you only need to set a single Web Reputation-related policy setting, see Configure a single policy or default policy setting.
|
To turn on the module, create a
WebReputationPolicyExtension
object and set the state:policy_config_web_reputation = api.WebReputationPolicyExtension() policy_config_web_reputation.state = "on"
Create a PolicySettings object to configure Web Reputation-related settings. (For
detailed
information about policy settings, see Configure a single policy or default policy setting.) For example,
you can set the security level:
policy_settings = api.PolicySettings() security_level_setting = api.SettingValue() security_level_setting.value = security_level policy_settings.web_reputation_setting_security_level = security_level_setting
At this point, the Web Reputation policy extension and the policy settings are configured.
Next,
they are added to a
Policy
object. Then, use a
PoliciesApi
object to modify a policy on Server & Workload Protection.policy = api.Policy() policy.web_reputation = policy_config_web_reputation policy.policy_settings = policy_settings policies_api = api.PoliciesApi(api.ApiClient(configuration)) return policies_api.modify_policy(policy_id, policy, api_version)
The
policy_id
(or policyID
) parameter of
modifyPolicy
identifies the actual policy on Server & Workload Protection that is to be modified. This policy
is modified according to the policy object that is used as the
policy
parameter. Any properties of the
policy
parameter that are not set remain unchanged on the
actual policy.Example
The following example creates a
WebReputationPolicyExtension
object, then sets
the web reputation state, security level, and enables Smart Protection Server.
The object is then added to a Policy
object which is used to
modify a policy on Server & Workload Protection.# Enable Web Reputation
policy_config_web_reputation = api.WebReputationPolicyExtension()
policy_config_web_reputation.state = "on"
# Add to a policy
policy = api.Policy()
policy.web_reputation = policy_config_web_reputation
# Set the security level
policy_settings = api.PolicySettings()
security_level_setting = api.SettingValue()
security_level_setting.value = security_level
policy_settings.web_reputation_setting_security_level = security_level_setting
# Enable Smart Protection
smart_protection_allow_global = api.SettingValue()
smart_protection_allow_global.value = True
policy_settings.web_reputation_setting_smart_protection_local_server_allow_off_domain_global = smart_protection_allow_global
# Add the settings
policy.policy_settings = policy_settings
# Modify the policy on Server & Workload Protection
policies_api = api.PoliciesApi(api.ApiClient(configuration))
modified_policy = policies_api.modify_policy(policy_id, policy, api_version)
return modified_policy.id
Also see the Modify a Policy operation in the API Reference. For information
about authenticating API calls, see Authenticate with Server & Workload Protection.