Teramind’s Rules Engine has some advanced features that let you create sophisticated insider threat detection, data loss prevention, and productivity-related rules. In this article, we will discuss how you can leverage some of these advanced features. For more information about policies and rules, check out the Teramind Rules Guide.
Using Rule Logic to Bind Multiple Activities/Content Types, Criteria and Conditions in a Rule
Rule logic binds two or more Condition Blocks, Condition Fields, Criteria or Content Definitions together.
Condition Logic
Rule conditions can use either "OR" logic or "AND" logic.
1. Each value in a criterion uses "OR" logic. In the above example, Condition 1 triggers if the Application Caption equals "Excel" or contains "Notepad". The Rule Summary shows "or" between the values.
2. Each criterion in a condition uses "AND" logic. In the above example, Condition 1 triggers only if the Application Name equals "excel.exe" and the Application Caption matches one of its values.
3. If you have multiple condition blocks, each condition block uses "OR" logic. In the above example, the rule triggers if either Condition 1 or Condition 2 is met. The Rule Summary shows this as "Matches any of 2 conditions".
4. If you use multiple activity types (e.g., Applications and Files), each activity type uses "OR" logic. Each activity type is evaluated independently, which means the rule triggers if the conditions of any activity type are met. In the above example, the rule triggers if the Applications conditions are met or if a file is copied to an external drive. You can see the conditions of each activity type in the Rule Summary.
Content Logic
When you create a Content Sharing rule with more than one content definition, you can choose how the definitions are combined. You can do so under the Advanced logics section of the rule's Content step.
Click the drop-down list under Advanced logics and select one of the following options:
All of these: The rule detects content only when ALL of the definitions are met (AND logic). In the example above, Definition 1 uses the tags field from the File Properties and Definition 2 uses the title field. The rule detects files whose tags equal "CONFIDENTIAL" and whose title contains "PRIVATE", which means files that are both confidential and private.
Any of these: The rule detects content when ANY of the definitions is met (OR logic). Using the same example, the rule detects files whose tags equal "CONFIDENTIAL" or whose title contains "PRIVATE", which means files that are either confidential or private.
The formula next to the list (for example, "1 AND 2") and the Content section of the Rule Summary show how the definitions are combined.
Note: The rule editor in Teramind NextGen doesn’t support the AND NOT and OR NOT logic. Existing rules that use them keep working, but to create or change them, use the rule editor in Teramind Legacy.
Using the Shared Lists in a Rule
Shared Lists allow you to build a list of items that can be shared across rules and configuration settings.
You can create/import and manage Shared Lists from the Configurations > Shared Lists screen. You can build lists of text/keywords, regular expressions, and network addresses/IP addresses.
Shared Lists allow you to detect a large amount of data without having to enter them every time you create a rule. For example, to block access to inappropriate websites, you can create a text-based Shared List containing those sites. They also make it easy to update the rule detection criteria without editing the rules.
Note that not all rule criteria support Shared Lists. For the criteria that do, type part of a Shared List's name in the field, such as "black", and then select one of the list options:
Equals list member: Detects only values that exactly match an item in the list, such as Equals list member Blacklisted Websites.
Matches list member: Detects partial matches, such as Matches list member Blacklisted Websites. For a text list, the value only needs to contain one of the items. For a regular expression list, each item is checked as a regular expression. For a network list, addresses are matched against the networks in the list.
Using Regular Expressions in a Rule
A regular expression (also known as regex or regexp) allows you to detect text using a pattern. It’s a powerful tool that allows you to define complex definitions to find sensitive information such as credit card numbers, invoice numbers, social security numbers, and other texts that follow a pattern or expression. Explaining the full scope of the regular expression is beyond this article. However, there are many online resources you can use to learn about regular expressions. Here, we will show you some quick tips and examples so that you can begin to learn and experiment with them.
Teramind supports regular expressions in rule conditions, configuration settings such as monitoring settings, OCR searches, and more. You can also create a list of regular expressions with Shared Lists.
Rule conditions (including OCR rules) and Shared Lists use a Perl/ECMAScript-style regular expression syntax. However, searches on the OCR screen use the Elasticsearch (Apache Lucene) regular expression syntax. You can find more information about it in the Elastic documentation.
Poorly constructed regular expressions or too much use of them can have performance impact. For example, a regex based on the * (asterisk) and the + (plus sign) is usually slower.
You can use regular expressions in a rule in two ways:
1. Type the regular expression directly in the criterion field, such as (word|excel|powerpoint), and then select Regular expression match /(word|excel|powerpoint)/ from the list.
2. Type part of the name of a Shared List that contains regular expressions, such as "regex", and then select Matches list member followed by the list name, such as Matches list member Design test regex.
Regex Cheat Sheet
The following table lists some of the most commonly used regular expressions including syntax, symbols, range modifiers, special characters, etc.:
| Will match a single character. For example, |
| Will match with any character in the brackets. For example, |
| Is the opposite of |
| Means a range. So, |
| Used to group strings/words together. |
| Will match any of the words/characters in the brackets. Basically, it’s a ‘or’ statement. For example, |
| You cannot search for special characters in a regex directly such as the |
|
|
| Matches the preceding character/word zero or more times. For example, |
| Matches the preceding character/word for at least the min time. For example, |
| Similar to using |
| One or more of the characters or expressions to the left. For example, |
|
|
Regex Examples
Example 1: Matching from a List of Words
Regex |
|
Result | This regex will detect any sentence that contains one of the following phrases:
|
Explanation |
|
Example 2: Finding Invoice/PO Numbers or Other Patterns
Regex |
|
Result | This regex will detect invoice numbers such as:
|
Explanation |
|
Example 3: Detecting a Range of IP Addresses
Regex |
|
Result | This regex will detect any IP (IPv4) addresses within the range of 192.168.0.0 to 192.168.255.255. Note that, while this regex is good for simple purposes, it matches invalid IP addresses too. For example, 192.168.300.999. If you need to detect IP addresses more accurately with proper boundary checks, special ranges, etc., then you will have to use a more complex regex such as: |
Explanation |
|
Example 4: Finding Different Spellings/Variations of a Word
Regex |
|
Result | This regex will detect the word “password” and variations of its spelling that spammers usually use for obfuscations. For example:
|
Explanation |
|
Example 5: Detecting an Email Address
Regex |
|
Result | This regex will detect email addresses from three different vendors and any domain. For example: |
Explanation |
|
Using the Advanced Mode Actions/Risk Thresholds
On a rule's Actions step, the Advanced tab lets you set up risk thresholds. You can add multiple thresholds, give each one its own risk level, and trigger different actions based on how often the rule is violated.
For example, you could create a Files rule that:
Sets a Low risk level and triggers a Warn action after 2 violations in a day.
Escalates to a High risk level and triggers a Block action after 5 violations in a day.
The risk levels you define here are used to calculate the overall risk score, which is reflected in places like the Risk column on the Behavior Alerts dashboard. Alerts saved under a higher risk level add more to the score.
1. From the Choose time period for threshold list, select the time period in which violations are counted, such as Daily.
2. In the Choose maximum numbers of saved alerts per day field, enter the maximum number of alerts that can be saved for this rule in a single day, such as 10. If the number of alerts exceeds this limit, Teramind won't save any further alerts, and they won't appear on the Behavior Alerts dashboard. Leaving the field empty means there's no daily limit. Setting it to 0 prevents any alerts from being saved for the rule, though the rule still triggers. You can also set a global daily limit in Configurations > Settings > Alerts, under Alerts and limits > Maximum daily alerts count.
3. Click New threshold to add a threshold. For each threshold, you can set the following:
a. In the After [number] violation(s) field, enter how many times the rule can be violated before the threshold's actions are triggered, such as 2.
b. From the Define risk level list, select a risk level: No risk, Low, Moderate, High, or Critical.
c. Turn on the actions you want to trigger, such as Warn, and fill in their settings. For example, under Warn, enter a message such as "Copying files to external drives is restricted." Some actions can't be used together. When an action isn't available, you'll see a note such as "Cannot be combined with Warn".
Repeat step 3 to add more thresholds, such as a second threshold that blocks the activity after 5 violations with a High risk level. When more than one threshold has been reached, only the highest one applies. The Actions section of the Rule Summary lists each threshold and its actions.





