openvpn 및 lxc를 사용하는 nftable

openvpn 및 lxc를 사용하는 nftable

nftables 기반 방화벽을 설정하려는 LXC 컨테이너(debianstretch 호스트, debianbuster 컨테이너)에 OpenVPN 서버와 관련된 간단한 설정이 있습니다.

나를 혼란스럽게 하는 것은 nftables가 특정 IP 또는 /32 마스크를 사용하더라도 10.52.1.0/24 서브넷의 모든 트래픽에 대해 Saddr을 캡처할 수 없다는 것입니다.

나는 nftables가 내 트래픽을 다음과 같이 취급한다는 것을 발견했습니다.캡슐화, 비록 Tap52 인터페이스(순수한 openvpn 인터페이스 10.52.0.0/16)를 수신하도록 설정했다고 생각합니다.

내가 뭐 잘못 했어요?

내 nftables.conf는 매우 간단합니다.

#!/usr/sbin/nft -f

flush ruleset

table inet filter {

    chain input_tap52 {
        type filter hook input priority 0;
        ip saddr 10.52.1.0/24 drop # This doesn't work
        #drop # This works
        meta nftrace set 1
    }

    chain forward_tap52 {
        type filter hook forward priority 0; policy drop;
    }

    chain output_tap52 {
        type filter hook output priority 0; policy accept;
    }

}

nft 모니터 추적은 다음과 같은 출력을 제공합니다.

trace id beade08f inet filter input_tap52 rule nftrace set 1 (verdict continue)
trace id beade08f inet filter input_tap52 verdict continue 
trace id beade08f inet filter input_tap52 
trace id d46433ce inet filter input_tap52 packet: iif "eth0" ether saddr 00:16:3e:00:00:00 ether daddr 00:16:3e:c3:6d:fb ip saddr 46.134.**.** ip daddr 10.0.3.253 ip dscp cs0 ip ecn not-ect ip ttl 53 ip id 0 ip protocol udp ip length 42 udp sport 3423 udp dport openvpn udp length 22 @th,64,96 17369369003734387519951732736 

답변1

좋습니다. 그래서 저는 몇 가지 잘못된 가정을 했습니다.

1) "input_"에 인터페이스 이름을 추가하면 해당 인터페이스의 트래픽이 자동으로 필터링된다는 내용을 읽었는데 이는 잘못된 것입니다.

2) 캡슐화된 트래픽이 표시되지만 유효한 "10.52.0.0/16" 패킷, 특히 브로드캐스트 패킷도 있습니다.

그래서 마침내 나는 이것을 기억했습니다. https://serverfault.com/questions/736274/openvpn-client-to-client

할 수 있게 하다고객 대 고객패킷 만들기보이지 않는커널에. 제 경우에는 이것이 문제입니다.

관련 정보