Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Add `cf pcap` command to facilitate multi-instance packet captures

Đang mở
#3,738 4 bình luận 2 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
30/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
go
Lĩnh vực
cli, networking

Hướng nghiên cứu

Bắt đầu với RFC0048 và giao diện lệnh cf pcap được đề xuất, sau đó kiểm tra các pattern lệnh và SSH hiện có của CLI. Đánh giá dependency pure-Go github.com/gopacket/gopacket và hành vi stream của /tmp/lifecycle/cf-pcap. Được xem là hoàn thành khi các flags đã được tài liệu hóa, việc hợp nhất packet từ nhiều instance, xử lý Ctrl-C và báo cáo output hoạt động như mô tả.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Introduce a new cf pcap command that captures network traffic directly from running application container instances via SSH. This provides operators and developers with a native way to debug networking issues without needing to manually SSH into containers and perform the packet capture.

This is part of RFC0048.

Motivation

With the new cf-pcap feature in diego, app developers can perform packet captures themselves without privileged support from the operator (if enabled). Currently, this requires an understanding of the implementation details of these packet captures which should not be the case. The user should be able to perform packet captures through the same interface as all the other actions, hence a new CLI command. Since this a core feature of diego I opted for a built-in command as opposed to a plugin.

Proposed Changes
New command: cf pcap
cf pcap APP_NAME [--process PROCESS] [-i INDEX]
   [-o OUTPUT_FILE] [--filter FILTER] [--interface INTERFACE]
   [--snaplen SNAPLEN] [--skip-host-validation]

Flags:

Flag Default Description
--process web App process type to capture from
-i, --app-instance-index all instances Specific instance index (omit to capture from all running instances)
-o, --output capture.pcap Output file path
--filter (none) BPF filter expression passed to cf-pcap
--interface eth0 Network interface to capture on
--snaplen 0 (cf-pcap default) Snapshot length for captured packets
-k, --skip-host-validation false Skip SSH host key validation

Behavior:

  • Requires an org and space to be targeted
  • When -i is omitted, captures from all instances simultaneously
  • Opens SSH connections to each target instance and runs /tmp/lifecycle/cf-pcap remotely
  • Streams pcap-formatted data over SSH stdout, parses individual packets using gopacket, and merges packets from all instances into a single output .pcap file
  • Capture runs until the user presses Ctrl-C, at which point SIGINT is forwarded to the remote processes and the SSH sessions are torn down after a 5-second grace period
  • Displays the output file path and size on completion

To allow merging the packet streams the github.com/gopacket/gopacket dependency needs to be added. I intend to only use the pure Go parts (no cgo) to keep building / installing the CLI simple.

Ngôn ngữ chính
Go
Star
1.9k
Fork
989
Merge trung bình
1 ngày 18 giờ
Pull request đã merge (30 ngày)
5

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của cloudfoundry/cli

Tất cả issue của cloudfoundry/cli

Issue tương tự

Thêm issue về Go

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.