Security Policies · Topic 3 of 3

Unified Security Policies

Learn SRX unified security policies: dynamic-application match, AppID signature packages, the pre-ID default policy and how the final policy is chosen.

  • 6 min
In a nutshell
  • A unified policy is a zone-based or global policy with a match dynamic-application.
  • AppID identifies the application from signatures, not ports; the signature package and license are required.
  • Dynamic application values: junos:<NAME>, custom signatures, any or none.

What it is

A unified security policy is a security policy that also matches on the Layer 7 application, identified from the traffic itself, instead of only on ports. You add a dynamic-application match, such as junos:FACEBOOK-ACCESS, to an ordinary zone-based or global policy.

The SRX identifies the application with application identification (AppID), using a downloadable signature package. Unified policies were introduced in Junos OS 18.2R1 and bring application control into the same policy rule base instead of a separate application firewall.

First packetsPotential policiesfrom addresses and portsAppID identifiesFinal policyfor that applicationAction

How it works

Traditional compared with unified

Traditional policyUnified policy
MatchesZones, addresses, application (protocol and port)The same, plus dynamic-application
Identifies traffic byPort numbersSignatures in the payload
ExampleTCP 443 to anyFacebook, on whatever port it uses
Decision timeFirst packetAfter the application is identified

A policy with no dynamic-application, or with dynamic-application none, behaves as a traditional policy.

Configuring a unified policy

security {
    policies {
        from-zone trust to-zone untrust {
            policy BLOCK-FACEBOOK {
                match {
                    source-address any;
                    destination-address any;
                    application any;
                    dynamic-application junos:FACEBOOK-ACCESS;
                }
                then {
                    deny;
                    log {
                        session-init;
                    }
                }
            }
            policy ALLOW-WEB {
                match {
                    source-address any;
                    destination-address any;
                    application [ junos-http junos-https ];
                }
                then {
                    permit;
                }
            }
        }
    }
}

The first policy in set form:

user@srx# set security policies from-zone trust to-zone untrust policy BLOCK-FACEBOOK match source-address any
user@srx# set security policies from-zone trust to-zone untrust policy BLOCK-FACEBOOK match destination-address any
user@srx# set security policies from-zone trust to-zone untrust policy BLOCK-FACEBOOK match application any
user@srx# set security policies from-zone trust to-zone untrust policy BLOCK-FACEBOOK match dynamic-application junos:FACEBOOK-ACCESS
user@srx# set security policies from-zone trust to-zone untrust policy BLOCK-FACEBOOK then deny

Dynamic-application values

ValueMeaning
junos:<NAME>A predefined application or application group from the signature package, such as junos:FACEBOOK-ACCESS
A custom application signatureAn application you defined for AppID
anyAny identified application
noneNo Layer 7 match; the policy works as a traditional policy

The application match is still required. With a dynamic application, it is usually any. The value junos-defaults instead limits the match to the default ports of the identified application.

The AppID signature package

AppID needs the application signature package installed on the device, which also requires the matching license.

CommandPurpose
request services application-identification downloadDownloads the latest signature package
request services application-identification installInstalls the downloaded package
show services application-identification versionShows the installed package version
show services application-identification application summaryLists the applications the device can identify

Without the package, a policy that references junos: applications cannot identify them.

How the final policy is chosen

The first packet of a session does not yet reveal the application. AppID usually needs a few packets, so the SRX matches in two stages.

  1. Potential match: using zones, addresses and ports, the SRX finds every policy the session could match, including unified policies whose application is not known yet. The session is allowed to continue so AppID can see more packets.
  2. Identification: AppID classifies the traffic, for example as Facebook.
  3. Final match: the SRX now picks the first policy, in order, whose dynamic application also matches, and applies its action and services.
First packetzones addresses portsPotential match listmore packetsAppID resultFinal policypermit or deny

In the example, a web session first matches both BLOCK-FACEBOOK and ALLOW-WEB as potential policies. If AppID identifies Facebook, BLOCK-FACEBOOK is the final policy and the session is denied. If it identifies a normal website, BLOCK-FACEBOOK no longer matches and ALLOW-WEB permits it.

The pre-ID default policy

Before the application is known, the SRX may not have a final policy for the session. The pre-ID default policy controls how such sessions are handled during classification, such as their timeout and logging.

user@srx# set security policies pre-id-default-policy then log session-close

Logging at session close here is useful when sessions end before AppID finishes, because they would otherwise leave no policy log.

Order still matters

Unified policies follow the same rules as other policies: one context per zone pair (or the global list), top to bottom, first final match wins. Place specific unified policies, such as a block for one application, above broader port-based permits in the same context.

Monitoring

show security policies detail shows each policy's dynamic applications. show security flow session extensive shows the identified application and the policy a session finally matched. show security policies hit-count shows which unified policies are being used.

Exam tip

When a unified block policy does not work, check three things: the signature package is installed, the policy sits above any broader permit in the context, and the dynamic application name is the one AppID really reports for that traffic.

Common mistakes

Expecting the decision on the first packet. A unified policy needs the application to be identified, which takes several packets; until then the session is handled through potential matches and the pre-ID default policy.

Forgetting the signature package. Without the AppID package and license, junos: applications cannot be identified.

Leaving out the application match. Every policy needs application, even when it also has dynamic-application; use any or junos-defaults.

Placing the unified block below a broad permit. The broad permit is the first final match, so the application block never wins.

Watch out

dynamic-application none is not "block everything". It means the policy does not match on Layer 7 at all and behaves as a traditional policy.

What to remember for the exam

  • A unified policy is a zone-based or global policy with a match dynamic-application.
  • AppID identifies the application from signatures, not ports; the signature package and license are required.
  • Dynamic application values: junos:<NAME>, custom signatures, any or none.
  • application is still required; junos-defaults limits the match to the application's default ports.
  • The SRX builds a potential match list, waits for AppID, then applies the first final match.
  • The pre-ID default policy handles sessions before the application is identified.
  • Unified policies were introduced in Junos OS 18.2R1.

Check yourself

  • Why can a unified policy not decide on the first packet of a session?

    The application is not identified yet. AppID needs several packets before the final policy can be chosen.

  • What does dynamic-application none mean in a policy?

    The policy does not match on Layer 7 and behaves as a traditional policy.

  • A unified policy blocking junos:FACEBOOK-ACCESS sits below a policy permitting junos-https. Is Facebook over HTTPS blocked?

    No. The HTTPS permit is the first final match, so the session is permitted before the block is reached.

Topic 3 of 3 in Security Policies

Test yourself on Security Policies

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.