Установка ngrok в линукс

Getting Started with ngrok

This guide will get you up and running with the ngrok agent, giving you a secure way to access your local service from anywhere in the world.

We’ll do this in four steps:

  1. Starting a local service
  2. Installing the ngrok agent
  3. Connecting your agent to your ngrok account
  4. Start ngrok

Step 1: Starting a local web service​

First, you’ll need some sort of web service running on your machine. It should be available at http://localhost: [ any port ] . If you already have one, you can skip to Step 2. If not, we’ll set one up using Python SimpleHTTPServer (ngrok actually has a built in file server but let’s not worry about that now).

If you don’t have a web service running, you can set one up for this demo using Python SimpleHTTPServer.

  1. Create a new directory, we’ll call it ~/ngrok-rocks
  2. Move into that directory and create a file named index.html with a single line of text: Hello, World!
  3. From that folder, run python3 -m http.server . This will start a web server on port 8000 serving the contents of that directory.
  4. Open http://localhost:8000 in your browser

You should see Hello, World! in your browser. If you have any trouble getting things working, see this page for help.

Unfortunately, this service is only available on your local machine for now. Now let’s use ngrok to securely share it with the world. For the rest of this guide, we will assume we’re working with a web service running at http://localhost:8000 but you should adjust the following commands to match your configuration.

Step 2: Install the ngrok Agent​

The ngrok agent is the command line application that you will use to start your tunnels. The easiest way to get started is to use your favorite package manager to install ngrok.

brew install ngrok/ngrok/ngrok 
curl -s https://ngrok-agent.s3.amazonaws.com/ngrok.asc | \ sudo tee /etc/apt/trusted.gpg.d/ngrok.asc >/dev/null && \ echo "deb https://ngrok-agent.s3.amazonaws.com buster main" | \ sudo tee /etc/apt/sources.list.d/ngrok.list && \ sudo apt update && sudo apt install ngrok 

For Windows, use Chocolatey:

You’ll need to run this in an Administrator Command Prompt.

If you don’t have one of these package managers installed or prefer to install the ngrok agent yourself, visit the ngrok Download page for instructions and links.

You can test everything is working by running ngrok -h which should print the help text for the ngrok agent.

 $ ngrok -h  NAME:  ngrok - tunnel local ports to public URLs and inspect traffic  USAGE:  ngrok [command] [flags]  DESCRIPTION:  ngrok exposes local networked services behinds NATs and firewalls to the  public internet over a secure tunnel. Share local websites, build/test  webhook consumers and self-host personal services.  Detailed help for each command is available with 'ngrok help '.  Open http://localhost:4040 for ngrok's web interface to inspect traffic.  Author:  ngrok -  TERMS OF SERVICE: https://ngrok.com/tos  EXAMPLES:  ngrok http 80 # secure public URL for port 80 web server  ngrok http --domain baz.ngrok.dev 8080 # port 8080 available at baz.ngrok.dev  ngrok http foo.dev:80 # tunnel to host:port instead of localhost  ngrok http https://localhost # expose a local https server  ngrok tcp 22 # tunnel arbitrary TCP traffic to port 22  ngrok tls --domain=foo.com 443 # TLS traffic for foo.com to port 443  ngrok start foo bar baz # start tunnels from the configuration file  COMMANDS:  api use ngrok agent as an api client  completion generates shell completion code for bash or zsh  config update or migrate ngrok's configuration file  credits prints author and licensing information  diagnose diagnose connection issues  help Help about any command  http start an HTTP tunnel  service run and control an ngrok service on a target operating system  start start tunnels by name from the configuration file  tcp start a TCP tunnel  tls start a TLS tunnel  tunnel start a tunnel for use with a tunnel-group backend  update update ngrok to the latest version  version print the version string  OPTIONS:  --config strings path to config files; they are merged if multiple  -h, --help help for ngrok  -v, --version version for ngrok 

Step 3: Connect your agent to your ngrok account​

Now that the ngrok agent is installed, let’s connect it to your ngrok Account. If you haven’t already, sign up (or log in) to the ngrok Dashboard and get your Authtoken. The ngrok agent uses the authtoken (sometimes called tunnel credential) to log into your account when you start a tunnel.

Copy the value and run this command to add the authtoken in your terminal.

ngrok config add-authtoken TOKEN 

Источник

SalahHamza / install_ngrok.md

ngrok allows you to expose a web server running on your local machine to the internet.

wget https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip

if by any chance the url has been changed go to ngrok download page and copy the url of the linux .zip file.

unzip ngrok-stable-linux-amd64.zip

in case you don’t have unzip installed, you can do that like this

NAME: ngrok - tunnel local ports to public URLs and inspect traffic DESCRIPTION: ngrok exposes local networked services behinds NATs and firewalls to the public internet over a secure tunnel. Share local websites, build/test webhook consumers and self-host personal services. Detailed help for each command is available with 'ngrok help '. Open http://localhost:4040 for ngrok's web interface to inspect traffic. EXAMPLES: ngrok http 80 # secure public URL for port 80 web server ngrok http -subdomain=baz 8080 # port 8080 available at baz.ngrok.io ngrok http foo.dev:80 # tunnel to host:port instead of localhost ngrok tcp 22 # tunnel arbitrary TCP traffic to port 22 ngrok tls -hostname=foo.com 443 # TLS traffic for foo.com to port 443 ngrok start foo bar baz # start tunnels from the configuration file VERSION: 2.2.8 AUTHOR: inconshreveable - COMMANDS: authtoken save authtoken to configuration file credits prints author and licensing information http start an HTTP tunnel start start tunnels by name from the configuration file tcp start a TCP tunnel tls start a TLS tunnel update update ngrok to the latest version version print the version string help Shows a list of commands or help for one command 

this means that ngrok is working well

  1. all you need to do is specify a port where your website is servered so that you expose it to the internet. Example

passing the above command will produce this output

ngrok by @inconshreveable Session Expires 7 hours, 59 minutes Version 2.2.8 Region United States (us) Web Interface http://127.0.0.1:4040 Forwarding http://********.ngrok.io -> localhost:8000 Forwarding https://*******.ngrok.io -> localhost:8000 Connections ttl opn rt1 rt5 p50 p90 0 0 0.00 0.00 0.00 0.00 

Источник

How to Install and Use Ngrok on Linux

How to Install and Use Ngrok on Linux

Learning how to install and use ngrok on Linux gives you complete access to the World Wide Web (www). Here’s everything you need to know about the service and how to deploy it.

Ngrok is a service that allows accessing remote services over the internet without port forwarding. It primarily hosts the services in the sub-domain of ngrok. The main benefit this service offers is it allows our websites to be accessed from anywhere over the internet—without actually owning any domain name.

Developers use it to show their projects and their functionality to clients.

How to Install and Use Ngrok on Linux

Here we will discuss ngrok, a service that allows making local resources available over the internet. We will talk about its installation, configuration, and usage in the following few sections.

Usage of ngrok

You can make these resources public or share local resources like websites. For instance, if you have a local server running on Linux at loop back address http://127.0.0.1:8080, then ngrok can generate a uniform resource locator (URL) http://website.ngrok.io pointing to your loopback address (http://localhost:8080 or http://127.0.0.1:8080).

Besides the use case discussed above, there is another usage of the ngrok service. You can share your services externally over ssh. Security specialists can also test clone phishing techniques using ngrok. The ngrok command exposes local services behind NAT and firewalls to the internet via tunneling.

Installing ngrok

We will now discuss the installation step for ngrok. We must first register an account, then install (using the desired options) the ngrok service. The authentication token is configured, and you are ready to use ngrok.

Register your account

To install grok, ensure that you have an account registered on the dashboard. Once you register your account, you will receive a confirmation email.

Installation of webserver

Make sure that you have a web server installed on your computer such that you can share its services over the internet. If it is not installed, run the following command to install the apache web server (for Ubuntu):

For Red Hat users, the following command can be used for installation:

Installation of ngrok

There are two basic approaches for the installation of ngrok:

Installing via snap package manager

To install the ngrok using the snap package manager, execute the following command:

Installation using compressed binary

To install ngrok from compressed binary, first, download it. Then, you need to extract it by executing the following command:

sudo tar -xvzf ngrok-v3-stable-linux-amd64.tgz

Here, we have used the tar utility, and the options provided are -x for extracting, -v for verbose, z for zipping, and f for force. You can also unzip it using the following command:

$unzip ngrok-stable-linux-amd64.zip

Tip: There is another approach to installing ngrok via apt . Simply run the following command:

$curl -s https://ngrok-agent.s3amazonaws.com/ngrok.asc | sudo tee /etc/apt/trusted.gpg.d/ngrok.asc >/dev/null && echo "deb https://ngrok-agent.s3.amazonaws.com buster main" | sudo tee /etc/apt/sources.list.d/ngrok.list && sudo apt update && sudo apt install ngrok

Configuration of the auth token to use ngrok

After installation of ngrok, run its graphical user interface. There you will find the authentication token. If you have installed it using the snap package manager, run the following command:

$ngrok config add-authtoken

Here, provide the authentication token you copied from the graphical user interface. If you have installed using binary, then run the following command:

./ngrok config add-authtoken

At this point, you have to provide the authentication token copied from the GUI.

After performing the above steps, ngrok is ready to be used. A quick look at the details of the ngrok command can be seen via the help available for that command:

Steps to share a local website using ngrok

This section will discuss the basic steps to share a local website over ngrok. Make sure that you have a web server installed. Now, run the following command:

You will be shown a URL to access the local website. Copy the URL and paste it into your browser. You may receive a warning message. Press the ‘Visit Website’ button.

Now to quit ngrok, press “Ctrl + C”.

Making a computer remotely accessible via a secure shell (ssh)

If you have installed the ngrok using snap, run the following command to make it accessible from the remote system:

Run the following command to make the computer remotely accessible if you have installed ngrok using binary:

You will be shown an address starting with tcp:// . Copy it. Now, you can connect remotely to the computer using the following command:

Don’t include TCP in the previous address; specify the port with the –p option.

And that brings us to the end of this article. Here, we tackled how to install and configure ngrok. We also discussed how ngrok could be used to share a local website remotely accessible over the internet. In addition, we even learned how a system is made available over SSH.

The learning outcome of this guide is that users can make the website and applications hosted locally available over the internet.

If this guide helped you, please share it. ?

Husain is a staff writer at Distroid and has been writing on all things Linux and cybersecurity for over 10 years. He previously worked as a technical writer for wikiHow. In his past time, he loves taking tech apart and see what makes them tick, without necessarily putting it all back together. LinkedIn

Leave a Reply

You must be logged in to post a comment.

Источник

Читайте также:  Dual booting arch linux and windows 10
Оцените статью
Adblock
detector