Suricata: nf_queue: 가득 참, 패킷 삭제

Suricata: nf_queue: 가득 참, 패킷 삭제

NFQUEUE 모드에서 Suricata IDS를 사용하고 있습니다.

iptables -A PREROUTING -m mark ! --mark 0x1/0x1 -m comment --comment "Suricata NFQUEUE handler" -j NFQUEUE --queue-num 0 --queue-bypass

오늘 한동안 서버 포트를 사용할 수 없었으며 다음 위치에 이 메시지가 나타납니다 kern.log.

18:51:53 up02-lb kernel: nf_queue: full at 4096 entries, dropping packets(s)

어떻게 늘릴 수 있나요? 에 추가한 sysctl 매개변수에 의해 제어되지 않습니다 . 이것이 도움이 될지 모르겠습니다 /proc/net/netfilter/nfnetlink_queue.max-pending-packetssuricata.yaml

답변1

이 값은 Suricata에 의해 설정됩니다. suricata.yaml의 "max-pending-packets"를 사용하고 4를 곱합니다.

int r = NFQInitThread(ntv, (max_pending_packets * NFQ_BURST_FACTOR));
if (r != TM_ECODE_OK) {

그 중 NFQ_BURST_FACTOR는 4이다. 보다https://github.com/inliniac/suricata/blob/71a3c4caac22b475c09ee2f082f11d443dc02cc0/src/source-nfq.c#L712

suricata.yaml의 값을 늘릴 수 있습니다. max-pending-packets를 4096으로 설정하면 다음과 유사한 출력이 표시됩니다.

[6146] 7/6/2016 -- 20:31:12 - <Info> -- binding this thread 0 to queue '0'
[6146] 7/6/2016 -- 20:31:12 - <Info> -- setting queue length to 16384

시도해 볼 수 있는 또 다른 방법은 "Failed Open" 지원을 활성화하는 것입니다. 이는 커널 측에서 Suricata가 따라잡을 수 없을 때 NFQ가 패킷을 전달한다는 것을 의미합니다. 그러나 이로 인해 일부 패킷이 검사되지 않으므로 보안 위험이 발생합니다.

suricata.yaml에서:

# On linux >= 3.6, you can set the fail-open option to yes to have the kernel
# accept the packet if suricata is not able to keep pace.
nfq:
#  mode: accept
#  repeat-mark: 1
#  repeat-mask: 1
#  route-queue: 2
#  batchcount: 20
#  fail-open: yes

마지막 열기의 주석 처리를 제거하면 결함 열기 지원이 활성화됩니다.

페일오픈을 활성화하기 전에 대기열 길이를 늘리는 것이 좋습니다.

관련 정보