Content Security · Topic 1 of 3

Content Security Policies and Content Filtering

Learn SRX Content Security policies and content filtering for JNCIA-SEC: utm-policy, attaching it to a security policy, rule-sets, file types and actions.

  • 6 min
  • Includes a diagram
In a nutshell
  • Content Security is the new name for UTM; the CLI hierarchy is still security utm.
  • Steps: configure the feature, reference it in security utm utm-policy, attach it with then permit application-services utm-policy.
  • Content filtering since Junos OS 21.4R1: rule-sets and rules under security utm utm-policy <name> content-filtering.

What it is

Content filtering blocks or allows files by their real file type. The SRX looks at the content of the file as it is transferred, not at its name, so renaming setup.exe to report.txt does not get it past the filter.

Content filtering is one of the Content Security features (formerly UTM). Like the others, it is configured inside a Content Security policy under security utm utm-policy, and that policy only takes effect when a security policy that permits the traffic references it.

Session permittedby security policyutm policy attachedContent filteringrule setfile type matchedActionblock or no action

How it works

The Content Security policy framework

Content filtering rule-sets, web filtering, antivirus and antispam are configured under security utm and referenced in UTM policy UTM-OUT, which is attached to security policy WEB-OUT with then permit application-services utm-policy UTM-OUT. Every Content Security feature follows the same three steps.

  1. Configure the feature under security utm.
  2. Reference it in a UTM policy, security utm utm-policy <name>.
  3. Attach the UTM policy to a security policy with then permit application-services utm-policy <name>.
user@srx# set security policies from-zone trust to-zone untrust policy WEB-OUT match source-address any
user@srx# set security policies from-zone trust to-zone untrust policy WEB-OUT match destination-address any
user@srx# set security policies from-zone trust to-zone untrust policy WEB-OUT match application junos-http
user@srx# set security policies from-zone trust to-zone untrust policy WEB-OUT then permit application-services utm-policy UTM-OUT

One UTM policy can hold several features at once: content filtering, web filtering, antivirus and antispam. One UTM policy can also be attached to many security policies.

Content filtering rule-sets

Since Junos OS Release 21.4R1, content filtering uses content-based file type detection with rule-sets and rules configured directly under the UTM policy.

security {
    utm {
        utm-policy UTM-OUT {
            content-filtering {
                rule-set CF-RULES {
                    rule BLOCK-EXE {
                        match {
                            applications http;
                            direction download;
                            file-types exe;
                        }
                        then {
                            action block;
                            notification {
                                log;
                            }
                        }
                    }
                }
            }
        }
    }
}

The same rule in set form:

user@srx# set security utm utm-policy UTM-OUT content-filtering rule-set CF-RULES rule BLOCK-EXE match applications http
user@srx# set security utm utm-policy UTM-OUT content-filtering rule-set CF-RULES rule BLOCK-EXE match direction download
user@srx# set security utm utm-policy UTM-OUT content-filtering rule-set CF-RULES rule BLOCK-EXE match file-types exe
user@srx# set security utm utm-policy UTM-OUT content-filtering rule-set CF-RULES rule BLOCK-EXE then action block
user@srx# set security utm utm-policy UTM-OUT content-filtering rule-set CF-RULES rule BLOCK-EXE then notification log

Match conditions

ConditionMeaning
applicationsThe protocol the file is carried in, such as http, or any
directionupload, download or any
file-typesOne or more file types, detected from the file content

All conditions in a rule must match. When a file arrives, the SRX inspects its content, works out the real type, and compares it with the rules.

Actions

ActionEffect
blockThe file transfer is blocked
close-clientThe connection to the client is closed
close-serverThe connection to the server is closed
close-client-and-serverBoth connections are closed
no-actionThe file is allowed; useful with logging to see what passes

The notification options control what happens around the action. log writes a log message, and an endpoint notification can send a message to the user.

File in transfercontent inspectedReal typeexerule matchesBlockand logFile in transfercontent inspectedReal typeotherno rule matchesAllowed

Older releases

Before Junos OS Release 21.4R1, content filtering was built from separate lists: blocked file extensions, MIME types, content types and protocol commands. Those options are deprecated and hidden in current releases. Configure content filtering with rule-sets under the UTM policy.

Watch out

The old model trusted file names and MIME headers, which the sender controls. The current model reads the file content, so a renamed or mislabeled file is still detected. If an answer choice relies on a "block extension" list, it describes an older release.

Encrypted traffic

Content filtering can only inspect what it can read. For HTTPS, the SRX must decrypt the traffic with SSL proxy before content filtering sees the file. Without it, files inside TLS pass uninspected.

Licensing

Content filtering does not need a separate license. Antivirus, antispam and enhanced web filtering do.

Checking content filtering

Command (operational mode)Shows
show security utm statusWhether the Content Security service is running
show security utm sessionContent Security session counts
show security utm content-filtering statisticsFiles passed and blocked by content filtering
show security policies policy-name WEB-OUT detailWhether the security policy references the UTM policy
Exam tip

Start new rules with no-action and notification log. The log shows which file types really cross the firewall before you begin blocking them.

Common mistakes

Forgetting to attach the UTM policy. A UTM policy that no security policy references inspects nothing.

Attaching it to a deny policy. Content Security runs only on traffic that a security policy permits.

Expecting the file name to decide. The current model detects the type from content. Renaming a file does not change the result.

Configuring old extension lists. Block-extension and MIME lists belong to older releases; current Junos OS uses rule-sets.

Expecting HTTPS files to be filtered without decryption. Encrypted content needs SSL proxy first.

What to remember for the exam

  • Content Security is the new name for UTM; the CLI hierarchy is still security utm.
  • Steps: configure the feature, reference it in security utm utm-policy, attach it with then permit application-services utm-policy.
  • Content filtering since Junos OS 21.4R1: rule-sets and rules under security utm utm-policy <name> content-filtering.
  • Rules match applications, direction and file-types; file type comes from the file content, not its name.
  • Actions: block, close-client, close-server, close-client-and-server, no-action; notification log adds logging.
  • Extension, MIME and protocol-command lists are from older releases.
  • HTTPS content needs SSL proxy before it can be filtered.

Check yourself

  • A user renames tool.exe to tool.txt and downloads it over HTTP. A rule blocks file type exe on download. What happens?

    The download is blocked, because content filtering detects the file type from its content, not its name.

  • A UTM policy with content filtering is configured, but nothing is ever blocked. What is the most likely cause?

    The UTM policy is not attached to the security policy that permits the traffic with application-services utm-policy.

  • Where are content filtering rule-sets configured in current Junos OS?

    Under security utm utm-policy <name> content-filtering, as rule-sets with rules that match applications, direction and file types.

Topic 1 of 3 in Content Security

Test yourself on Content Security

The full Juniper JNCIA-SEC JN0-232 question bank has 658 questions, with timed practice exams and an explanation for every answer.

This study guide is independent and is not affiliated with, endorsed by, or sponsored by Juniper. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.