gor version: 1.3.0
Environment:
- Operating System: Ubuntu (running 6.8 kernel)
- Kernel Version:
6.8.0-52-generic #53-Ubuntu SMP PREEMPT_DYNAMIC Sat Jan 11 00:06:25 UTC 2025 x86_64
- Architecture:
x86_64
- Environment Type: Cloud VM (e.g., DigitalOcean, based on earlier context)
Description of the Issue:
We are attempting to use gor --input-raw to capture unencrypted HTTP traffic flowing over the loopback interface (lo/127.0.0.1) on our server. Specifically, traffic from Caddy proxying to PHP-FPM (configured to listen on TCP 127.0.0.1:9000).
Despite confirming that traffic is flowing correctly on the target loopback port and interface and that the underlying libpcap library is functional for loopback capture using other tools, gor fails to capture any packets and does not create the specified output file or print anything to stdout when configured to do so.
Steps to Reproduce (on the affected server environment):
-
Ensure PHP-FPM is configured to listen on 127.0.0.1:9000 (TCP) on the loopback interface.
(Confirmed this setup is active and listening via lsof -i :9000 | grep LISTEN)
-
Configure a web server (like Caddy) on the same machine to proxy requests to this PHP-FPM instance at 127.0.0.1:9000.
-
Ensure traffic is hitting the web server externally, resulting in requests being successfully proxied to 127.0.0.1:9000 internally.
(Confirmed by Caddy access logs showing HTTP 200 status responses from PHP-FPM for PHP requests, and telnet 127.0.0.1 9000 working).
-
Run gor with --input-raw targeting the loopback address and port, and outputting to a file (or stdout):
# Example using file output, run as root or with sudo
sudo gor --input-raw 127.0.0.1:9000 --output-file /tmp/capture.gor -verbose 9
(Also tried --input-raw localhost:9000, --output-stdout, removing -append, and targeting different directories like user's home and /var/log).
-
Send requests to the web server while gor is running.
-
Observe the output file location or stdout.
Observed Behavior:
gor starts and prints initialization info (Interface: lo, BPF Filter: ((tcp dst port 9000) and (dst host 127.0.0.1 or dst host ::1)), Version 1.3.0).
- The
gor process successfully starts and stays running (Sl+ state confirmed by ps aux).
- The specified output file (
/tmp/capture.gor in this example, or files in other attempted directories) is never created.
- No captured data is printed to stdout when
--output-stdout is used.
- No error messages are printed by
gor to its own output during execution or upon Ctrl+C.
Expected Behavior:
gor should capture the TCP traffic flowing to 127.0.0.1:9000 on the loopback interface and write the captured requests (extracted HTTP from the FastCGI stream) to the specified output.
Diagnostic Findings (Crucial Information):
- PHP-FPM is listening on
127.0.0.1:9000: Confirmed by lsof -i :9000.
- Caddy is successfully connecting and communicating with PHP-FPM on
127.0.0.1:9000: Confirmed by Caddy access logs showing HTTP 200 statuses for requests proxied to PHP-FPM, and telnet 127.0.0.1 9000 successfully connects.
- Traffic is visible and capturable on the loopback interface targeting port 9000 at the
libpcap level by other tools: Confirmed by sudo tcpdump -i lo 'tcp port 9000' -nn -vvvv successfully showing the TCP handshake and data packets flowing between Caddy's ephemeral port and 127.0.0.1:9000 when requests are sent. This proves libpcap works on lo on this system.
- Manual file creation works with the user running
sudo in /tmp and other directories where gor was unable to create the output file.
- A simpler loopback capture test with
nc also failed with gor:
- Running
nc -l 8080 and sending traffic with echo ... | nc 127.0.0.1 8080 confirmed traffic arrived at 8080.
- Running
sudo gor --input-raw :8080 --output-stdout -v 9 simultaneously with the nc test showed no output from gor, confirming a failure to capture/output any loopback traffic, not just FastCGI, on this system using gor.
- System logs show no errors related to
gor or pcap: sudo journalctl -f (watched during gor run and request sending) shows no relevant denial or error messages from gor's PID, pcap, AppArmor, SELinux (checked status, seem inactive or not logging denials here), or kernel.
Conclusion from Diagnostics:
The issue is not with traffic flow, basic libpcap functionality on lo, or simple file permissions. Given that tcpdump -i lo works while gor --input-raw lo fails even for simple nc traffic and fails to create any output file despite the process running, it strongly suggests a specific incompatibility, bug, or environment interaction within the gor 1.3.0 binary on this Ubuntu kernel version (6.8.0-52-generic) that prevents it from capturing or processing loopback traffic correctly and/or writing any output.
Any insights or suggestions for further debugging steps would be greatly appreciated.
gor version: 1.3.0
Environment:
6.8.0-52-generic #53-Ubuntu SMP PREEMPT_DYNAMIC Sat Jan 11 00:06:25 UTC 2025 x86_64x86_64Description of the Issue:
We are attempting to use
gor --input-rawto capture unencrypted HTTP traffic flowing over the loopback interface (lo/127.0.0.1) on our server. Specifically, traffic from Caddy proxying to PHP-FPM (configured to listen on TCP127.0.0.1:9000).Despite confirming that traffic is flowing correctly on the target loopback port and interface and that the underlying
libpcaplibrary is functional for loopback capture using other tools,gorfails to capture any packets and does not create the specified output file or print anything to stdout when configured to do so.Steps to Reproduce (on the affected server environment):
Ensure PHP-FPM is configured to listen on
127.0.0.1:9000(TCP) on the loopback interface.(Confirmed this setup is active and listening via
lsof -i :9000 | grep LISTEN)Configure a web server (like Caddy) on the same machine to proxy requests to this PHP-FPM instance at
127.0.0.1:9000.Ensure traffic is hitting the web server externally, resulting in requests being successfully proxied to
127.0.0.1:9000internally.(Confirmed by Caddy access logs showing HTTP 200 status responses from PHP-FPM for PHP requests, and
telnet 127.0.0.1 9000working).Run
gorwith--input-rawtargeting the loopback address and port, and outputting to a file (or stdout):# Example using file output, run as root or with sudo sudo gor --input-raw 127.0.0.1:9000 --output-file /tmp/capture.gor -verbose 9(Also tried
--input-raw localhost:9000,--output-stdout, removing-append, and targeting different directories like user's home and /var/log).Send requests to the web server while
goris running.Observe the output file location or stdout.
Observed Behavior:
gorstarts and prints initialization info (Interface:lo, BPF Filter:((tcp dst port 9000) and (dst host 127.0.0.1 or dst host ::1)), Version 1.3.0).gorprocess successfully starts and stays running (Sl+state confirmed byps aux)./tmp/capture.gorin this example, or files in other attempted directories) is never created.--output-stdoutis used.gorto its own output during execution or uponCtrl+C.Expected Behavior:
gorshould capture the TCP traffic flowing to127.0.0.1:9000on the loopback interface and write the captured requests (extracted HTTP from the FastCGI stream) to the specified output.Diagnostic Findings (Crucial Information):
127.0.0.1:9000: Confirmed bylsof -i :9000.127.0.0.1:9000: Confirmed by Caddy access logs showing HTTP 200 statuses for requests proxied to PHP-FPM, andtelnet 127.0.0.1 9000successfully connects.libpcaplevel by other tools: Confirmed bysudo tcpdump -i lo 'tcp port 9000' -nn -vvvvsuccessfully showing the TCP handshake and data packets flowing between Caddy's ephemeral port and127.0.0.1:9000when requests are sent. This proveslibpcapworks onloon this system.sudoin/tmpand other directories wheregorwas unable to create the output file.ncalso failed withgor:nc -l 8080and sending traffic withecho ... | nc 127.0.0.1 8080confirmed traffic arrived at 8080.sudo gor --input-raw :8080 --output-stdout -v 9simultaneously with thenctest showed no output fromgor, confirming a failure to capture/output any loopback traffic, not just FastCGI, on this system usinggor.gororpcap:sudo journalctl -f(watched during gor run and request sending) shows no relevant denial or error messages fromgor's PID,pcap, AppArmor, SELinux (checked status, seem inactive or not logging denials here), or kernel.Conclusion from Diagnostics:
The issue is not with traffic flow, basic
libpcapfunctionality onlo, or simple file permissions. Given thattcpdump -i loworks whilegor --input-raw lofails even for simplenctraffic and fails to create any output file despite the process running, it strongly suggests a specific incompatibility, bug, or environment interaction within thegor1.3.0 binary on this Ubuntu kernel version (6.8.0-52-generic) that prevents it from capturing or processing loopback traffic correctly and/or writing any output.Any insights or suggestions for further debugging steps would be greatly appreciated.