Skip to content

Commit 6154931

Browse files
committed
Restructure inlets TCP/HTTP pages and reduce README length
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <[email protected]>
1 parent 787548b commit 6154931

10 files changed

+533
-73
lines changed

docs/index.md

+3-54
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ Inlets can tunnel either HTTP or TCP traffic:
4444
* HTTP (L7) tunnels can be used to connect one or more HTTP endpoints from one network to another. A single tunnel can expose multiple websites or hosts, including LoadBalancing and multiple clients to one server.
4545
* TCP (L4) tunnels can be used to connect TCP services such as a database, a reverse proxy, RDP, Kubernetes or SSH to the Internet. A single tunnel can expose multiple ports on an exit-server and load balance between clients
4646

47+
You'll find tutorials in the navigation for HTTP and TCP tunnels, along with a dedicated section for integrating with Kubernetes.
48+
4749
### Downloading inlets
4850

4951
inlets is available for Windows, MacOS (Apple Silicon) and Linux:
@@ -52,65 +54,12 @@ inlets is available for Windows, MacOS (Apple Silicon) and Linux:
5254

5355
You can also use [the container image from ghcr.io](https://github.com/orgs/inlets/packages/container/package/inlets-pro): `ghcr.io/inlets/inlets-pro:latest`
5456

55-
### Your first HTTPS tunnel with an automated tunnel server (recommended)
56-
57-
Expose one or more HTTPS domains from your local machine.
58-
59-
* [Tutorial: Expose one or more local HTTP services via HTTPS](https://inlets.dev/blog/2021/08/08/private-tunnel.html)
60-
61-
### Install a HTTP tunnel server manually (advanced)
62-
63-
If you don't want to use automation tools to create a server for the inlets-pro server, then you can follow this manual guide to generate and install a systemd service instead.
64-
65-
* [Tutorial: Setting up a HTTP tunnel server manually](/tutorial/manual-http-server/)
66-
67-
### Tunnel TCP services
68-
69-
inlets is not limited to exposing HTTP connections, you can also tunnel TCP protocols like RDP, VNC, SSH, TLS (i.e. reverse proxies, or the Kubernetes API server) and databases.
70-
71-
* [Tutorial: Expose a private SSH server over a TCP tunnel](/tutorial/ssh-tcp-tunnel/)
72-
* [Tutorial: Tunnel a private Postgresql database](/tutorial/postgresql-tcp-tunnel/)
73-
* [Tutorial: Tunnel ports 80 and 443 over TCP for a reverse proxy](https://docs.inlets.dev/tutorial/caddy-http-tunnel/)
74-
75-
### Running multiple tunnel servers on the same host (Advanced)
76-
77-
If you want to mix HTTP and TCP tunnels on the same tunnel server, you could either only use TCP ports, or enable both.
78-
79-
* [Advanced: Setting up dual TCP and HTTPS tunnels](/tutorial/dual-tunnels/)
80-
81-
If you're looking to scale inlets to host many tunnels, then Kubernetes is probably a better option.
82-
83-
### Local port forwarding (Intermediate)
84-
85-
* [Case-study: Reliable local port-forwarding from Kubernetes](https://inlets.dev/blog/2021/04/13/local-port-forwarding-kubernetes.html)
86-
87-
### Connecting with Kubernetes
88-
89-
You may have an on-premises Kubernetes cluster that needs ingress. Perhaps you have a homelab, or Raspberry Pi cluster, that you want to self host services on.
90-
91-
* [Tutorial: Expose a local IngressController with the inlets-operator](/tutorial/kubernetes-ingress/)
92-
* [Tutorial: Expose Kubernetes services in short-lived clusters with helm](https://inlets.dev/blog/2021/07/08/short-lived-clusters.html)
93-
94-
Some teams want to have dev work like production, with tools Istio working locally just like in the cloud.
95-
96-
* [Tutorial: Expose an Istio gateway with the inlets-operator](/tutorial/istio-gateway)
97-
98-
* [Tutorial: Access the Kubernetes API server from anywhere like managed service](/tutorial/kubernetes-api-server/)
99-
100-
See also: [helm charts](https://github.com/inlets/inlets-pro/tree/master/chart)
101-
102-
### Provide tunnels as a managed service or SaaS
57+
### Becoming a tunnel provider or operating a hosting service
10358

10459
Inlets Uplink is a complete solution for Kubernetes that makes it quick and easy to onboard hundreds or thousands of tenants. It can also be used to host tunnel servers on Kubernetes, for smaller amounts of tunnels.
10560

10661
Learn more: [Inlets Uplink](https://docs.inlets.dev/uplink/overview/)
10762

108-
### Monitoring and metrics
109-
110-
Inlets offers you multiple options to monitor your tunnels and get insight in their performance. Find out tunnel statistics, uptime and connected clients with the `inlets-pro status` command or collect the Prometheus metrics from the monitoring endpoint.
111-
112-
* [Monitoring and metrics](/tutorial/monitoring-and-metrics)
113-
11463
## Reference documentation
11564

11665
### inletsctl

docs/tutorial/automated-tcp-server.md

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Create a tunnel server with inletsctl
2+
3+
When should you create a TCP tunnel server?
4+
5+
It is advisable to only tunnel TCP services which include their own encryption such as TLS, SSH, RDP, or a Reverse Proxy. To expose a plaintext HTTP endpoint such as `http://localhost:3000`, use an [HTTPS tunnel](/docs/tutorial/automated-http-server.md) instead which will provide TLS to your end-users.
6+
7+
TCP tunnel servers can be [set up manually](/docs/tutorial/manual-tcp-server.md) or automatically with inletsctl.
8+
9+
This page shows the steps needed to create a tunnel server via inletsctl.
10+
11+
For a step-by-step guide on exposing a TCP service such as SSH, see [Expose SSH over a TCP tunnel](/docs/tutorial/ssh-tcp-tunnel.md).
12+
13+
## Obtain a cloud API token
14+
15+
inletsctl provisions a new cloud VM with inlets preinstalled using cloud-init.
16+
17+
You'll need to obtain an API token from your provider of choice using [the inletsctl reference documentation](/docs/reference/inletsctl.md).
18+
19+
## Create a tunnel server via inletsctl
20+
21+
Once you've obtained an API token, you can create a tunnel server with the following command:
22+
23+
```bash
24+
export PROVIDER=""
25+
export REGION=""
26+
export ACCESS_TOKEN_FILE_PATH=""
27+
28+
inletsctl create \
29+
--provider $PROVIDER \
30+
--access-token-file $ACCESS_TOKEN_FILE_PATH \
31+
--region $REGION \
32+
--tcp
33+
```
34+
35+
This will create a new VM in the London region and install inlets-pro on it.
36+
37+
The command will output a sample command for the `inlets-pro client` command:
38+
39+
## Run the tunnel client
40+
41+
The `inletsctl create` command will output a sample command for the `inlets-pro client` command.
42+
43+
To expose SSH from localhost, add:
44+
45+
```
46+
--upstream 127.0.0.1 \
47+
--port 2222
48+
```
49+
50+
To expose SSH from a remote machine on your local network i.e. `192.168.1.20`, add:
51+
52+
```
53+
--upstream 192.168.1.20 \
54+
--port 2222
55+
```
56+
57+
To expose ports 80 and 443 from a machine where you have a reverse proxy running such as Caddy, add:
58+
59+
```
60+
--upstream 192.168.1.20 \
61+
--port 80 \
62+
--port 443
63+
```
64+

docs/tutorial/http-authentication.md

+110
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
## Built-in HTTP Authentication
2+
3+
This page applies to inlets-pro 0.10.0 and onwards.
4+
5+
Services exposed over HTTP tunnels can have additional authentication added to them using a mechanism built-into inlets.
6+
7+
The `inlets-pro http` command provides three options:
8+
9+
1. Basic Authentication
10+
2. Bearer Token Authentication
11+
3. OAuth
12+
13+
## Basic Authentication
14+
15+
Basic authentication is a simple way to restrict access to your service by requiring a username and password.
16+
17+
When a user visits the URL of the service in a web-browser, they will be prompted to enter a username and password.
18+
19+
If they're using curl, then they can pass the username and password using the `--user` flag.
20+
21+
```bash
22+
curl --user username:password https://example.com
23+
```
24+
25+
Or simply pass the username and password as part of the URL:
26+
27+
```bash
28+
curl https://username:[email protected]
29+
```
30+
31+
The username has a default of `admin` for brevity, but can be overridden if you like:
32+
33+
```bash
34+
inlets-pro http client \
35+
--basic-auth-username admin \
36+
--basic-auth-password password \
37+
```
38+
39+
You can generate a string password using the `openssl` command:
40+
41+
```bash
42+
openssl rand -base64 32
43+
```
44+
45+
## Bearer Token Authentication
46+
47+
If you're exposing an endpoint that does not need to be accessed via a web-browser, then you can use Bearer Token Authentication.
48+
49+
This is useful for exposing endpoints that are used by mobile apps or other non-web clients.
50+
51+
To enable Bearer Token Authentication, you can use the `--bearer-token` flag when starting the `inlets-pro http` command.
52+
53+
```bash
54+
inlets-pro http client \
55+
--bearer-token token \
56+
```
57+
58+
Both Bearer Token and Basic Authentication can be used together by supplying both flags.
59+
60+
```bash
61+
inlets-pro http client \
62+
--bearer-token token \
63+
--basic-auth-username admin \
64+
--basic-auth-password password \
65+
```
66+
67+
## OAuth
68+
69+
With OAuth:
70+
71+
* You can define access for multiple users using usernames or email addresses
72+
* Avoid managing credentials in your application
73+
* Use an existing well-known provider for authentication such as GitHub
74+
75+
The OAuth 2.0 flow requires a web-browser, so if you anticipate mixed use, then you can combine it with Bearer Token Authentication, for headless clients.
76+
77+
### Example with GitHub.com
78+
79+
The example below will expose: `http://127.0.0.1:3000` using the domain name `tunnel.example.com`.
80+
81+
In order to use GitHub as the OAuth provider, you need to create a new OAuth application.
82+
83+
1. Go to [GitHub Developer Settings](https://github.com/settings/developers)
84+
2. Click on "New OAuth App"
85+
3. Enter a name for the application, for example `inlets-tunnel`
86+
4. Enter the callback URL, for example `http://tunnel.example.com/_/oauth/callback`
87+
5. Click on "Register application"
88+
6. Click "Generate a new client secret"
89+
90+
You will be given a client ID and client secret, which you can use to authenticate with GitHub.
91+
92+
We suggest saving this in a convenient location, for example: `~/.inlets/oauth-client-id` and `~/.inlets/oauth-client-secret`.
93+
94+
```bash
95+
inlets-pro http client \
96+
--oauth-client-id $(cat ~/.inlets/oauth-client-id) \
97+
--oauth-client-secret $(cat ~/.inlets/oauth-client-secret) \
98+
--upstream tunnel.example.com=http://127.0.0.1:3000 \
99+
--oauth-provider github \
100+
--oauth-acl alexellis \
101+
--oauth-acl [email protected]
102+
```
103+
104+
Once authenticated, a cookie will be set on the domain i.e. `tunnel.example.com` and the user will be redirected back to the root URL of the service `/`.
105+
106+
The duration of the cookie defaults to 5 minutes, but can be extended.
107+
108+
For the first version, GitHub is the only option available for the `--oauth-provider`. More options will be added over time, based upon requests from users, so if you want to use Google, Facebook, GitLab, etc, send us an email to help with prioritisation.
109+
110+
+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# HTTP Header Modification
2+
3+
This page applies to inlets-pro 0.10.0 and onwards.
4+
5+
When you expose a local service over a HTTP tunnel, it may need the headers of the request or those of the response to be modified.
6+
7+
The `inlets-pro http` command provides a mechanism to modify the headers of the request and response, without having to write an additional proxy to do so.
8+
9+
1. Add a header to the request
10+
2. Add a header to the response
11+
3. Remove a header from the request
12+
4. Remove a header from the response
13+
14+
Each flag is provided in the format of either: `Header` or `Header: Value`, and can be provided multiple times to work on multiple headers.
15+
16+
## Add a header to the request
17+
18+
To add a header to the request, you can use the `--request-header-add` flag.
19+
20+
For instance, if you have a client that calls the exposed service, but needs to add a special header like `X-Special-Header` to the request, you can do the following:
21+
22+
```bash
23+
inlets-pro http client \
24+
--request-header-add "X-Special-Header: 1234567890"
25+
```
26+
27+
Multiple headers can be added at once:
28+
29+
```bash
30+
inlets-pro http client \
31+
--request-header-add "X-Special-Header: 1234567890" \
32+
--request-header-add "X-Another-Header: 0987654321"
33+
```
34+
35+
## Add a header to the response
36+
37+
To add a header to the HTTP response from the exposed service, you can use the `--response-header-add` flag.
38+
39+
For example, to add a header to the response from the server to enable CORS:
40+
41+
```bash
42+
inlets-pro http client \
43+
--response-header-add "Access-Control-Allow-Origin: *"
44+
```
45+
46+
## Remove a header from the request
47+
48+
If you do not have control over the request headers because they are being sent by a third-party service or application, you can remove the ones you do not want to send.
49+
50+
Here is how you could remove the User-Agent header for privacy or security reasons:
51+
52+
```bash
53+
inlets-pro http client \
54+
--request-header-remove User-Agent
55+
```
56+
57+
## Remove a header from the response
58+
59+
Let's say that you're using Caddy, and want to remove the `X-Served-By` header from the request for security or privacy reasons.
60+
61+
To remove a header from the request, you can use the `--request-header-remove` flag.
62+
63+
```bash
64+
inlets-pro http client \
65+
--request-header-remove X-Served-By
66+
```

docs/tutorial/ip-filtering.md

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# IP filtering
2+
3+
HTTP and TCP tunnels support filtering of incoming requests by IP address through an allow list.
4+
5+
When enabled, only requests from the specified IP addresses or CIDR ranges will be allowed to connect.
6+
7+
You can read more about this feature [in the announcement](https://inlets.dev/blog/2021/10/15/allow-lists.html)
8+
9+
## How to enable IP filtering
10+
11+
To enable IP filtering, you can use the `--allow-cidr` flag to the inlets-pro http or tcp server commands.
12+
13+
You can log into a [host created by inletsctl](/docs/tutorial/automated-http-server.md), or you can [create a host manually](/docs/tutorial/manual-http-server.md).
14+
15+
The below example allows requests from the IP address `192.168.1.1` and the CIDR range `192.168.2.0/24`.
16+
17+
For HTTP tunnels:
18+
19+
```bash
20+
inlets-pro http server \
21+
--allow-ips 192.168.1.1 \
22+
--allow-ips 192.168.1.0/24
23+
```
24+
25+
For TCP tunnels:
26+
27+
```bash
28+
inlets-pro tcp server \
29+
--allow-ips 192.168.1.1 \
30+
--allow-ips 192.168.1.0/24
31+
```
32+

0 commit comments

Comments
 (0)