fiddyschmitt / File-Tunnel

Tunnel TCP connections through a file
MIT License
850 stars 71 forks source link

Needs signing to run on macOS #19

Open kim0 opened 1 month ago

kim0 commented 1 month ago
$ ft -h
Killed: 9
$ uname -a
Darwin MBP.local 23.5.0 Darwin Kernel Version 23.5.0: Wed May  1 20:12:58 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T6000 arm64

Happy to help test different binaries if there's a way to make it work

fiddyschmitt commented 1 month ago

Thanks for the info Ahmed!

I'm not very familiar with Macs. What is the model of the laptop? What version of OSX are you running?

kim0 commented 1 month ago

It's an Apple M1 pro macbook running MacOS 14.5 (23F79) (latest) Update: I could get it to run. This was needed

$ xattr -d com.apple.quarantine ~/Downloads/ft  # Remove attribute
$ codesign --force --deep --sign - ~/Downloads/ft  # Sign the binary (this will only work on my machine)

I think you can use GitHub actions runners for MacOS to verify the binary can at least run there.

It still doesn't seem to work very well. For example, it shows two mismatching version numbers 2.1 and 1.0.0.0 and when invoked with -h to just show the help message, it should do that and exit. Instead it does not exit, it just waits there, and I have to kill it via Ctrl+C

$ ~/Downloads/ft -h
8/9/2024 12:40:29 PM: File Tunnel 2.1.0
ft 1.0.0.0
Copyright ©  2023

ERROR(S):
  Option 'h' is unknown.

  --tcp-listen        Listen for TCP connections. Example --tcp-listen 127.0.0.1:11000

  --tcp-connect       Connect to a TCP server. Example --tcp-connect 127.0.0.1:22

  --read-duration     The duration (in milliseconds) to read data from a TCP connection. Larger values increase throughput (by reducing the number of small writes to file), whereas smaller values improve responsiveness.

  --udp-listen        A local address on which to listen for UDP data. Example --udp-listen 127.0.0.1:11000

  --udp-send-to       Forwards data to a UDP endpoint. Example --udp-send-to 192.168.1.50:12000

  --udp-send-from     A local address which UDP data will be sent from. Example --udp-send-from 192.168.1.1:11000

  -w, --write         Where to write data to. Example: --write "\\nas\share\1.dat"

  -r, --read          Where to read data from. Example: --read "\\nas\share\2.dat"

  -p, --purge-size    The size (in bytes) at which the file should be emptied and started anew. Setting this to 0 disables purging, and the file will grow indefinitely.

  --tunnel-timeout    The duration (in milliseconds) to wait for responses from the counterpart. If this timeout is reached, the tunnel is considered offline and TCP connections will be closed at this point.

  -v, --version       Print the version and exit.

  --help              Display this help screen.

  --version           Display version information.

^C
fiddyschmitt commented 1 month ago

Awesome info, thanks Ahmed. I didn't know about GitHub actions runners - I'll check it out :)

kim0 commented 1 month ago

Update this works very well on macos. I've established tunnels and pushed data through it, works beautifully. It would still be great to figure out this codesign'ing thing so that users don't have to do it. The slightly weird behaviours I had noticed (two version numbers, the cli not exiting after -h) also happen on Windows, so it seems to be expected behaviour. Thanks for such a great tool!

fiddyschmitt commented 1 month ago

That's great! And thanks so much :)

DUOLabs333 commented 4 weeks ago

It turns out that this is a known issue with C#: https://github.com/dotnet/sdk/issues/34917

As a stopgap measure, you could either run signing on a runner, or use rcodesign.

fiddyschmitt commented 4 weeks ago

Interesting! Thanks @DUOLabs333