인터넷이 되지 않는 환경이라고 가정하고, Container 내부에 tcpdump Package 설치부터 Packet 수집 과정까지 다뤄보겠습니다.
먼저, Container에 접속하는 방법은 다음과 같습니다.
1. POD 명 확인
접속하고자 하는 Container가 있는 POD 이름을 알아야 합니다.
본 예제에서 POD 이름은 vco-app-5fc59f6978-gptxm 입니다.
# kubectl -n prelude get pods NAME READY STATUS RESTARTS AGE abx-service-app-776497ff98-s64vz 2/2 Running 1 7h17m adapter-host-service-app-5d57c784fb-46w9w 1/1 Running 0 7h17m approval-service-app-66cffcf67-pqq49 1/1 Running 0 7h17m <snip> terraform-service-app-78f65b7cb9-rbfnj 2/2 Running 0 7h17m user-profile-service-app-55fffc64cc-lgnzv 1/1 Running 0 7h17m vco-app-5fc59f6978-gptxm 3/3 Running 0 7h17m ### <-- !! |
2. Container명 확인
POD 내에 위치할 수 있는 여러 Container 중 접속할 Container를 확인합니다.
본 예제에서 접속할 Container명은 vco-server-app 입니다.
# kubectl -n prelude describe pod vco-app-5fc59f6978-gptxm Name: vco-app-5fc59f6978-gptxm Namespace: prelude Priority: 0 Node: vra01.contoso.com/192.168.1.73 Start Time: Sat, 16 Sep 2023 20:28:10 +0000 Labels: app=vco-app environment=new pod-template-hash=5fc59f6978 product=prelude <snip> Containers: vco-polyglot-runner: Container ID: docker://126db947fae79696cba0c372610223378acc31c3f66956f006c39a2983bd3fee <snip> vco-server-app: ### <-- !! Container ID: docker://5a5eb2ab66512476e04c9426f32bce173cfa6588f4b22769d879c5acf7548297 <snip> vco-controlcenter-app: Container ID: docker://0fa713440e8f816d0a1e4f8c4a63a0abfefb4a494bf72e4809718194d8eaa2af |
3. Container 접속
kubectl 명령어를 이용하여 특정 POD의 특정 Container에 bash shell로 접근합니다.
# kubectl -n prelude exec -it vco-app-5fc59f6978-gptxm -c vco-server-app -- bash root [ / ]# |
4. Container 나가기
Container에서 빠져나올 때는 exit 명령어를 이용합니다.
root [ / ]# exit exit root@vra01 [ ~ ]# |
이제 Container에 접속하는 방법을 알았으니, 필요한 Package를 다운로드 받아 Container로 옮겨야 합니다.
1. Container OS 확인
VMware에서 제공하는 Appliance 내부의 Container도 마찬가지로 Photon OS를 사용합니다.
# cat /etc/os-release NAME="VMware Photon OS" VERSION="4.0" ID=photon VERSION_ID=4.0 PRETTY_NAME="VMware Photon OS/Linux" ANSI_COLOR="1;34" HOME_URL="https://vmware.github.io/photon/" BUG_REPORT_URL="https://github.com/vmware/photon/issues" |
2. Package 다운로드
Photon OS 4.0에 맞는 rpm 파일을 Repository에서 다운로드 합니다.
3. Package 복사
다운로드 받은 2개의 rpm 파일을 Aria Automation Node로 sftp를 이용하여 업로드 합니다.
업로드 한 파일은 /services-logs/prelude/vco-app/file-logs 경로로 복사합니다.
/services-logs/prelude/vco-app/file-logs를 Container 내부에서 연결되어 있어 손쉽게 Container 내부에서 rpm 파일을 얻을 수 있습니다.
# cp tcpdump-4.99.4-1.ph4.x86_64.rpm /services-logs/prelude/vco-app/file-logs # cp libpcap-1.10.0-1.ph4.x86_64.rpm /services-logs/prelude/vco-app/file-logs |
4. Package 설치
위에서 확인한 Container 내부로 접속하는 방법을 이용하시어, vco-server-app Container에 접속한 후 3번에서 복사한 rpm 파일을 설치합니다.
위에서 말씀드린 대로 Container 내부의 /var/log/collected-logs 디렉토리에 가면 복사한 rpm 파일을 확인할 수 있습니다.
root [ /var/log/collected-logs ]# rpm -i --nodeps tcpdump-4.99.4-1.ph4.x86_64.rpm root [ /var/log/collected-logs ]# rpm -i --nodeps libpcap-1.10.0-1.ph4.x86_64.rpm |
5. 설치 확인
tcpdump가 정상적으로 설치되었는지 확인하기 위해서 tcpdump의 dependency library를 확인합니다.
root [ /var/log/collected-logs ]# which tcpdump /usr/bin/tcpdump root [ /var/log/collected-logs ]# ldd /usr/bin/tcpdump linux-vdso.so.1 (0x00007ffdb31fb000) libcrypto.so.3 => /lib/libcrypto.so.3 (0x00007f6401a85000) libpcap.so.1 => not found libc.so.6 => /lib/libc.so.6 (0x00007f64018bf000) libdl.so.2 => /lib/libdl.so.2 (0x00007f64018b9000) libpthread.so.0 => /lib/libpthread.so.0 (0x00007f6401898000) /lib64/ld-linux-x86-64.so.2 (0x00007f6402163000) |
6. Packet 수집
정상적으로 설치가 된 것으로 확인되어, 테스트로 Packet 수집을 합니다.
root [ /var/log/collected-logs ]# tcpdump -nvvvXi eth0 port 8280 tcpdump: listening on eth0, link-type EN10MB (Ethernet), snapshot length 262144 bytes 04:07:05.320325 IP (tos 0x0, ttl 64, id 45236, offset 0, flags [DF], proto TCP (6), length 52) 10.244.0.1.60190 > 10.244.0.31.8280: Flags [SEW], cksum 0x162e (incorrect -> 0xbb51), seq 3391080900, win 65001, options [mss 1383,nop,nop,sackOK,nop,wscale 7], length 0 0x0000: 4500 0034 b0b4 4000 4006 7408 0af4 0001 E..4..@.@.t..... 0x0010: 0af4 001f eb1e 2058 ca1f c9c4 0000 0000 .......X........ 0x0020: 80c2 fde9 162e 0000 0204 0567 0101 0402 ...........g.... 0x0030: 0103 0307 .... 04:07:05.320343 IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto TCP (6), length 52) 10.244.0.31.8280 > 10.244.0.1.60190: Flags [S.E], cksum 0x162e (incorrect -> 0x79dc), seq 2676793943, ack 3391080901, win 65001, options [mss 1383,nop,nop,sackOK,nop,wscale 7], length 0 0x0000: 4500 0034 0000 4000 4006 24bd 0af4 001f E..4..@.@.$..... 0x0010: 0af4 0001 2058 eb1e 9f8c a257 ca1f c9c5 .....X.....W.... 0x0020: 8052 fde9 162e 0000 0204 0567 0101 0402 .R.........g.... 0x0030: 0103 0307 |
위와 같이 Packet을 수집하게 되면 Kubernetes 내부의 Ingress Controller 뒤쪽에 위치한 Container 내에서 Packet을 수집하기 때문에 앞단의 https가 아닌 http Packet들을 확인할 수가 있습니다.
따라서, http error code와 관련된 Troubleshooting을 진행할 때 관련 Container를 확인한 후에 해당 Container 내에서 Packet을 수집하여 Encrypt 되지 않은 http Packet을 분석에 활용할 수 있습니다.
'Management' 카테고리의 다른 글
Clustered Deployment of Aria Automation (0) | 2023.10.30 |
---|---|
Unable to deploy telegraf agent remotely (0) | 2023.10.27 |
[vRA] Missing Transport Zones in Aria Automation (0) | 2023.09.12 |
[LogInsight] Cassandara Database 접속 방법 및 기본 정보 조회 (0) | 2023.08.06 |
[Operations] Custom 인증서 생성 및 교체 방법 (0) | 2023.08.06 |