https://github.com/cilium/cilium
Revision cf3cc16289b7621c7b3aff93d7d6eab94b309921 authored by Anton Protopopov on 28 November 2022, 15:14:40 UTC, committed by Jarno Rajahalme on 28 November 2022, 18:10:19 UTC
In case of TCP this is not enough to do net.Dial + setsockopt(SO_MARK), as in
this case TCP SYN will have a wrong identity, e.g.:

    Policy verdict log: flow 0x7a95a133 local EP ID 393, remote ID 14616, proto 6, egress, action redirect, match L3-L4, 10.244.1.122:42437 -> 10.244.1.120:53 tcp SYN
    Policy verdict log: flow 0x907eaa19 local EP ID 458, remote ID host, proto 6, ingress, action allow, match L3-Only, 172.19.0.2:56276 -> 10.244.1.120:53 tcp SYN

Here the second message has wrong identity (host). We still allow the traffic,
as the origin is local host and the coredns is running on the same host, but
this will not work for a remote host if ingress policy doesn't allow
remote-node identity.) To fix this we need to pass a Control parameter to Dial,
so that setsockopt(2) is called before the connect(2). With such a change we
now see the correct identity in case of TCP:

    Policy verdict log: flow 0xeb7902a9 local EP ID 393, remote ID 14616, proto 6, egress, action redirect, match L3-L4, 10.244.1.122:36661 -> 10.244.1.120:53 tcp SYN
    Policy verdict log: flow 0x4efbc5a0 local EP ID 458, remote ID 41903, proto 6, ingress, action allow, match L3-L4, 172.19.0.2:40508 -> 10.244.1.120:53 tcp SYN

Fixes: 44c1def67854 ("fqdn: dnsproxy: forward the original security identity")

Signed-off-by: Anton Protopopov <aspsk@isovalent.com>
1 parent 8264fd4
History
Tip revision: cf3cc16289b7621c7b3aff93d7d6eab94b309921 authored by Anton Protopopov on 28 November 2022, 15:14:40 UTC
fqdn: dnsproxy: fix forwarding of the original security identity for TCP
Tip revision: cf3cc16
File Mode Size
.github
.nvim
.travis
.vscode
Documentation
api
bpf
bugtool
cilium
cilium-health
clustermesh-apiserver
contrib
daemon
envoy
examples
hack
hubble-relay
images
install
jenkinsfiles
operator
pkg
plugins
proxylib
test
tools
vendor
.authors.aux -rw-r--r-- 416 bytes
.clomonitor.yml -rw-r--r-- 984 bytes
.gitattributes -rw-r--r-- 689 bytes
.gitignore -rw-r--r-- 1.7 KB
.golangci.yaml -rw-r--r-- 3.1 KB
.mailmap -rw-r--r-- 5.6 KB
.travis.yml -rw-r--r-- 492 bytes
AUTHORS -rw-r--r-- 32.5 KB
CODEOWNERS -rw-r--r-- 23.0 KB
CODE_OF_CONDUCT.md -rw-r--r-- 2.2 KB
CONTRIBUTING.md -rw-r--r-- 473 bytes
FURTHER_READINGS.rst -rw-r--r-- 6.4 KB
GO_VERSION -rw-r--r-- 7 bytes
LICENSE -rw-r--r-- 11.1 KB
MAINTAINERS.md -rw-r--r-- 4.3 KB
Makefile -rw-r--r-- 30.8 KB
Makefile.defs -rw-r--r-- 7.3 KB
Makefile.docker -rw-r--r-- 6.9 KB
Makefile.quiet -rw-r--r-- 818 bytes
README.rst -rw-r--r-- 17.0 KB
SECURITY.md -rw-r--r-- 629 bytes
USERS.md -rw-r--r-- 24.5 KB
VERSION -rw-r--r-- 8 bytes
Vagrantfile -rw-r--r-- 14.7 KB
go.mod -rw-r--r-- 11.7 KB
go.sum -rw-r--r-- 158.7 KB
netlify.toml -rw-r--r-- 92 bytes
stable.txt -rw-r--r-- 8 bytes
vagrant_box_defaults.rb -rw-r--r-- 394 bytes

README.rst

back to top