A firewall policy failure from CSO towards a SRX device occurs with the following error message:
Policy deploy report Dynamic-application junos:UDP does not contain any default ports, please add a more restrictive application to the policy and remove \"junos-defaults\"!
Attempted to configure the following firewall policy:
This configuration was created by CSO for the above intent:
set security address-book global address 10.4.0.0/16 10.4.0.0/16
delete security policies from-zone LAN-LAN to-zone LAN-LAN
delete security policies from-zone LAN-LAN to-zone LAN-LAN policy ALLOW_LAN_1
set security policies from-zone trust to-zone trust policy r023_1 match source-address 10.4.0.0/16
set security policies from-zone trust to-zone trust policy r023_1 match destination-address any
set security policies from-zone trust to-zone trust policy r023_1 match dynamic-application junos:UDP
set security policies from-zone trust to-zone trust policy r023_1 match application junos-defaults
set security policies from-zone trust to-zone trust policy r023_1 then permit
delete security policies from-zone trust to-zone trust policy ALLOW_LAN_1
delete security policies from-zone LAN-LAN to-zone trust
delete security policies from-zone LAN-LAN to-zone trust policy ALLOW_LAN_1
delete security policies from-zone trust to-zone LAN-LAN
delete security policies from-zone trust to-zone LAN-LAN policy ALLOW_LAN_
This configuration failed on the device with the following error:
This means dynamic-application should be more specific, and not just junos:UDP or junos:TCP
The following text is from the technical documentation on Unified Security policies
Starting in Junos OS Release 18.2R1, the junos-defaults option is introduced in the security policy configuration as application match criteria. The junos-defaults group contains preconfigured statements that include predefined values for common applications. As the default protocols and ports are inherited from junos-defaults , there is no requirement to explicitly configure the ports and protocols, thus simplifying the security policy configuration.
junos-defaults
In the following example, the security policy L7-test-policy uses junos:HTTP as the dynamic application and inherits destination TCP ports: 80, 3128, 8000, and 8080 as the application match criteria.
junos:HTTP
set security policies from-zone trust to-zone untrust policy L7-test-policy match application junos-defaults dynamic-application junos:HTTP
This means that "junos-defaults" defines predefined values for common applications. APPS object in CSO UI is for Layer 7 applications and SRVS object in CSO UI is for Layer 4 services.
If the requirement and intention of a firewall policy is to allow any UDP application, then the correct intent definition would be:
The translated Junos configuration would be:
set security policies from-zone trust to-zone trust policy r023_1 match dynamic-application any
set security policies from-zone trust to-zone trust policy r023_1 match application junos-udp-any
delete security policies from-zone trust to-zone LAN-LAN policy ALLOW_LAN_1