我需要的
我有 SRX 1400 @ JUNOS 12.3X48-D40.5
想象一下,除其他外,还有以下区域:UNTRUSTED-CLIENTS、WORLD和INTRANET。
我想阻止所有来自UNTRUSTED-CLIENTSto 的流量WORLD,但我想让用户知道他们被阻止的原因,因此我希望他们被重定向到http://lockmessage.local位于INTRANET.
试图
我创建了一个简单的应用程序防火墙配置文件,它应该匹配所有流量并使用custom-redirect-url指定的拒绝它。然后将此配置文件附加到许可策略。
结果
- 策略与流量正确匹配(如日志所示)
- 用户无法访问
WORLD区域中的任何 URL ,但是... - 用户没有到达指定的 URL,而是超时 :(
UNTRUSTED-USERS和之间没有流量INTRANET被记录
有什么建议?
- 这应该有效,还是我完全错了?
- 可能缺少什么?
- 有没有另一种方法可以实现我想要的?
配置
应用防火墙:
application-firewall {
profile Block-Message-profile {
block-message {
type {
custom-redirect-url {
content http://blockmessage.local;
}
}
}
}
rule-sets Block-Message {
rule Dummy-Policy-Deny-Everything { # I am using any application available, since I need at least one rule;
match {
dynamic-application junos:GOOGLE;
ssl-encryption any;
}
then {
deny {
block-message;
}
}
}
default-rule { # For all other websites - also block
deny {
block-message;
}
}
profile Block-Message-profile;
}
}
之后,策略(省略日志记录以使其整洁):
policies {
from-zone UNTRUSTED-CLIENTS to-zone WORLD {
policy REDIRECT-UNTRUSTED-CLIENTS-TO-BLOCK-URL {
match {
source-address any;
destination-address any;
application [ junos-http junos-https ];
}
then {
permit {
application-services {
application-firewall {
rule-set Block-Message;
}
}
}
}
}
}
from-zone UNTRUSTED-CLIENTS to-zone INTRANET {
policy ALLOW-ACCESS-TO-BLOCK-URL-SERVER {
match {
source-address any;
destination-address BOCK-URL-SERVER;
application [ junos-http junos-https ];
}
then {
permit
}
}
}
}
更新 1
我已经确定了可能提供线索的特定行为。
在监视run show security application-firewall rule-set all命令输出时,我注意到:
- 的数量
sessions redirected始终为零,因此不是重定向无法工作,而是无法触发; - 的数量
sessions matched停留在 的某个旧值85,但不再增长;这很可能是因为我已将父规则限制为application junos-http;该85值可能意味着,在过去,在将策略限制为 之前junos-ssh,其他一些协议可能已经匹配/触发了default rule但不再匹配它;为什么? - 唯一对我的流量做出明显反应的计数器是
Number of sessions with appid pending; - 所有这些会话都正确匹配所讨论的策略,可以使用
show security flow session application-firewall-rule-set Block-Message.
命令的完整列表:
Rule-set: Block-Message
Logical system: root-logical-system
Profile: Block-Message-LAN-Unauthenticated-profile
Rule: Dummy-Policy-Deny-Something
Dynamic Application Groups: junos:web
SSL-Encryption: no
Action:reject or redirect
Number of sessions matched: 0
Number of sessions redirected: 0
Default rule:reject or redirect
Number of sessions matched: 85
Number of sessions redirected: 0
Number of sessions with appid pending: 4