Add Global Rules

Global rules allow you to enforce and track block rules that have a global scope over all protected computers in your network. Currently, this feature is only available for block rules. Generally, use the following steps to create global rules:

  1. Create and configure an ApplicationControlGlobalRule object.
  2. Use an ApplicationControlGlobalRuleApi object to create the global rule on Deep Security Manager.

Also see the Create and add new global rules operation in the API Reference. For more information about global rules, see the Deep Security Help Center.

The following example adds software to the Global Rules.

Python
source
# Create the rules
new_rules = []
for sha256 in sha256_list:
    new_rule = api.ApplicationControlGlobalRule()
    new_rule.sha256 = sha256
    new_rules.append(new_rule)

try:
    # Add the rules
    global_rules_api = api.GlobalRulesApi(api.ApiClient(configuration))
    rules_list = api.ApplicationControlGlobalRules()
    rules_list.application_control_global_rules = new_rules
    return global_rules_api.add_global_rules(rules_list, api_version)

except api_exception as e:
    return "Exception: " + str(e)
JavaScript
source
// Create the rules
const globalRules = new api.ApplicationControlGlobalRules();
globalRules.applicationControlGlobalRules = sha256List.map(sha256 => {
  const newRule = new api.ApplicationControlGlobalRule();
  newRule.sha256 = sha256;
  return newRule;
});

// Add the rules
const globalRuleApi = new api.GlobalRulesApi();
globalRuleApi.addGlobalRules(globalRules, apiVersion)
.then(rules => {
  resolve(rules);
})
.catch(error => {
  reject(error);
});
Java
source
// Create global rules
ApplicationControlGlobalRules globalRules = new ApplicationControlGlobalRules();
for (String sha256 : sha256List) {
    ApplicationControlGlobalRule globalRule = new ApplicationControlGlobalRule();
    globalRule.setSha256(sha256);
    globalRules.addApplicationControlGlobalRulesItem(globalRule);
}

// Add the global rules
GlobalRulesApi globalRulesApi = new GlobalRulesApi();
return globalRulesApi.addGlobalRules(globalRules, apiVersion);