Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

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

Abierto
#3,738 4 comentarios 2 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 3 días

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
30/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
go
Área
cli, networking

Línea de trabajo

Comienza con RFC0048 y la interfaz de comando cf pcap propuesta; después, inspecciona los patrones existentes de comandos y SSH de la CLI. Evalúa la dependencia pure-Go github.com/gopacket/gopacket y el comportamiento del stream de /tmp/lifecycle/cf-pcap. Se considera terminado cuando los flags documentados, la combinación de paquetes de varias instancias, el manejo de Ctrl-C y la generación de informes de salida funcionan como se describe.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
Go
Estrellas
1.9k
Forks
989
Merge medio
4 d 15 h
PR fusionados (30 d)
8

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de cloudfoundry/cli

Todos los issues de cloudfoundry/cli

Issues similares

Más issues de Go

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.