This article describes a procedure for creating a custom application and using that application in a security policy. Both GUI and CLI versions of the procedure are presented.
The goal of this article is to provide a procedure to:
There are three basic steps to create a custom application and to apply it to a security policy:
Create the custom application if no pre-defined applications encompass the protocol or ports needed.
For this example we will configure a policy to permit a custom application using TCP port 1500 from "local-net" 192.168.10.0/24 to "remote-net" 192.168.20.0/24.
trust
local-net
192.168.10.0/24
or
untrust
remote-net
For more information, refer to Configuring Address Books and Address Sets .
CLI:
root@SiteA#set security zones security-zone trust address-book address local-net 192.168.10.0/24 root@siteA#set security zones security-zone untrust address-book address remote-net 192.168.20.0/24
tcp1500
tcp
1500
For more information refer to Understanding Custom Policy Applications and Adding and Modifying Custom Policy Applications.
root@SiteA#set applications application tcp1500 protocol tcp root@SiteA#set applications application tcp1500 destination-port 1500
Note: If allowing all applications to traverse the Policy, then no custom application is needed since the pre-defined application “any” already exists, which allows all ports.
J-Web :
Zone Direction
untrust.
policy-tr-unt
Policy Action
root@SiteA#set security policies from-zone trust to-zone untrust policy policy-tr-unt match source-address local-net root@SiteA#set security policies from-zone trust to-zone untrust policy policy-tr-unt match destination-address remote-net root@SiteA#set security policies from-zone trust to-zone untrust policy policy-tr-unt match application tcp1500 root@SiteA#set security policies from-zone trust to-zone untrust policy policy-tr-unt then permit
The ordering of policies is important. J Series or SRX Series devices will perform policy lookup from top to bottom until a match is found. At that point no further policy lookup occurs. Therefore if a deny all policy exists, then be sure that the policy created is above the deny all policy. If not, then the policy will never be reached. To re-arrange policy order, use the Move up or down option in the Security Policies screen in J-Web or the insert command in CLI. For more information, consult KB10120 - How to change the order of the policies on a J Series or SRX Series device [juniper.net] .
deny all
insert
applications { application tcp_port_5000 { protocol tcp; destination-port 5000; } application tcp_port_5001 { protocol tcp; destination-port 5001; } }
[security policies] from-zone inside to-zone outside { policy telnet_100 { match { source-address any; destination-address host_public; application tcp_port_5000; } then { permit } } policy telnet_101 { match { source-address any; destination-address host_public; application tcp_port_5001; } then { permit } } }