Until you protect it, an HTTP, TCP or UDP tunnel is reachable by anyone who has its address. Basic Authentication asks visitors for a username and password, and IP Restriction limits the tunnel to the IP addresses you choose. This page explains both and points to the other protections.
Which protection is available where #
| Protection | What it does | Tunnel types |
|---|---|---|
| Basic Authentication? | Visitors enter one shared username and password before anything loads. | HTTP, File Server (type Default), MCP Gateway |
| IP Restriction | Only the listed IP addresses can connect, or the listed addresses are blocked. | Every tunnel type. Needs Balance. |
| SSO Providers | Visitors sign in with one of your identity providers. | HTTP. See Single Sign-On. |
| Web Application Firewall | Filters malicious requests. | HTTP, MCP Gateway. See Web Application Firewall. |
| Proxy Authentication and Access Control | A username and password for proxy clients, and a list of destinations the proxy may reach. | Proxy Server. See Proxy Server. |
The AuthToken of your device is not one of these protections: it connects the Localtonet app to your account and does not authenticate visitors.
Basic Authentication #
With Basic Authentication on, visitors see a sign-in prompt from their browser and must enter the username and password before anything loads. A tunnel has one username and one password, shared by everyone you give them to.
Turn it on #
-
Open the tunnel settings #
Open the page of the tunnel type, for example My Tunnels › HTTP, and select Settings in the row of the tunnel.
-
Switch Basic Authentication? to Yes #
The Basic authentication dialog opens.
-
Enter the sign-in details #
Fill in Username and Password, or select Generate a strong password to get a random 16-character password. The dialog rates the password as Too short, Fair, Good or Strong while you type.
-
Copy the details and save #
Copy puts the address, username and password on the clipboard so you can share them. Select Save. A running tunnel is restarted with the new setting.
Rules for the username and password #
| Field | Rules | Message when it is wrong |
|---|---|---|
| Username | Required, up to 100 characters, no colon. | "Enter a username." or "Usernames can’t contain a colon (:)." |
| Password | Required. | "Enter a password, or use Generate." |
Change the password or turn it off #
Switch Basic Authentication? to No and confirm Turn off basic authentication?. Visitors will no longer be asked for a username and password. To change the username or password, turn the switch off, then on again, and enter the new details.
Call a protected tunnel from a script #
Tools send the same credentials in the standard HTTP Authorization header. With curl:
curl -u <USERNAME>:<PASSWORD> https://<YOUR_TUNNEL_ADDRESS>/IP Restriction #
Needs Balance
IP Restriction decides which IP addresses can connect to the tunnel. It works on the address the visitor connects from, so it protects services that have no login of their own, such as a database or a remote desktop port.
Add addresses #
-
Open the IP restriction dialog #
In the tunnel settings, select IP Restriction › Manage.
-
Choose what the list means #
Under Listed addresses choose a mode:
- Allow only these: only the addresses in the list can connect. Everyone else is blocked.
- Block these: the addresses in the list can’t connect. Everyone else can.
When the list already has entries, the dialog asks you to confirm the switch, for example Allow only the listed addresses?
-
Enter the addresses and select Add #
Type into Add IP addresses, or select Use my IP to insert the address you are browsing from, then select Add.
Changes apply right away. There is no Save button and the tunnel is not restarted.
Address syntax #
| You enter | Example | Meaning |
|---|---|---|
| A single IPv4 address | 203.0.113.10 | That address. |
| An IPv4 range in CIDR notation | 198.51.100.0/24 | Every address in the range. The number after the slash is from 0 to 32. |
| A single IPv6 address | 2001:db8::10 | That address. It is saved with /128. |
| An IPv6 range | 2001:db8::/48 | Every address in the range. The number after the slash is from 0 to 128. |
| Several entries at once | 203.0.113.10, 198.51.100.0/24 | Separate entries with commas or spaces. |
Remove addresses #
Select the remove button next to an entry to delete it. Remove all clears the list after you confirm Remove all addresses?; the tunnel then accepts connections from any IP address again. An empty list never blocks anyone: the dialog shows "No addresses yet, so every IP address can connect."
Check your own address before you choose Allow only these. If your IP address is not in the list, you are blocked too. Home and mobile connections often get a new address from time to time.
Example: SSH for the office only #
You expose SSH with a TCP tunnel and want only your office network 198.51.100.0/24 to reach it. Open IP Restriction › Manage, choose Allow only these, enter 198.51.100.0/24 and select Add. From that moment on, every other address is blocked.
Proxy tunnels #
Proxy Server tunnels use their own settings on top of IP Restriction:
- Proxy Authentication: clients must send a username and password to use the proxy. An HTTP or SOCKS5 proxy cannot be left open: to turn the authentication off, first add your clients’ addresses to IP Restriction in the mode Allow only these. Otherwise you get "Add an allowed IP restriction to this tunnel before disabling authentication."
- Access Control: a list of destinations the proxy can reach, with the same two modes. It accepts domains,
*.example.comfor every subdomain, IP addresses and ranges.
Both are explained in Proxy Server. The clients of a Rotating Proxy have their own usernames and passwords; see Rotating Proxy.
Troubleshooting #
"You need to purchase balance to use this feature."
Adding addresses to IP Restriction and switching its mode need Balance. See Plans and Balance.
"VALUE is not an IP address or range."
The entry is not an IPv4 or IPv6 address. Host names are not accepted in IP Restriction. Enter the address itself, or a range such as 10.0.0.0/16.
"VALUE needs a range from /0 to /32." or "from /0 to /128."
The number after the slash is outside the valid range for that address family: up to 32 for IPv4, up to 128 for IPv6.
"VALUE is already in the list." or "This IP restriction already exists."
The address is already listed. Nothing needs to be added.
"Your IP address could not be detected."
Use my IP could not find your public address. Type it by hand.
"Check the device connection." when saving Basic Authentication
The tunnel is running, but the Localtonet app of its device is not connected, so the tunnel cannot be restarted with the new setting. Start the app, or stop the tunnel and save again.
I locked myself out with Allow only these
The dashboard is not affected by the tunnel's IP Restriction. Open the dialog again and add your current address, switch to Block these, or select Remove all.