Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] iptables traffic hijacking에서 iptables 몇 계층까지 처리 되는지? #13

Closed
opp-13 opened this issue Sep 25, 2024 · 1 comment
Assignees
Labels
question Further information is requested Season1 Season1 Study
Milestone

Comments

@opp-13
Copy link
Collaborator

opp-13 commented Sep 25, 2024

Question / 질문 내용
https://jimmysong.io/en/blog/istio-pod-process-lifecycle/
위 링크에서 설명해주다시피 Sidecar auto-injection이 실행될 시 Init container가 먼저 실행되며 Pod에 traffic interception을 위해 iptables를 주입합니다.

그러면 iptables에서 몇 계층까지 처리 되는지 궁금합니다.

위 그림과 같이 iptables가 적용된 것 같은데 어떤 레이어 까지 들어가는지 확인이 안됩니다.

Context / 상황 설명

What I've Tried / 시도한 방법
질문에 대한 답을 찾기 위해 시도해본 방법이 있다면 설명해주세요

아래 블로그를 보면 아마도 TCP인 듯 합니다. 다만 좀 시간이 지난 블로그인지라 명령어가 안 먹히네요
https://andrewpage.tistory.com/83

Resources / 관련 자료
질문과 관련된 문서, 링크, 코드 등이 있다면 여기에 첨부해주세요

Additional context / 추가 사항
기타 추가적인 정보나 생각이 있다면 여기에 작성해주세요

@opp-13 opp-13 added the question Further information is requested label Sep 25, 2024
@ByeongHunKim ByeongHunKim added this to the Milestone1 milestone Sep 25, 2024
@ByeongHunKim ByeongHunKim added the Season1 Season1 Study label Sep 25, 2024
@opp-13 opp-13 mentioned this issue Oct 2, 2024
@opp-13
Copy link
Collaborator Author

opp-13 commented Oct 2, 2024

결론적으로 말하자면 L4까지 처리됩니다.

위의 그림에서 INPUT 체인을 트리거하는 Netfilter의 NF_IP_LOCAL_IN 후에 ip_local_deliver_finish 함수가 있는데 그 함수의 주 업무는 입력된 ip 패킷 헤더의 protocol 필드를 기반으로 해서 적절한 프로토콜 헨들러를 찾고 핸들러에게 패킷을 전달하는 역할을 가집니다. 즉 L3에서 L4로 패킷을 전송하는 역할을 가지고 있고 커널에서 NF_HOOK함수에 인자로 ip_local_deliver_finish 함수가 담겨서 실행되기 때문에 L4계층까지는 확실히 처리 됩니다.

다만 NF_HOOK함수는 아직 살펴보지 않아서 엄밀한 의미의 iptables 동작은 확인 못 했습니다.
iptables는 결국 netfilter hook이 걸릴 때마다 호출되는데 이 페이지도 같이 보시면 좋을 듯 합니다.

@opp-13 opp-13 closed this as completed Oct 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested Season1 Season1 Study
Projects
Status: Done
Development

No branches or pull requests

3 participants