# Manage Rules

Review Understanding Sysdig Secure Rules to get started.

## Access the Rules Library

1. Select Policies > Rules Library.

2. The Rules Library is displayed.

Tips:

• Rules are listed alphabetically by name.

• Search: Click the magnifying glass if the Search field is not automatically opened. Search by words in the rule name.

## Create a Rule

There are different interfaces for creating Falco rules vs. Fast rules.

### Create a Falco Rule

1. From the Rules Library page, click +Add Rule and select Falco from the drop-down.

The New Rule page for the Falco rule type is displayed.

2. Enter the parameters:

Name and Description: create a name and a meaningful description for the rule

Condition and Output: write the condition code and outputs required. See Supported Fields for more information.

Priority:This is a required field to meet the falco rule syntax.

Source: Define if the rule is detecting events using the Kubernetes Audit data source or using the standard syscall mechanisms

Tags: Select relevant tags from the drop-down or add your own custom tag

3. Click Save.

### Note

Falco rules with the source k8s_audit need Kubernetes Audit logging enabled for conditions to be met.

### Create a Fast Rule: Container Type

Fast rules are essentially whitelist/blacklist rules.

Suppose you want to itemize particular Cassandra database images to be allowed in the environment and blacklist any that have not been specified. In this case, a Container rule would be appropriate. (The other Fast rule types have similar entry fields, as appropriate to their type.)

1. From the Rules Library page, click +Add Rule and select Container from the drop-down.

The New Rule page for the Container rule type is displayed.

2. Enter the parameters:

Name: Enter a Name, e.g. Allowed Cassandra Images.

Description: Enter a Description, e.g. List of permitted Cassandra images; all other to be blacklisted

If Matching/ If Not Matching: In this case, select If Not Matching to automatically trigger blacklist action for any Cassandra containers that don't match the entries below.

Containers: Add the allowed Cassandra container names, e.g. cassandra.myorg.3.0.

Tags: Select relevant tags from the dropdown, e.g. database and container.

3. Click Save.

## Edit a Rule

Any rules published by Sysdig are default and are read-only. You can append to their lists and macros, but cannot change the core parameters. Default rules cannot be deleted.

Self-created rules can be freely edited. You can also override the behavior of default Falco rules and macros using a placholder mechanism in the Rules Editor.

To display existing rules:

1. Select Policies>Rules Library and select a rule.

2. The Rule Details panel opens on the right. You can review the parameters and append to macros and lists inline if desired.

### Append to Falco Macros and Lists

Default Falco rules have a variety of macros and lists embedded in them. While these cannot be deleted from a default rule, you can append additional information onto them.

For example, consider the Policy DB Program Spawned Process in the screenshot above. The embedded rule is used to check that databases have not spawned illicit processes. You can see in the rule condition the Falco list : db_server_binaries.

To append items in a default list:

1. Click the blue list text in the rule condition, or go to Policies > Falco Lists and search for it by name.

2. The list content is displayed. Click Append.

3. Enter the additional items (i.e. databases) you want to include in the rule and click Save .

The same process applies to macros.

### How to Use the Rules Editor

The Rules Editor allows you can freely create custom Falco rules, lists, and macros and can override the behavior of the defaults.

#### Understand the Interface

To access the interface, select Policies > Rules Editor:

The Right Panel (Default)

Displays the rules_yamls provided from Sysdig.

• Contains the default rules and macros

Displays the custom rules and overrides you want to add to the selected rules_yaml.
Note that many default Falco rules and macros have a parallel placeholder entry (commented out) in the yaml file. These have the prefix user_known. To change the behavior of a default rule, it is recommended to copy the placeholder equivalent into the custom rules panel and edit it there, rather than editing the default rule directly.
Click inside the Rules Editor right panel and use CNRL F to open an internal search field .