Pangolin tunnel
Some projects require an external service to callback to your application, for example when handling payments. When you’re on a network that is not accessible from the internet, we can still allow access to a specific application using tunnel.
The way it works is, a client application (Newt) is setup on the machine where your application is running. This is connected to a server application (Pangolin) which can dynamically create domains and route them to the client application.
Internet -> Pangolin -> Newt -> App
To start creating tunnels you will need an account to access the pangolin dashboard. Either use the credentials from vaultwarden or ask an admin to create an account for you.
Creating a tunnel
- From the dashboard select
Sitesfrom the side panel. - Select
+Add Site. - Enter a name. Leave site addresss default.
- Select
Newt Tunnelas the tunnel type. - For installing newt select
Unix & MacOS - Copy the commands.
- Click on
Create Site - Now execute the commands in a terminal on the target of the tunnel.
- From the side panel select
Resources - Select
+Add Resources - Enter a name.
- Select
HTTPS resourceas resource type. - Enter the desired subdomain.
- Select
+Add target - On the left dropdown select previously created site.
- Select
httpas protocol - Enter the target IP/hostname. This is most likely
localhostyou can also try127.0.0.1,0.0.0.0 - Enter the port your application is running on.
- Select
Create Resource - Further configuration to SSL and authentication is possible by editing the resource.
- Visiting the URL should now connect to your application.
Installing Newt automatically
For staging environments it might be useful to automatically install newt when starting an application.
First make sure that the following environment variables are set properly.
- NEWT_ID
- NEWT_SECRET
- PANGOLIN_ENDPOINT
Install newt using curl -fsSL https://pangolin.net/get-newt.sh | bash Then start it using newt.
If running in an entrypoint script you will want to run it in the background using newt &
The environment variables will be automatically picked up. Note that they will replace the command line parameters, they will not be available if the environment variable is detected.
Authentication
Pangolin features platform SSO which can limit the users that are allowed to access a resource. When allowing an external service access to an internal application authentication will need to be disabled.
- Select
Resourcesin the sidebar. - Select the resource.
- Select the
Authenticationtab. - Disable
Use platform SSO. - Select
Save Users & Roles. - Confirm that authentication for the resource is set to
Not Protected.