Skip to content
GitLab
探索
项目
群组
代码片段
项目
群组
代码片段
/
帮助
帮助
支持
社区论坛
快捷键
?
提交反馈
登录
切换导航
菜单
打开侧边栏
wazuh
Fwknop
提交
8a73e6de
提交
8a73e6de
编辑于
12年前
作者:
Michael Rash
浏览文件
操作
下载
电子邮件补丁
差异文件
updated PF anchor check to not rely on listing the PF policy
上级
5c26c0ab
变更
2
隐藏空白变更内容
行内
左右并排
显示
2 个更改的文件
server/fw_util_pf.c
+6
-19
server/fw_util_pf.c
server/fw_util_pf.h
+1
-1
server/fw_util_pf.h
有
7 个添加
和
20 个删除
+7
-20
server/fw_util_pf.c
+
6
-
19
浏览文件 @
8a73e6de
...
...
@@ -91,17 +91,16 @@ static int
anchor_active
(
const
fko_srv_options_t
*
opts
)
{
int
res
=
0
;
char
*
ndx
=
NULL
;
char
anchor_search_str
[
MAX_PF_ANCHOR_SEARCH_LEN
]
=
{
0
};
/* Build our anchor search string
*/
snprintf
(
anchor_search_str
,
MAX_PF_ANCHOR_SEARCH_LEN
-
1
,
"%s
%s
\"
"
,
"anchor
\"
"
,
opts
->
fw_config
->
anchor
);
snprintf
(
anchor_search_str
,
MAX_PF_ANCHOR_SEARCH_LEN
-
1
,
"%s
\n
"
,
opts
->
fw_config
->
anchor
);
zero_cmd_buffers
();
snprintf
(
cmd_buf
,
CMD_BUFSIZE
-
1
,
"%s "
PF_
LIST_ALL_RULES
_ARGS
,
snprintf
(
cmd_buf
,
CMD_BUFSIZE
-
1
,
"%s "
PF_
ANCHOR_CHECK
_ARGS
,
opts
->
fw_config
->
fw_command
);
...
...
@@ -113,23 +112,11 @@ anchor_active(const fko_srv_options_t *opts)
return
0
;
}
/*
first check for the anchor at the very first rule position
/*
Check to see if the anchor exists and is linked into the main policy
*/
if
(
strncmp
(
cmd_out
,
anchor_search_str
,
strlen
(
anchor_search_str
))
!=
0
)
{
anchor_search_str
[
0
]
=
'\0'
;
/* look for the anchor in the middle of the rule set, but make sure
* it appears only after a newline
*/
snprintf
(
anchor_search_str
,
MAX_PF_ANCHOR_SEARCH_LEN
-
1
,
"%s%s
\"
"
,
"
\n
anchor
\"
"
,
opts
->
fw_config
->
anchor
);
ndx
=
strstr
(
cmd_out
,
anchor_search_str
);
if
(
ndx
==
NULL
)
return
0
;
}
if
(
strstr
(
cmd_out
,
anchor_search_str
)
==
NULL
)
return
0
;
return
1
;
}
...
...
This diff is collapsed.
Click to expand it.
server/fw_util_pf.h
+
1
-
1
浏览文件 @
8a73e6de
...
...
@@ -40,7 +40,7 @@
#define PF_ADD_RULE_ARGS "pass in quick proto %u from %s to any port %u keep state label " EXPIRE_COMMENT_PREFIX "%u"
#define PF_WRITE_ANCHOR_RULES_ARGS "-a %s -f -"
#define PF_LIST_ANCHOR_RULES_ARGS "-a %s -s rules 2>&1"
#define PF_
LIST_ALL_RULES
_ARGS "-s
rules
2>&1"
/* to check for fwknop anchor */
#define PF_
ANCHOR_CHECK
_ARGS
"-s
Anchor
2>&1"
/* to check for fwknop anchor */
#define PF_DEL_ALL_ANCHOR_RULES "-a %s -F all 2>&1"
#endif
/* FW_UTIL_PF_H */
...
...
This diff is collapsed.
Click to expand it.
编辑
预览
支持
Markdown
0%
请重试
或
添加新附件
.
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录
菜单
探索
项目
群组
代码片段