sandstorm-io / sandstorm

Sandstorm is a self-hostable web productivity suite. It's implemented as a security-hardened web app package manager.
https://sandstorm.io
Other
6.72k stars 705 forks source link

Attempting to use sandstorm with WSL 2 #3365

Open ItsCubeTime opened 4 years ago

ItsCubeTime commented 4 years ago

The issue

Hi, Im attempting to run sandstorm.io inside of WSL 2, I’ve got the software to seemingly run perfectly well and got the point where it gives you your admin-token. However once I put this token into any webbrowser (inside of Windows, as WSL 2 doesn’t support any graphical interfaces, and only lets you use your Linux distribution through bash) I never get any response.

I’ve tried following a WSL 2 guide for port forwarding the ports stated at https://docs.sandstorm.io/en/latest/administering/faq/#what-ports-does-sandstorm-need-open (This guide to be specific: https://www.williamjbowman.com/blog/2020/04/25/running-a-public-server-from-wsl-2/, as well as that I just tried recreating a popular setup/solution from here: https://github.com/microsoft/WSL/issues/4150#issuecomment-504209723 neither of which gave any luck)

At this point I just wanna make sure I just wanna make sure the issue doesn’t lay within sandstorm, do you have any idea why I cant seem to reach the server? Can I run it locally somehow without needing to port forward in the first place just to check that the sandstorm app is really working like expected in the first place?

I created an issue on this on WSLs GitHub where I have a more in depth description of exactly how I set everything up https://github.com/microsoft/WSL/issues/5368

I also tried making a topic about it on your Sandstorm Google Group (Like yesterday), but it haven’t got approved/moderated yet https://groups.google.com/forum/#!forum/sandstorm-dev

Environment

Windows build number: 10.0.19041.264
Your Distribution version: Release:        20.04 (From Microsoft store)
Whether the issue is on WSL 2 and/or WSL 1: WSL 2, Linux version 4.19.104-microsoft-standard (oe-user@oe-host) (gcc version 8.2.0 (GCC)) #1 SMP Wed Feb 19 06:37:35 UTC 2020

Steps to reproduce

Once you're set and running with Ubuntu 20.04 with WSL 2 :

(Following https://sandstorm.io/install )

curl https://install.sandstorm.io | bash

It will give you 2 install options, 1 for a regular install and 2 if you're setting up a development server for developing sandstorm itself or apps for sandstorm, here I choose option 1

1

Then it will ask you if you are sure if you want to install

y

"What *.sandcats.io subdomain would you like?" Pick one (One thats available) ;)

awesomesubdomain

Now it will ask you for an email to assign the sancats.io to, this is for if you loose access to your current device, you can still reclaim your domain with this email, it does not require confirming it, so if you dont wanna use an actual mail adress, just type in something random.

123@gmail.com

After this there are no more steps for the installation (I believe), it will now give you a admin-token link that you are supposed to be able to put in your webbrowser to continue the setup process from there, this is where I've ran into the issue of not getting a response from host when attempting to access it from a Microsoft Edge or Chrome browser running on Windows. I get no response when attempting to go to awesomesubdomain.sandcats.io neither, which is supposed to give some sort of response at all times once you have sandstorm running.

So my first thought was then that this was probably a firewall issue, made some quick google search and found this (Which I then followed) : https://www.williamjbowman.com/blog/2020/04/25/running-a-public-server-from-wsl-2/ replacing his $PORT with 80, 443, 30025 and 6080 (Which are mentioned in the sandstorm.io faq page: https://docs.sandstorm.io/en/latest/administering/faq/#what-ports-does-sandstorm-need-open )

Here are the precise powershell cmds I used (running PowerShell with admin previllegues:

PS C:\WINDOWS\system32> netsh interface portproxy add v4tov4 listenport=6080 listenaddress=0.0.0.0 connectport=6080 connectaddress=127.0.0.1 protocol=tcp

PS C:\WINDOWS\system32> netsh interface portproxy add v4tov4 listenport=30025 listenaddress=0.0.0.0 connectport=30025 connectaddress=127.0.0.1 protocol=tcp

PS C:\WINDOWS\system32> netsh interface portproxy add v4tov4 listenport=443 listenaddress=0.0.0.0 connectport=443 connectaddress=127.0.0.1 protocol=tcp

PS C:\WINDOWS\system32> netsh interface portproxy add v4tov4 listenport=80 listenaddress=0.0.0.0 connectport=80 connectaddress=127.0.0.1 protocol=tcp

For my router portforwarding I enabled all the 4 ports individually going to my PCs main IP (XXX.XXX.X.65 as you can find in my pastebin below) as it told me the Hyper-V Virtual Ethernet Adapters IP "is invalid", maybe this is where my errors lays, are there any other approaches around this? This is the guide I followed (Seems to only be available in Swedish) : https://www.telia.se/privat/support/info/oppna-portar-tradlos-router-sagemcom Here I left External host empty, and set the internal and external port to the ports above (creating a rule for each port individually (making 4 rules total)), leaving the protocol to TCP, service to other and like I said earlier, the internal IP was set to my PCs "main" or regular adress "XXX.XXX.X.65" as it didnt allow me to set it to the Hyper-V adress.

For the firewall I added the following Inbound rule: https://imgur.com/a/0awS3ae (Those separators I used are a , with a regular space after (Which is correct, right?) ). I also noticed that it had already created 2 rules for sandstorm since earlier which opens up all ports for TCP and UDP for a program in the following directory "C:\users\oliver\appdata\local\packages\canonicalgrouplimited.ubuntuonwindows_79rhkp1fndgsc\localstate\rootfs\opt\sandstorm\sandstorm-267\sandstorm". If I try going here in fire explorer however I can only get as far as to "LocalState" where there is a disk image (Which Im guessing is the Ubuntu image?) C:\Users\Oliver\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState https://imgur.com/a/m9HGGoa .

Lastly, Im not using Ubunntu ufw (Firewall for Ubuntu) as this implies:

olliver@Ollivers-Hackintosh:/mnt/c/WINDOWS/system32$ sudo ufw status
[sudo] password for olliver:
Status: inactive

Expected behavior

When you enter the admin-token url in your webbrowser, you should be greeted with this page: https://imgur.com/a/AWJA2JT

Actual behavior

https://imgur.com/a/rx6n1cX

Additional information

System info taken from within Ubuntu: https://pastebin.com/smCCiuLf

System info taken from Windows: https://pastebin.com/766wiJUH

I've made a post for this on sandstorms own Google group as well, its appending approval so Im just going to provide a link to the group itself in case it have appeared by the time someone reads this: https://groups.google.com/forum/#!forum/sandstorm-dev . There you can find some more info (Its posted on my account "Olliver Aira").

If you need any additional information please ask :) I've never setup and portforwarded a home server before so I might just not of grasped some of the basics fully and forgotten something obvious.

Any suggestions on fixes/solutions on my end are very welcome and is why I came here :)

If you happen to know any other places I could post this in (Like any forums? ), I would love to know about them!

zenhack commented 4 years ago

Hey @ItsCubeTime,

WSL is not supported; you need a real Linux system (maybe try setting up a VM). See also:

ocdtrekkie commented 4 years ago

FWIW, @zenhack, WSL 1 is not really Linux, and WSL 2 is actually a running Linux kernel. So in theory, it's a little more likely to be possible to do Sandstorm on WSL 2? But we don't really have anyone who'd be particularly helpful at troubleshooting it. I think I'm the only regular here who runs Windows full-time, and I never use WSL, because it requires Hyper-V, which doesn't play well with VMware/Virtualbox/etc. Also, WSL 2 is super new (Win 10 Version 2004) which I haven't even done preliminary playing with yet.

zenhack commented 4 years ago

I suppose it's worth having a look at the logs. Can you share the contents of /opt/sandstorm/var/log/sandstorm.log?

ItsCubeTime commented 4 years ago

Hey thanks for the replies! 👍

I suppose it's worth having a look at the logs. Can you share the contents of /opt/sandstorm/var/log/sandstorm.log?

https://pastebin.com/0yKbJzgc

FWIW, @zenhack, WSL 1 is not really Linux, and WSL 2 is actually a running Linux kernel. So in theory, it's a little more likely to be possible to do Sandstorm on WSL 2?

https://imgur.com/a/3SXaqIr

ocdtrekkie commented 4 years ago

As a note, sharing that screenshot within 15 minutes is super, super risky, so I hope it is old.

ItsCubeTime commented 4 years ago

Oh I had no idea, should I restart my pc just for the sake of safety or something?

Didnt think about if there was any sensitive info in it

ocdtrekkie commented 4 years ago

I mean, Sandstorm looks like it's running okay according to the log. Port forwarding on your modem and/or router is probably your most important place to look. But like, I don't know if WSL does anything weird with network access that I don't know about.

ItsCubeTime commented 4 years ago

It does create a "Hyper-V Virtual Ethernet Adapter" "Network card" with a different IP than what Windows has, as you can see at the end of this paste:

https://pastebin.com/766wiJUH

ItsCubeTime commented 4 years ago

I tried portforwarding on my router to the IP and mac adress that it creates, but it would tell me it was invalid so I tried using my regular/Windows IP instead.

Maybe I should try portforwarding the ports on my whole home network just temporarily to see if that makes the sandstormio web app reachable?

zenhack commented 4 years ago

Quoting ItsCubeTime (2020-06-09 12:31:40)

Oh I had no idea, should I restart my pc just for the sake of safety or something?

Given that the page is inaccessible anyway, you're probably fine -- like the message says it expires after 15 minutes, so you'll want to generate a new token after that (and then not share it).

But it does look like Sandstorm is starting up ok, so a networking issue seems likely. Can you access sandstorm via another machine on the internal network by punching in http://<local-ip>? You'll likely get an error page from sandstorm, but if it connects that tells you the problem is the port forwarding, otherwise you've got an issue on the machine itself.

ItsCubeTime commented 4 years ago

Given that the page is inaccessible anyway, you're probably fine -- like the message says it expires after 15 minutes, so you'll want to generate a new token after that (and then not share it).

So the only sensitive data would then be the token it generates - and nothing else (other than the subdomain you're using which is all I could spot scanning through my log now in afterhand)?

But it does look like Sandstorm is starting up ok, so a networking issue seems likely. Can you access sandstorm via another machine on the internal network by punching in http://<local-ip>? You'll likely get an error page from sandstorm, but if it connects that tells you the problem is the port forwarding, otherwise you've got an issue on the machine itself.

When I enter the XXX.XXX.X.65 IP (The one going to my pc, and not the virtual ethernet adapter) Chrome tells me "This page isn't working. XXX.XXX.X.65 didn't send any data. ERR_EMPTY_RESPONSE"

When entering the IP for the virtual ethernet adapter created by WSL 2, Im not getting any response at all.

ItsCubeTime commented 4 years ago

So what Im thinking right now is kinda to try opening up 48, 443, 30025 and 6080 to all my devices on my home network (just temporarily).

To do so would I just put 0.0.0.0 as Internal host or, it wont really let me leave it empty it seems (Ignore the port conflict, its stating it because I already have a rule for it setup)? https://imgur.com/a/4SL8hO1

ocdtrekkie commented 4 years ago

So, opening up 30025 is almost certainly pointless, very little with Sandstorm uses it. But you kinda have a double routing issue here:

Your modem/router needs to direct traffic from whatever your HTTP_PORT or HTTPS_PORT is in your sandstorm.conf file, to your computer's IP address. And then somehow your computer then likely needs to forward traffic from that port to the WSL network adapter.

ItsCubeTime commented 4 years ago

Your modem/router needs to direct traffic from whatever your HTTP_PORT or HTTPS_PORT is in your sandstorm.conf file, to your computer's IP address. And then somehow your computer then likely needs to forward traffic from that port to the WSL network adapter.

Im sorry to say it but I've never setup any home servers before (nor port forwarded for the matter), so I have no idea how I would redirect traffic like that.

This is what my current portforwards on my router looks like: https://imgur.com/a/1BQ2DxC

ItsCubeTime commented 4 years ago

Your modem/router needs to direct traffic from whatever your HTTP_PORT or HTTPS_PORT is in your sandstorm.conf file, to your computer's IP address.

I havent modifiedd my sandstorm.conf https://pastebin.com/SgTQi1jC

ocdtrekkie commented 4 years ago

At the bottom of https://www.nextofwindows.com/allow-server-running-inside-wsl-to-be-accessible-outside-windows-10-host is a netsh command for forwarding ports to the Hyper-V adapter for WSL 2.

But yeah, it's gonna be a bit of a challenge here, because you need to validate that your network connection is reachable each step of the way.

From your local machine, you should be able to http://{hyperVadapterIP}:6080 and get something about Sandstorm (an error message).

Although, looking at your conf, is another issue: If this is your home ISP, they might block 80 or 443 inbound. I would maybe try setting your HTTP_PORT to 6080, at least to test with for now, and sudo sandstorm restart, and then, see if http://{hyperVadapterIP}:6080 responds at all.

ItsCubeTime commented 4 years ago

I just noticed something interesting in my routers web app/control panel

https://imgur.com/a/NmMbbIb

It says I have a device connected with an identical IP to my Windows systems IP, but with the last number being a 6 instead of a 5.

Could this maybe be WSL/the Hyper-V adapter?

ocdtrekkie commented 4 years ago

@ItsCubeTime I think that's pretty unlikely. It's probably just another device connected to your network, which isn't publishing a "name".

ItsCubeTime commented 4 years ago

Alright

ItsCubeTime commented 4 years ago

From your local machine, you should be able to http://{hyperVadapterIP}:6080 and get something about Sandstorm (an error message).

When putting this in my browser (On the Windows device Im running WSL on) Im getting this "This page isn’t working right nowXXX.XX.XXX.1 didn’t send any data. ERR_EMPTY_RESPONSE" message again

ocdtrekkie commented 4 years ago

(FYI, if you edit comments on GitHub, the history is still visible. But I doubt that IP is a high-risk thing to have out there, it's internal-only to your network.)

Did you change the HTTP_PORT in your sandstorm.conf to 6080 and restart Sandstorm before trying that? Because the default setting it was at was port 80. If you didn't change it, try http://{hyperVadapterIP} without a port setting.

ItsCubeTime commented 4 years ago

Oh okay, no I did not, removing the port (Or putting in :80 at the end) gives me the same error message

ocdtrekkie commented 4 years ago

Okay, I suspect the answer is somewhere in the details of getting network access to your WSL 2 VM from your Windows machine with the netsh command in the link I put above.

ItsCubeTime commented 4 years ago

Just tried changing the PORT=80 to PORT=6080, which after restarting sandstorm and putting the new port and the current Hyper-V IP in my browser once again gives me "ERR_EMPTY_RESPONSE" like before

ItsCubeTime commented 4 years ago

From https://www.nextofwindows.com/allow-server-running-inside-wsl-to-be-accessible-outside-windows-10-host

If you have already using Bash on Ubuntu on Windows (aka WSL) to do web development you will notice that any server instance running inside the Bash by default can only be accessed via localhost:portnumber. It would be OK if all you need is accessing the web app via the host-only method, meaning go to the address bar of the browser and enter http://localhost:8080. If you need to access WSL server instance outside the host Windows 10, you would found out that it’s not accessible. This is not due to a lack of features or support from Windows Subsystem for Linux, but rather Windows 10, the host doesn’t know which port to open for external access. Unlike some application that requests for firewall permissions when running the app the first time, WSL doesn’t prompt the host to allow for a specific port to open when you start a node or rails server inside the Ubuntu on Windows. Perhaps, in the future release, Microsoft would allow WSL to send a signal to the host when a specific port starts to listen inside WSL. Nonetheless, here is how to allow your server to be accessible externally outside Windows 10’s host machine.

First off, this gives me "ERR_EMPTY_RESPONSE" (in my browser) and gives me the same result of I replace localhost with the Hyper-V adapters IP

From https://www.nextofwindows.com/allow-server-running-inside-wsl-to-be-accessible-outside-windows-10-host :

If you are running with WSL 2, you can find the hyper-v adapter in the network adapters, and all you need is to configure a port forwarding to forward the port like below. netsh interface portproxy add v4tov4 listenport=3000 listenaddress=0.0.0.0 connectport=3000 connectaddress=172.18.28.x

I have already run this in Powershell with admin privileges (Which I found in another guide mentioned in my original issue) https://pastebin.com/GkWdevXQ .

Should what I've set to connectadress=127.0.0.1 actually be connectadress=(My Hyper-V adress)?

xet7 commented 4 years ago

@ItsCubeTime

That 172.18.28.x is internal IP address, similar to those that at Docker internal network.

When using VirtualBox, setting network to Bridged Adapter does give VM it's own IP address on local network and expose it to local network, so it's not going trough Win10 NAT

For similar in HyperV, try this: https://www.how2shout.com/how-to/how-to-create-bridge-network-on-hyper-v-windows-10-step-by-step.html

ItsCubeTime commented 4 years ago

@ItsCubeTime

That 172.18.28.x is internal IP address, similar to those that at Docker internal network.

When using VirtualBox, setting network to Bridged Adapter does give VM it's own IP address on local network and expose it to local network, so it's not going trough Win10 NAT

For similar in HyperV, try this: https://www.how2shout.com/how-to/how-to-create-bridge-network-on-hyper-v-windows-10-step-by-step.html

Thanks for the reply! Tho doesn't this tutorial assume that you can access your server running in WSL 2/Hyper-V (sandstorm) from the Windows machine?

Like I said in my above replies, when attempting to go to MyHyper-VAdapterAdress:6080 (after setting the port to 6080 inside of the sandstorm.conf file ofc) all Im getting is an "empty response" instead of that error screen ocdtrekkie says I should get

ocdtrekkie commented 4 years ago

The connectaddress should be the Hyper-V adapter, I think, and of course, both the connectport and listenport should be 6080. Though I'm not positive: Your WSL 2 VM might actually have a different IP address than your Hyper-V adapter, now that I think about it... have you tried .2 instead of .1 for visiting the web URL?

The IP address on the Hyper-V adapter technically should represent your Windows PC's IP on the virtual network connecting the two, so your Linux VM might have another IP.

ItsCubeTime commented 4 years ago

The connectaddress should be the Hyper-V adapter, I think, and of course, both the connectport and listenport should be 6080. Though I'm not positive: Your WSL 2 VM might actually have a different IP address than your Hyper-V adapter, now that I think about it... have you tried .2 instead of .1 for visiting the web URL? The IP address on the Hyper-V adapter technically should represent your Windows PC's IP on the virtual network connecting the two, so your Linux VM might have another IP. From Ubuntu in WSL 2:

olliver@Ollivers-Hackintosh:/mnt/c/WINDOWS/system32$ ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
inet XXX.XX.XXX.246

Now putting 172.29.162.246:6080 in my browser gives me "Hmmm… can't reach this page172.29.162.246 refused to connect. Search Bing for 172 29 162 246 ERR_CONNECTION_REFUSED"

http://172.29.160.2:6080/ gives me Hmmm… can't reach this page172.29.160.2 took too long to respond Search Bing for 172 29 160 2 ERR_CONNECTION_TIMED_OUT

http://172.29.160.1:6080/ gives me This page isn’t working right now172.29.160.1 didn’t send any data. ERR_EMPTY_RESPONSE

Im going to bed now, I will be back tomorrow to continue attempting to get this sorted.

I will try with re-running those powershell cmds with the connectadress set to my hyper-v adapters IP at some point tomorrow

Kind of annoying that there doesn't seem to be any simple option to make WSL 2 share the same IP as your Windows system just out of the box ._.

ItsCubeTime commented 4 years ago

I just tried setting up an Apache server on my WSL2 which I can access without issues using my Hyper-V adapters inet IP https://imgur.com/a/yg80Xye (Using Edge in Windows)

How come this works but not sandstorm?

ocdtrekkie commented 4 years ago

In theory, it should work the same for Sandstorm as Apache. Especially if you're using port 6080, which is unlikely to collide with other things. (There are sandboxing features I don't know if will work on WSL 2, but the web interface you should definitely be able to get on WSL 2.)

ItsCubeTime commented 4 years ago

Well that doesn't sound too great 💯 Right now when entering the Hyper-V adapter IP:6080 Im getting ERR_CONNECTION_RESET instead if that changes anything

rescenic commented 4 years ago

I got OAuth login error when trying to do what it says after: sudo sandstorm admin-token in Ubuntu WSL. Error: conection is refused. error

ItsCubeTime commented 4 years ago

I got OAuth login error when trying to do what it says after: sudo sandstorm admin-token in Ubuntu WSL. Error: conection is refused. error

Wait is that page actually printed by sandstorm? o.o

Are you using wsl2 or wsl1?

ItsCubeTime commented 4 years ago

And how did you get it working exactly?

rescenic commented 4 years ago

And how did you get it working exactly?

@ItsCubeTime apt-get install net-tools Save this script and run in PowerShell:

$remoteport = bash.exe -c "ifconfig eth0 | grep 'inet '"
$found = $remoteport -match '\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}';

if( $found ){
  $remoteport = $matches[0];
} else{
  echo "The Script Exited, the ip address of WSL 2 cannot be found";
  exit;
}

#[Ports]

#All the ports you want to forward separated by coma
$ports=@(80,443,6080,6081,30025);

#[Static ip]
#You can change the addr to your ip config to listen to a specific address
$addr='0.0.0.0';
$ports_a = $ports -join ",";

#Remove Firewall Exception Rules
iex "Remove-NetFireWallRule -DisplayName 'WSL 2 Firewall Unlock' ";

#adding Exception Rules for inbound and outbound Rules
iex "New-NetFireWallRule -DisplayName 'WSL 2 Firewall Unlock' -Direction Outbound -LocalPort $ports_a -Action Allow -Protocol TCP";
iex "New-NetFireWallRule -DisplayName 'WSL 2 Firewall Unlock' -Direction Inbound -LocalPort $ports_a -Action Allow -Protocol TCP";

for( $i = 0; $i -lt $ports.length; $i++ ){
  $port = $ports[$i];
  iex "netsh interface portproxy delete v4tov4 listenport=$port listenaddress=$addr";
  iex "netsh interface portproxy add v4tov4 listenport=$port listenaddress=$addr connectport=$port connectaddress=$remoteport";
}

My problem is I can't enter setup token: err1 err2 It can reach my Windows IP - Server in Ubuntu WSL using my Windows IP - Port 80: err3

rescenic commented 4 years ago

Access via ngrok is OK: err

rescenic commented 4 years ago

I got OAuth login error when trying to do what it says after: sudo sandstorm admin-token in Ubuntu WSL. Error: conection is refused. error

Wait is that page actually printed by sandstorm? o.o

Are you using wsl2 or wsl1?

I use WSL 2

ItsCubeTime commented 4 years ago

Have you modified your sandstorm.conf file (or done any other changes to sandstorm)?

I kind of gave up on this several hours ago assuming its a sandstorm side issue not letting me access sandstorms port (but being able to access ports hosted by other softwares)

What are you using Laragon for?

Im guessing you not being able to access the admin-token link could be that you havent port forwarded on your router and opened up ports on your Windows firewall

ItsCubeTime commented 4 years ago

I use WSL 2

Cool, so am I, and Im using the same script that you mentioned earlier

ItsCubeTime commented 4 years ago

https://docs.sandstorm.io/en/latest/administering/faq/#what-ports-does-sandstorm-need-open

Have you port forwarded the ports mentioned here?

zenhack commented 4 years ago

@rescenic, the screenshot indicates you put localhost into the address bar; this is probably your issue -- Sandstorm looks at the hostname to decide what to respond with. You need to use the same host as is specified for BASE_URL in your sandstorm.conf.

rescenic commented 4 years ago

@ItsCubeTime commented on Jun 11, 2020, 12:39 AM GMT+7:

https://docs.sandstorm.io/en/latest/administering/faq/#what-ports-does-sandstorm-need-open

Have you port forwarded the ports mentioned here?

Thank you. I must set port forwarding first. Silly me.

ItsCubeTime commented 4 years ago

@ItsCubeTime commented on Jun 11, 2020, 12:39 AM GMT+7:

https://docs.sandstorm.io/en/latest/administering/faq/#what-ports-does-sandstorm-need-open Have you port forwarded the ports mentioned here?

Thank you. I must set port forwarding first. Silly me.

Would love to hear if you manage to get everything up and running, if you do I will give a second attempt at this.

Still Im curious what you're using Laragon for, are you just using it to start and stop WSL2 or?

rescenic commented 4 years ago

@ItsCubeTime commented on Jun 11, 2020, 12:37 AM GMT+7:

Have you modified your sandstorm.conf file (or done any other changes to sandstorm)?

I kind of gave up on this several hours ago assuming its a sandstorm side issue not letting me access sandstorms port (but being able to access ports hosted by other softwares)

What are you using Laragon for?

Im guessing you not being able to access the admin-token link could be that you havent port forwarded on your router and opened up ports on your Windows firewall

I tried not to modify the BIND IP to 0.0.0.0 in sandstorm.conf.

Eventually the script in PowerShell is broken: Change from: $remoteport = bash.exe -c "ifconfig eth0 | grep 'inet '" to: $remoteport = wsl -d Ubuntu ifconfig eth0 `| grep "inet " the rest is the same.

$remoteport = wsl -d Ubuntu ifconfig eth0 `| grep "inet "
$found = $remoteport -match '\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}';

if( $found ){
  $remoteport = $matches[0];
} else{
  echo "The Script Exited, the ip address of WSL 2 cannot be found";
  exit;
}

#[Ports]

#All the ports you want to forward separated by coma
$ports=@(80,443,6080,6081,30025);

#[Static ip]
#You can change the addr to your ip config to listen to a specific address
$addr='0.0.0.0';
$ports_a = $ports -join ",";

#Remove Firewall Exception Rules
iex "Remove-NetFireWallRule -DisplayName 'WSL 2 Firewall Unlock' ";

#adding Exception Rules for inbound and outbound Rules
iex "New-NetFireWallRule -DisplayName 'WSL 2 Firewall Unlock' -Direction Outbound -LocalPort $ports_a -Action Allow -Protocol TCP";
iex "New-NetFireWallRule -DisplayName 'WSL 2 Firewall Unlock' -Direction Inbound -LocalPort $ports_a -Action Allow -Protocol TCP";

for( $i = 0; $i -lt $ports.length; $i++ ){
  $port = $ports[$i];
  iex "netsh interface portproxy delete v4tov4 listenport=$port listenaddress=$addr";
  iex "netsh interface portproxy add v4tov4 listenport=$port listenaddress=$addr connectport=$port connectaddress=$remoteport";
}

https://i.ibb.co/Cz36QcW/11-06-2020-801-01-33-53.png

rescenic commented 4 years ago

@ItsCubeTime commented on Jun 11, 2020, 12:39 AM GMT+7:

https://docs.sandstorm.io/en/latest/administering/faq/#what-ports-does-sandstorm-need-open Have you port forwarded the ports mentioned here?

Thank you. I must set port forwarding first. Silly me.

Would love to hear if you manage to get everything up and running, if you do I will give a second attempt at this.

Still Im curious what you're using Laragon for, are you just using it to start and stop WSL2 or?

Laragon is web & database server plus another features for Windows. https://i.ibb.co/rQG7zy2/11-06-2020-802-01-51-24.png

To stop WSL2 just type: wsl --shutdown

ItsCubeTime commented 4 years ago

Yeah well are you like sandboxing sandstorm.io using or smth?

The reason to me asking is that I still dont quite know how you managed to access sandstorm while I can - despite me being able to access the ports when running other software like appache in its place (proving its not a networking issue)

ItsCubeTime commented 4 years ago

@ItsCubeTime commented on Jun 11, 2020, 12:39 AM GMT+7:

https://docs.sandstorm.io/en/latest/administering/faq/#what-ports-does-sandstorm-need-open Have you port forwarded the ports mentioned here?

Thank you. I must set port forwarding first. Silly me.

Would love to hear if you manage to get everything up and running, if you do I will give a second attempt at this. Still Im curious what you're using Laragon for, are you just using it to start and stop WSL2 or?

Laragon is web & database server plus another features for Windows. https://i.ibb.co/rQG7zy2/11-06-2020-802-01-51-24.png

To stop WSL2 just type: wsl --shutdown Hey, so did you manage to get it all up and running?