erebe / wstunnel

Tunnel all your traffic over Websocket or HTTP2 - Bypass firewalls/DPI - Static binary available
Other
3.22k stars 290 forks source link

Build for iphoneos aarch64? #36

Closed arinc9 closed 3 years ago

arinc9 commented 4 years ago

It’d be really nice for jailbroken iOS users to connect from wireguard over websocket to bypass restricted networks without taking much of a performance hit.

I can provide you SSH access to a jailbroken iPhone if you’d like to run test builds on.

There’s also this project but I don’t think it uses websocket.

erebe commented 4 years ago

Hello, Sorry but i don't have any hardware with ios, so i don't plan to create à build for it. If you manage to build wstunnel on ios, let me know i can add your build in the release.

P. S: i am in vacation for 3 weeks

arinc9 commented 4 years ago

I’ll try around and see if I can manage to do it. My offer for SSH access of a jailbroken iOS device is still there though.

arinc9 commented 4 years ago

Not trying to give you a hard time on your vacation but I’m kind of new to all this so I’m trying to figure out things. Your project uses Haskell Stack which uses GHC to compile apps. I’m thinking I need to make GHC compile for iphoneos with iOS SDK - which looks like there’s a way for it

Only after that I can take a look at wstunnel to see if anything in the source code needs to be updated to support iOS.

erebe commented 4 years ago

You can just install haskell stack as described in the readme and do a stack setup; stack install If it does not work out of the box, just give up, i will take a look after I get back from vacation if you can still provide me with an ssh access to an iOS env.

arinc9 commented 4 years ago

Sure, drop me your SSH key of your system whenever you're available and I'll set it up for ya.

Edit: Turns out I could get SSH keys over GitHub already. Tell me when you're ready to go and I'll drop the public IP of the server.

erebe commented 4 years ago

Hello, If you can authorize the ssh key below, I will be able to try it out this week-end

https://api.github.com/users/erebe/keys

the one that terminate with YsjT

arinc9 commented 4 years ago

Done! You can reach it at 194.31.59.155 port 2222 or 2221. I've set up different port forwarding for Cellular and Wi-Fi connection so use one of the ports that work at the moment.

erebe commented 4 years ago

image

Working, will take a look at it this weekend :)

arinc9 commented 4 years ago

Fingers crossed!

arinc9 commented 4 years ago

Quick update: I've changed the server and made a solution for multiple ports. You can reach it at 160.20.145.120 port 2222.

Edit: Currently getting issues with the current configuration. I'm working on it.

arinc9 commented 4 years ago

Sorry for the trouble. My solution messed up connection from server to phone. I've reverted it to current configuration. Access it at 160.20.145.120 port 2222 or 2221.

arinc9 commented 4 years ago

Wifi connection must have been on sleep. Try again on port 2222. It should work now.

On 8 Mar 2020 Sun at 16:16 Erèbe - Romain Gerard notifications@github.com wrote:

sadly can't connect to neither port 2222 or 2221

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/erebe/wstunnel/issues/36?email_source=notifications&email_token=AG73CTIVHD2TS6TEDHPXFXDRGOLDZA5CNFSM4KUHCE5KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEOEVZ3A#issuecomment-596204780, or unsubscribe https://github.com/notifications/unsubscribe-auth/AG73CTPU6VEWY7AZILQ5XJTRGOLDZANCNFSM4KUHCE5A .

erebe commented 4 years ago

Sadly can't even manage to have the compiler working :x So I guess it will not be possible ;(

Thanks for providing me the iphone through

arinc9 commented 4 years ago

Are you trying to compile on iOS environment? If so, why not compile it for iphoneos on Linux/MacOS then test the binary on the environment?

On 8 Mar 2020 Sun at 16:29 Erèbe - Romain Gerard notifications@github.com wrote:

Sadly can't even manage to have the compiler working :x So I guess it will not be possible ;(

Thanks for providing me the iphone thought

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/erebe/wstunnel/issues/36?email_source=notifications&email_token=AG73CTODCC473D2X4CG36C3RGOMSRA5CNFSM4KUHCE5KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEOEWCUY#issuecomment-596205907, or unsubscribe https://github.com/notifications/unsubscribe-auth/AG73CTJBWIMBHGQC7VQ5NZLRGOMSRANCNFSM4KUHCE5A .

erebe commented 4 years ago

There is no cross-compilation in haskell, but let me try the macos binary. Maybe it is going to work

arinc9 commented 4 years ago

I tried that, it’s a different architecture. There’re tools for haskell to cross compile, let me find the links.

On 8 Mar 2020 Sun at 16:33 Erèbe - Romain Gerard notifications@github.com wrote:

There is no cross-compilation in haskell, but let me try the macos binary. Maybe it is going to work

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/erebe/wstunnel/issues/36?email_source=notifications&email_token=AG73CTL3QRE6NEKXVCVL42DRGONEHA5CNFSM4KUHCE5KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEOEWGFQ#issuecomment-596206358, or unsubscribe https://github.com/notifications/unsubscribe-auth/AG73CTP6MDOURSV6B6JISB3RGONEHANCNFSM4KUHCE5A .

arinc9 commented 4 years ago

Scripts for cross compilation for example: https://github.com/ghc-ios/ghc-ios-scripts

MobileHaskellFun https://codetalk.io/posts/2018-02-07-Mobile-Haskell.html

erebe commented 4 years ago

Tried all the binaries I got, not working.

For https://github.com/ghc-ios/ghc-ios-scripts it does not work for recent version of ghc, which the project need https://github.com/ghc-ios/ghc-ios-scripts/issues/23

Going to try https://codetalk.io/posts/2018-02-07-Mobile-Haskell.html

erebe commented 4 years ago

nop, Mobile haskell depends on stack, which does work on this arch :(

arinc9 commented 4 years ago

Strange, the MobileHaskell is mostly used for iphoneos. Sounds odd stack won’t work for iphoneos. Let me take a look.

On 8 Mar 2020 Sun at 16:52 Erèbe - Romain Gerard notifications@github.com wrote:

nop, Mobile haskell depends on stack, which does work on this arch :(

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/erebe/wstunnel/issues/36?email_source=notifications&email_token=AG73CTMB4OKTP4UEBNUSGN3RGOPLNA5CNFSM4KUHCE5KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEOEWT6Q#issuecomment-596208122, or unsubscribe https://github.com/notifications/unsubscribe-auth/AG73CTM6VVKTSLKB5CSCM4LRGOPLNANCNFSM4KUHCE5A .

erebe commented 4 years ago

Any luck on your side ?

arinc9 commented 4 years ago

The last few days had been a bit busy, I’m going to make attempts in a moment. I’m still looking forward for this.

On 10 Mar 2020 Tue at 14:02 Erèbe - Romain Gerard notifications@github.com wrote:

Any luck on your side ?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/erebe/wstunnel/issues/36?email_source=notifications&email_token=AG73CTKZTMCBGUG6YNA7BMTRGYM47A5CNFSM4KUHCE5KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEOK6WJA#issuecomment-597027620, or unsubscribe https://github.com/notifications/unsubscribe-auth/AG73CTJZ3NOD6546YREZA43RGYM47ANCNFSM4KUHCE5A .

arinc9 commented 4 years ago

I've been working on setting up the tools for Mobile Haskell. I've made it work, but I'm not sure how can I build wstunnel with aarch64-apple-ios-cabal. You can teamviewer/anydesk my macOS build to see for yourself. Or I can give you ssh access of it.

erebe commented 4 years ago

I can take a look on your macOS with ssh, (I don't have teamviewer or anydesk)

arinc9 commented 4 years ago

MacOS Catalina's SSH server is listening on the same IP with your SSH key, port 2220, I've already compiled and installed libraries/binaries from MobileHaskellFun with the script. The directory of the repo and wstunnel is at ~/Desktop/MobileHaskellFun and ~/Desktop/wstunnel

erebe commented 4 years ago

Didn't had much free time yesterday. I am going to give it a shot today

erebe commented 4 years ago

can't connect

❯ ssh root@194.31.59.155 -p 2220 -i ~/.ssh/erebe_rsa.pub -v OpenSSH_8.2p1, OpenSSL 1.1.1d 10 Sep 2019 debug1: Reading configuration data /home/erebe/.ssh/config debug1: /home/erebe/.ssh/config line 5: Applying options for * debug1: Reading configuration data /etc/ssh/ssh_config debug1: Connecting to 194.31.59.155 [194.31.59.155] port 2220. debug1: connect to address 194.31.59.155 port 2220: Connection refused ssh: connect to host 194.31.59.155 port 2220: Connection refused

arinc9 commented 4 years ago

Go with 160.20.145.120 -p 2220, just fired up the machine.

On 12 Mar 2020 Thu at 17:01 Erèbe - Romain Gerard notifications@github.com wrote:

❯ ssh root@194.31.59.155 -p 2220 -i ~/.ssh/erebe_rsa.pub -v OpenSSH_8.2p1, OpenSSL 1.1.1d 10 Sep 2019 debug1: Reading configuration data /home/erebe/.ssh/config debug1: /home/erebe/.ssh/config line 5: Applying options for * debug1: Reading configuration data /etc/ssh/ssh_config debug1: Connecting to 194.31.59.155 [194.31.59.155] port 2220. debug1: connect to address 194.31.59.155 port 2220: Connection refused ssh: connect to host 194.31.59.155 port 2220: Connection refused

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/erebe/wstunnel/issues/36#issuecomment-598201591, or unsubscribe https://github.com/notifications/unsubscribe-auth/AG73CTPMKRYCUVXFBWVKQK3RHDTK3ANCNFSM4KUHCE5A .

erebe commented 4 years ago

ssh: connect to host 160.20.145.120 port 2220: No route to host

arinc9 commented 4 years ago

Looks like a slight issue with the server. It's fixed, give it a try. P.S. You can also login as arinc9 for non-root processes.

erebe commented 4 years ago

For now, I always fail with a x86_64-apple-ios-ghc: could not execute: opt opt is a binary part of the llvm package. At the time of the article it was using llvm5, but it is not available into brew. So I tried to downgrade from llvm9 to llvm6 but sadly with the same result.

I am trying to understand why it cannot execute opt,

arinc9 commented 4 years ago

Might wanna check PATH, directories of brew’s llvm is probably not in PATH.

On 12 Mar 2020 Thu at 19:38 Erèbe - Romain Gerard notifications@github.com wrote:

For now, I always fail with a x86_64-apple-ios-ghc: could not execute: opt opt is a binary part of the llvm package. At the time of the article it was using llvm5, but it is not available into brew. So I tried to downgrade from llvm9 to llvm6 but sadly with the same result.

I am trying to understand why it cannot execute opt,

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/erebe/wstunnel/issues/36#issuecomment-598288859, or unsubscribe https://github.com/notifications/unsubscribe-auth/AG73CTKK2MHPMDKARPVKKBDRHEFY7ANCNFSM4KUHCE5A .

erebe commented 4 years ago

Already tried it, and also modified the ./call script to add it More likely to me that the call to opt fail for some reason

arinc9 commented 4 years ago

Odd. Instead of using from brew, compiling llvm from source code and installing to the system might help. I’ll give it a shot soon.

On 12 Mar 2020 Thu at 19:52 Erèbe - Romain Gerard notifications@github.com wrote:

Already tried it, and also modified the ./call script to add it

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/erebe/wstunnel/issues/36#issuecomment-598295919, or unsubscribe https://github.com/notifications/unsubscribe-auth/AG73CTOPHWIR7W7R3DJDUZDRHEHMVANCNFSM4KUHCE5A .

arinc9 commented 4 years ago

Just compiled and installed LLVM 9.0.1 to the system. I've sucessfully compiled the mobilehaskell build for iOS. It's all yours.

erebe commented 4 years ago

Going to re-take a look at it. That's kind of the first time that I use a mac, but is this expected that compiling stuff from source works better than with brew ?

arinc9 commented 4 years ago

That’s mostly the case for brew. Brew hasn’t really got devel packages that include headers and libraries. It’s always the best compile and install software from source code.

On 13 Mar 2020 Fri at 10:58 Erèbe - Romain Gerard notifications@github.com wrote:

Going to re-take a look at it. That's kind of the first time that I use a mac, but is this expected that compiling stuff from source works better than with brew ?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/erebe/wstunnel/issues/36#issuecomment-598597091, or unsubscribe https://github.com/notifications/unsubscribe-auth/AG73CTOODHVAW24DZ5JNDMTRHHRSVANCNFSM4KUHCE5A .

erebe commented 4 years ago

I got a ssh: connect to host 160.20.145.120 port 2220: No route to host again. My office is closing due to the coronavirus, I need to move myself back home, so I will look at it this evening/end afternoon (in 6/8 hours).

arinc9 commented 4 years ago

My school’s going to a force break as well. My machine was down. I’ll boot up macOS in a few hours, you can take a look when you get back.

On 13 Mar 2020 Fri at 11:45 Erèbe - Romain Gerard notifications@github.com wrote:

I got a ssh: connect to host 160.20.145.120 port 2220: No route to host again. My office is closing due to the coronavirus, I need to move myself back home, so I will look at it this evening/end afternoon (in 6hours).

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/erebe/wstunnel/issues/36#issuecomment-598612792, or unsubscribe https://github.com/notifications/unsubscribe-auth/AG73CTPOEX7R3Y5BAJVASQ3RHHXENANCNFSM4KUHCE5A .

arinc9 commented 4 years ago

In the meantime I got a question for you. Can I forward both wireguard (51820) and wstunnel socks (8080) over wss (443) connection to the server? I technically should be able to, with setting up --restrictTo on server and -L on the client but wouldn’t that make double websocket connection for socks, adding overhead to it?

EDIT: Running two instances of wstunnel listening locally on two different ports and using Nginx as a reverse proxy solved this issue.

EDIT2: I realized I can run only one server instance and configure client anyway I like.

arinc9 commented 4 years ago

Hey, hope you’re well. You can reach my machine to do a test build anytime, just let me know when you do, so I can get the system ready.

erebe commented 4 years ago

Hello,

Going well yes :) I hope it is the same for you ! Sadly I don't think I will have some spare time to work on it in the incoming days. I got an increase of work due to some colleagues being sicks and in addition due to the quarantine I have to take care of my relatives, so I don't have that much spare time to spend on it.

Let's resume this after the end of the world :rofl:

arinc9 commented 4 years ago

lol not problem at all, I’m just going to try to make a makefile for iOS and see how GHC handles it, you take care!

On 21 Mar 2020 Sat at 17:47 Erèbe - Romain Gerard notifications@github.com wrote:

Hello,

Going well yes :) I hope it is the same for you ! Sadly I don't think I will have some spare time to work on it in the incoming days. I got an increase of work due to some colleagues being sicks and in addition due to the quarantine I have to take care of my relatives, so I don't have that much spare time to spend on it.

Let's resume this after the end of the world 🤣

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/erebe/wstunnel/issues/36#issuecomment-602055386, or unsubscribe https://github.com/notifications/unsubscribe-auth/AG73CTK4AZBVLSMS6Y3T2CDRITHONANCNFSM4KUHCE5A .

arinc9 commented 3 years ago

Hey @erebe, what a crazy year it has been! I'm back at it, researching for cross compiling Haskell projects. This repository in particular caught my attention. Can you give it a look and make sense of it? https://github.com/nicknovitski/stack-haskell-docker-cross-compile

arinc9 commented 3 years ago

@erebe u/angerman on Reddit is working on cross-compilation for iOS. After he figures that out I'll be paying him to explain to you how he cross compiles Haskell projects for armv7 / aarch64-apple-ios, etc.

D4rkTT commented 3 years ago

any luck? i tried a lot with https://codetalk.io/posts/2018-02-07-Mobile-Haskell.html but no luck it always fails while building libraries like transformers-combat and memory libraries. working on macOS big sur on VM, i tried everything, i can compile simple haskell apps but wstunnel always fails

arinc9 commented 3 years ago

@D4rkTT paging @angerman

D4rkTT commented 3 years ago

@D4rkTT paging @angerman

???????

arinc9 commented 3 years ago

They will help you out if they’re interested.

On 29 Apr 2021 Thu at 00:08 DarkT @.***> wrote:

@D4rkTT https://github.com/D4rkTT paging @angerman https://github.com/angerman

???????

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/erebe/wstunnel/issues/36#issuecomment-828780899, or unsubscribe https://github.com/notifications/unsubscribe-auth/AG73CTJSPA74C5GU4JCYJITTLB2LBANCNFSM4KUHCE5A .

angerman commented 3 years ago

Ok. So long story short, we'll soon have proper GHC releases that can use the LLVM backend, and do not blow up on FFI calls.

On an aarch64-darwin mac you can build executables (and libraries) that you can use on the iPhone, however there is one catch, and that is you need to disable large-address-spaces when building your GHC, as that will work on macOS but not on iOS.

The 8.10.5 release is fairly imminent.