Stop sharing a port on Ngrok - ngrok

The Ngrok documentation mentions this example to share a local port on Internet.
Example: Open port 80 on your local machine to the internet
$ ngrok 80
How do I stop sharing this port if I would not want it to be accessed on the internet any more>

On windows machine go to command prompt:
taskkill /f /im ngrok.exe

killall ngrok from a script or the command line will kill all running ngrok tunnels that are running.
This is what worked for me. Ty #kkron.

First, you have to find the ngrok process id by $ top command.
After that, just run $ kill -9 {ngrok_id}
That's all :)

Stopping the ngrok port/tunnel
Simple Solution
If you are running ngrok normally, then use Ctrl+C (On Windows) or Cmd+C (On Mac) in ngrok command line.
(Check below if issue still persist)
Extended Solution
If the port does not stop/close normally or there are active ngrok sessions that are not responding, then use: killall ngrok
If the above does not work or the port is still running,
Fix ngrok in your system by setting up your auth code again by logging into https://dashboard.ngrok.com/get-started
Generate a new token on the dashboard (scroll down dashboard) to https://dashboard.ngrok.com/get-started/your-authtoken
Click on "reset authtoken", copy the auth-code, then go-to ngrok on command-line ngrok authtoken INSERT-YOUR-NEW-TOKEN-HERE
Then go to ngrok folder or use command line to delete the .ngrok configuration file and directory: ngrok.yml, to remove the old configuration effectively ending all the open ports, tunnels and sessions.

Simple as pressing ctrl+c. But I'm not sure if it closes any ports. The same happens as #user7032676 told.

You just have to stop ngrok for this.

Quick search process with grep
top | grep "ngrok"
My id was this, make sure to change with yours
kill -9 55636
If you like start again tunneling from working directory
ngrok http 3000

You should see (CTRL+C to quit) on the top right corner of your terminal, when you are running a ngrok session (Online).
Although in my case, CTRL+C wasn't working. Instead CTRL+ALT+C did the quitting for me.
Operating System: Ubuntu 20.04

For some reason whenever I launched the ngrok agent on windows, the terminal will shutdown and not stay open. I would have to go to the website to see the url for the website.
To shut it down I could not do ctrl-c. I simply went into task manager and deleted the process.
To access the task manager on windows do ctrl + alt + delete

Reboot the computer and all. Hope helped

Related

unable to acaess the application in localhost through saucelabs tunnel

I am using Saucelabs to test my application on Mac, chrome configuration as I am using windows machine.
As per Saucelabs documentation, downloaded the Saucelabs Connect Proxy. Extracted the file and went to bin folder in command line and executed the below command
bin/sc -u <sauce_username> -k <sauce_accesskey> -x <sauce_data_center> -i <tunnel_id>
I got the message on the command line as "Sauce Connect is up, you may start your tests." Showed one tunnel is active on the SauceLabs my account under tunnel tab.
I started the session by going to Live --> Crossbrowser; selected the tunnel, localhost application url, browser(chrome 90) and Mac-Sierra and Start Session
Opened the application but it didn't show the feature which are on localhost.
Anyone, please help me on this, is there anything wrong i am doing in the proxy connection, because the same is working fine, if i directly open the application url on my windows machine with chrome.
I found the answer in the sauce labs documentation itself. The problem i am getting is related to SSL and here the solution.
If you don't want any domains to be SSL re-encrypted, you can specify all with the argument (i.e., -B all or --no-ssl-bump-domains all)
Now when run the below command to start the tunnel it resolve the issue.
bin/sc -u <sauce_username> -k <sauce_accesskey> -x <sauce_data_center> -i <tunnel_id> -B all

VPN killswitch using UFW, but now openvpn3 no longer can start automatically

I successfully implemented this, which blocks all internet connections on my Linux machine UNLESS it connects via a specific VPN :
https://www.comparitech.com/blog/vpn-privacy/how-to-make-a-vpn-kill-switch-in-linux-with-ufw/
If I manually execute openvpn3 session-start --config ~/Desktop/config.ovpn, it successfully connects via the VPN.
I used to have this command in a script (that has #!/bin/bash as header) which ran at device bootup without any issues, UNTIL I configured ufw for the killswitch above (now ufw runs on device bootup).
I use openvpn3 so using instructions in the above tutorial for openvpn commands didn't work at all.
I even tried using a sleep in my bash script to get it to wait a while until after bootup. Doesn't work. But if I issue the connection command manually in the command prompt, it works.
Please help! I need it to connect automatically. Much appreciated!
After spending a whole day on this, I figured out a solution. I found an article that guided me : https://www.howtogeek.com/687970/how-to-run-a-linux-program-at-startup-with-systemd/
I set up a service item using systemd (systemctl) just for that command to connect. Here is what my entry looks like :
#/etc/systemd/system/connectvpn.service
[Unit]
Description=Connect VPN
After=ufw.service network.target
Requires=ufw.service
[Service]
Type=oneshot
ExecStart=/usr/local/bin/connect
#/usr/local/bin/connect
#!/bin/bash
openvpn3 session-start --config /home/xyz/Desktop/config.ovpn
Working nicely now, connects to the VPN on bootup.

Error: Port 5000 is not open, could not start functions emulator

✔ Deploy complete!
Project Console: https://console.firebase.google.com/project/socialape-6b2f7/overview
Ayhan-MacBookPro:socialape-functions macbook$ firebase serve
=== Serving from '/Users/macbook/Desktop/socialape-functions'...
Error: Port 5000 is not open, could not start functions emulator.
Run lsof -t -i tcp:5000 | xargs kill from your Terminal.
A common cause for this error occurs when the Firebase emulator is not cleanly shut down (e.g., closing your IDE that's running the emulator in an embedded Terminal session) This will leave the process running in the background and occupies the emulator's default port.
To resolve the conflict, find the process ID running on the port (here 5000) from your Terminal command line and then kill it.
The above one-liner finds the process ID and pipes it directly to kill (h/t #manav).
For additional info, check out: Find (and kill) process locking port 3000 on Mac
The bug seems to be on not your end
It is caused by a bug in a dependency (node portfinder).
A quick fix to edit it might be to use the old version of node portfinder (v 1.0.21). Alternatively, you can do it by editing node_modules/firebase-tools/lib/emulator/controller.js and changing yield pf.getPortPromise({ port, stopPort: port }) to yield pf.getPortPromise({ port, stopPort: port + 1 }).
You can see the answer to your question completely here in this SO link.
If you are facing this issue in macOS Pro then this solution is for you.
In MacOS , Port 5000 may be claimed by a new "AirPlay Receiver".
This can be disabled in Settings -> Sharing:
I'm also adding the Screenshot of settings panel for disabling AirPlay Receiver.
Disabling the AirPlay Receiver (if you do not need it) frees up port 5000.

Setting up ngrok an homestad

I am trying to setup ngrok on my homestead, but it is not opening my project.
I have run ngrok http 80 and copied the address in forwarding part of the output to my Homestead.yaml file to map it to my project, and ran vagrant provision after that:
Forwarding http://92832de0.ngrok.io -> localhost:80
Forwarding https://92832de0.ngrok.io -> localhost:80
But when I open the http://92832de0.ngrok.io in the browser it opens up ngrok page "It works" and not my project.
When I have changed the port to ngrok http 8000 then I get Laravel error message:
Whoops, looks like something went wrong.
You can use any of your application which is in homestead.
For that, you need to run the below command by replacing 'your-site.app:8000'
ngrok http -host-header=rewrite your-site.app:8000
Before that, you need to register into ngrok and install ngrok then use the authtoken that given in your account.
For more details, refer this https://ngrok.com/docs
This is how It worked for me:
1) I have downloaded the ngrok (https://ngrok.com/) on my Windows host machine and executed ngrok.exe.
It has opened a command line interface for me
2) I typed the following
ngrok.exe http 192.168.10.10 -host-header=homestead.test
And it gave me the link of where to go:
Forwarding http://123456.ngrok.io -> http://192.168.10.10:80
Forwarding https://123456.ngrok.io -> http://192.168.10.10:80
I just went there ans saw my local environment Laravel Project.
You can add a function like this to your ~/.profile or ~/.bash_profile script on the host machine:
rock(){
ngrok http 192.168.10.10:80 -host-header=$1
}
After that you can use it to proxify any site on your Homestead machine like this:
rock your-site.app:8000
If you have multiple sites on your homestead you have to:
ssh into your homestead.
run this command: share yoursite.test
and that's it.
In homestead ngrok is already installed by default,
You just need to create an account from ngrok at https://dashboard.ngrok.com/signup
And then run:
vagrant up (in folder Homestead)
vagrant ssh
cd to/your/project/proyect
ngrok authtoken your__ngrok__account___token
share yourproject.test

Solaris. xterm display problem

I connect to a solaris (10) server through SSH from my linux machine.
However, when I attempt to open another terminal using " xterm" , then it does not work.
I set the DISPLAY env variable to 127.0.0.1:0.0, but it gives the following error:xterm Xt
error: Can't open display: 127.0.0.1:0.0
Please suggest a solution to rectify this.
Thanks
-Mike
That's the address of the X server on the target machine. You need to address the X server on the client machine on which you're working. The easiest way is to just use ssh -X or -Y, (see man ssh(1)) as
client: ssh -Y solaris
in order to connect to the remote machine; you need login info too
This just sets up an X connection, tunneled through ssh.
Otherwise, you can do it by hand as
client:
$ echo $DISPLAY
client:3:4
remember it's not *always* 0.0
$ xhost +solaris
You have to allow connections from the remote machine
$ ssh solaris
sets up a remote shell, you still need ssh login info
solaris:
$ export DISPLAY client:3.4
make sure its the server on 'client' you're using
$ xterm
This should now give you a 'solaris' xterm window on 'client'
As Charlie mentioned, use ssh -X hostname when connecting.
If all else fails enter xhost + on your remote machine. Hope that helps.
Set the display to your linux IP address, not localhost.
127.0.0.1 is localhost : therefore on the Solaris server, it's the server itself.

Resources