Skip to content

Commit fc4221f

Browse files
committed
Replace content with rework content
1 parent 9e88a00 commit fc4221f

File tree

483 files changed

+6220
-3125
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

483 files changed

+6220
-3125
lines changed

app/routes/actions+/search.tsx

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,35 @@
11
import type { LoaderArgs } from "@vercel/remix";
22
import { json } from "@vercel/remix";
3-
import { getPosts, getDocs } from '~/utils/blog.server';
4-
import {getDomainUrl} from '~/utils'
3+
import { getPosts, getDocs } from "~/utils/blog.server";
4+
import { getDomainUrl } from "~/utils";
55

66
export let loader = async ({ request }: LoaderArgs) => {
7-
const blogUrl = `${getDomainUrl(request)}`
8-
7+
const blogUrl = `${getDomainUrl(request)}`;
8+
99
let url = new URL(request.url);
1010
let term = url.searchParams.get("term");
1111

12-
let [posts, docs] = await Promise.all([
13-
getPosts(),
14-
getDocs(),
15-
]);
12+
let [posts, docs] = await Promise.all([getPosts(), getDocs()]);
1613

17-
const postUrls = [...posts, ...docs].map( post => {
18-
let url = post.url.replace("//", "/");
19-
return {
14+
const postUrls =
15+
[...posts, ...docs].map((post) => {
16+
let url = post.url.replace("//", "/");
17+
return {
2018
url: `${blogUrl}${url}`,
21-
title: post.attributes.meta.title,
19+
title: post.attributes?.meta?.title ?? post.attributes?.title,
2220
body: post.body,
23-
type: url.includes('docs/') ? 'Docs' : 'Blog',
24-
}
25-
}) || []
26-
21+
type: url.includes("docs/") ? "Docs" : "Blog",
22+
};
23+
}) || [];
24+
2725
// this function should query the DB or fetch an API to get the users
28-
const results = term ? postUrls.filter(
29-
post => post.title.toLowerCase().includes( String(term) ) ||
30-
post.body.toLowerCase().includes( String(term) )
31-
) : []
32-
26+
const results = term
27+
? postUrls.filter(
28+
(post) =>
29+
post.title.toLowerCase().includes(String(term)) ||
30+
post.body.toLowerCase().includes(String(term))
31+
)
32+
: [];
33+
3334
return json({ results });
34-
};
35+
};

content/blog-cache.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
[{"attributes":{"meta":{"title":"Hello World","description":"Isn't this awesome?"},"date":"2022-08-02T00:00:00","excerpt":"Hello","headers":{"Cache-Control":"no-cache"}},"body":"...","url":"/blog/hello-world"},{"attributes":{"meta":{"title":"Another Post","description":"Isn't this awesome?"},"date":"2021-10-02T00:00:00","excerpt":"Hello Gaseous cloud...","headers":{"Cache-Control":"no-cache"}},"body":"...","url":"/blog/another-post"},{"attributes":{"meta":{"title":"ABC","description":"Isn't this awesome?"},"date":"2021-10-02T00:00:00","excerpt":"Hello Gaseous cloud...","headers":{"Cache-Control":"no-cache"}},"body":"...","url":"/blog/hello-world/abc"},{"attributes":{"meta":{"title":"A test","description":"Isn't this awesome?"},"date":"2021-10-02T00:00:00","excerpt":"More Testin","headers":{"Cache-Control":"no-cache"}},"body":"...","url":"/blog/2022/test"},{"attributes":{"meta":{"title":"More Hello","description":"Isn't this awesome?"},"date":"2021-10-02T00:00:00","excerpt":"Hello Gaseous cloud...","headers":{"Cache-Control":"no-cache"}},"body":"...","url":"/blog/hello-world/more-hello"}]
1+
[{"attributes":{"meta":{"title":"Hello World","description":"Isn't this awesome?"},"date":"2022-08-02T00:00:00","excerpt":"Hello","headers":{"Cache-Control":"no-cache"}},"body":"...","url":"/blog/hello-world"},{"attributes":{"meta":{"title":"ABC","description":"Isn't this awesome?"},"date":"2021-10-02T00:00:00","excerpt":"Hello Gaseous cloud...","headers":{"Cache-Control":"no-cache"}},"body":"...","url":"/blog/hello-world/abc"},{"attributes":{"meta":{"title":"Another Post","description":"Isn't this awesome?"},"date":"2021-10-02T00:00:00","excerpt":"Hello Gaseous cloud...","headers":{"Cache-Control":"no-cache"}},"body":"...","url":"/blog/another-post"},{"attributes":{"meta":{"title":"A test","description":"Isn't this awesome?"},"date":"2021-10-02T00:00:00","excerpt":"More Testin","headers":{"Cache-Control":"no-cache"}},"body":"...","url":"/blog/2022/test"},{"attributes":{"meta":{"title":"More Hello","description":"Isn't this awesome?"},"date":"2021-10-02T00:00:00","excerpt":"Hello Gaseous cloud...","headers":{"Cache-Control":"no-cache"}},"body":"...","url":"/blog/hello-world/more-hello"}]

content/docs-cache.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.
Lines changed: 249 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,249 @@
1+
---
2+
title: Agent TLS Termination
3+
---
4+
5+
# Agent TLS Termination
6+
7+
Agent TLS termination enables you to secure your traffic with end-to-end encryption without needing to reconfigure your server.
8+
9+
:::tip
10+
If your service doesn't support TLS termination, you can still use Agent TLS termination with [Zero-Knowledge TLS](/traffic-policy/actions/terminate-tls/#zero-knowledge-tls).
11+
:::
12+
13+
## Quickstart
14+
15+
The following instructions will guide you through setting up Agent TLS termination with ngrok.
16+
17+
### Prerequisites
18+
19+
- [openssl](https://docs.openiam.com/docs-4.2.1.3/appendix/2-openssl)
20+
21+
### **Step 1** – Generate a cert and key pair
22+
23+
The following command:
24+
25+
1. Generates a new certificate signing request (CSR) for a 4096-bit RSA key pair.
26+
- The key is saved to `your-key.key`.
27+
1. Creates a self-signed certificate which:
28+
- Is in x509 format and uses the SHA-256 hash algorithm.
29+
- Is valid for 365 days.
30+
- Is saved to `your-cert.crt`.
31+
32+
```bash
33+
openssl req -new -newkey rsa:4096 -x509 -sha256 -days 365 -noenc -out your-cert.crt -keyout your-key.key
34+
```
35+
36+
### **Step 2** – Configure your endpoint
37+
38+
You can configure your endpoint with an [agent configuration file](/agent/config/). To create a new configuration file with your generated cert and key pair, run the following command:
39+
40+
```bash
41+
ngrok config add-authtoken you-authtoken
42+
```
43+
44+
Your generated configuration file should resemble the following:
45+
46+
```yaml
47+
version: 3
48+
agent:
49+
authtoken: your-authtoken
50+
endpoints:
51+
- name: demo-tls
52+
url: "tls://your-domain.ngrok.app"
53+
upstream:
54+
url: 12345
55+
agent_tls_termination:
56+
server_certificate: /path/to/your-cert.crt
57+
server_private_key: /path/to/your-key.key
58+
```
59+
60+
:::tip
61+
You can run `ngrok config edit` to open the configuration file in your default text editor. [Learn more about the `ngrok config` command](/agent/cli/#ngrok-config).
62+
:::
63+
64+
### **Step 3** – Start your endpoint
65+
66+
Next, use `ngrok start endpoint_name_here` in the terminal to start an endpoint using the settings in your agent configuration file, as shown below:
67+
68+
```bash
69+
ngrok start demo-tls
70+
```
71+
72+
### **Step 4** – Start your upstream server
73+
74+
Start an upstream server on the specified port (e.g., `12345`) to handle incoming requests. The following example uses Python, but you can use any language or framework depending on your requirements.
75+
76+
```python
77+
import socket
78+
79+
host='127.0.0.1'
80+
port=12345
81+
server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
82+
server.bind((host, port))
83+
print(f"Server started on {host}:{port}")
84+
server.listen(1)
85+
86+
while True:
87+
client, client_address = server.accept()
88+
print(f"Connection established with {client_address}")
89+
client.sendall(b"hello, world!")
90+
client.close()
91+
print(f"Connection with {client_address} closed")
92+
```
93+
94+
### **Step 5** – Try connecting to your endpoint
95+
96+
The following example uses `openssl s_client` to initiate an SSL/TLS client connection to your upstream server without a certificate.
97+
98+
```bash
99+
openssl s_client -quiet -connect your-domain.ngrok.app:443 -verify_return_error
100+
```
101+
102+
```bash
103+
Connecting to 2600:1f16:d83:1200::6e:0
104+
depth=0 C=AU, ST=Some-State, O=Internet Widgits Pty Ltd, CN=your-domain.ngrok.app
105+
verify error:num=18:self-signed certificate
106+
408FB6F801000000:error:0A000086:SSL routines:tls_post_process_server_certificate:certificate verify failed:ssl/statem/statem_clnt.c:2093:
107+
```
108+
109+
The following example uses `openssl s_client` to initiate an SSL/TLS client connection to your upstream server with a certificate.
110+
111+
```bash
112+
openssl s_client -quiet -connect your-domain.ngrok.app:443 -verify_return_error -CAfile your-cert.crt
113+
```
114+
115+
```bash
116+
Connecting to 2600:1f16:d83:1200::6e:0
117+
depth=0 C=AU, ST=Some-State, O=Internet Widgits Pty Ltd, CN=your-domain.ngrok.app
118+
verify return:1
119+
hello, world!%
120+
```
121+
122+
:::note
123+
The extra arguments added to the command suppress most of the output so that only the data exchanged with the server will be displayed.
124+
:::
125+
126+
## Mutual TLS example
127+
128+
The following instructions will guide you through setting up Agent TLS termination using [Mutual TLS (mTLS)](/guides/other-guides/using-tls-mutual-authentication/) with ngrok.
129+
130+
### **Step 1** – Generate a root CA private key and certificate
131+
132+
```yaml
133+
openssl genpkey -algorithm RSA -out your-ca.key -pkeyopt rsa_keygen_bits:2048
134+
openssl req -x509 -new -nodes -key your-ca.key -sha256 -days 365 -out your-ca.crt -subj "/CN=YourDemoCA"
135+
```
136+
137+
### **Step 2** – Generate server credentials
138+
139+
The following terminal commands will generate these server credentials:
140+
141+
- A server private key
142+
- A CSR
143+
- A signed certificate
144+
145+
```bash
146+
openssl genpkey -algorithm RSA -out your-server.key -pkeyopt rsa_keygen_bits:2048
147+
openssl req -new -key your-server.key -out your-server.csr -subj "/CN=your-domain.ngrok.app"
148+
openssl x509 -req -in your-server.csr -CA your-ca.crt -CAkey your-ca.key -CAcreateserial -out your-server.crt -days 365 -sha256
149+
```
150+
151+
### **Step 3** – Generate client credentials
152+
153+
The following terminal command will generate these client credentials:
154+
155+
- A private key
156+
- A CSR
157+
- A signed certificate
158+
159+
```yaml
160+
openssl genpkey -algorithm RSA -out your-client.key -pkeyopt rsa_keygen_bits:2048
161+
openssl req -new -key your-client.key -out your-client.csr -subj "/CN=YourDemoCA"
162+
openssl x509 -req -in your-client.csr -CA your-ca.crt -CAkey your-ca.key -CAcreateserial -out your-client.crt -days 365 -sha256
163+
```
164+
165+
### **Step 4** – Configure your mTLS endpoint
166+
167+
Use the following command to create an agent configuration file with your generated certificates:
168+
169+
```bash
170+
ngrok config add-authtoken you-authtoken
171+
```
172+
173+
Your generated configuration file should resemble the following:
174+
175+
```yaml
176+
version: 3
177+
agent:
178+
authtoken: your-token
179+
endpoints:
180+
- name: demo-mtls
181+
url: "tls:/your-domain.ngrok.app"
182+
upstream:
183+
url: 8080
184+
agent_tls_termination:
185+
server_certificate: /path/to/your-cert.crt
186+
server_private_key: /path/to/your-key.key
187+
mutual_tls_certificate_authorities:
188+
- /path/to/your-ca.crt
189+
```
190+
191+
### **Step 5** – Start your mTLS endpoint
192+
193+
Next, use `ngrok start endpoint_name_here` in the terminal to start an endpoint using the settings in your agent configuration file, as shown below:
194+
195+
```bash
196+
ngrok start demo-mtls
197+
```
198+
199+
### **Step 6** – Start your upstream server
200+
201+
Start an upstream server on the specified port (e.g., `12345`) to handle incoming requests. The following example uses Python, but you can use any language or framework depending on your requirements.
202+
203+
```python
204+
import socket
205+
206+
host='127.0.0.1'
207+
port=12345
208+
server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
209+
server.bind((host, port))
210+
print(f"Server started on {host}:{port}")
211+
server.listen(1)
212+
213+
while True:
214+
client, client_address = server.accept()
215+
print(f"Connection established with {client_address}")
216+
client.sendall(b"hello, world!")
217+
client.close()
218+
print(f"Connection with {client_address} closed")
219+
```
220+
221+
### **Step 7** – Try connecting to your mTLS endpoint
222+
223+
The following example uses `openssl s_client` to initiate an SSL/TLS client connection to your upstream server without a certificate.
224+
225+
```bash
226+
openssl s_client -quiet -connect your-domain.ngrok.app:443 -verify_return_error
227+
```
228+
229+
```bash
230+
Connecting to 2600:1f16:d83:1200::6e:3
231+
depth=0 CN=your-domain.ngrok.app
232+
verify error:num=20:unable to get local issuer certificate
233+
408FB6F801000000:error:0A000086:SSL routines:tls_post_process_server_certificate:certificate verify failed:ssl/statem/statem_clnt.c:2093
234+
```
235+
236+
The following example uses `openssl s_client` to initiate an SSL/TLS client connection to your upstream server with a certificate.
237+
238+
```bash
239+
openssl s_client -quiet -connect your-domain.ngrok.app:443 -verify_return_error -CAfile your-ca.crt
240+
```
241+
242+
```bash
243+
Connecting to 2600:1f16:d83:1200::6e:3
244+
depth=1 CN=YourDemoCA
245+
verify return:1
246+
depth=0 CN=your-domain.ngrok.app
247+
verify return:1
248+
hello, world!%
249+
```

content/docs/agent/api.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ GET/api/tunnels
7272
{
7373
"name": "command_line",
7474
"uri": "/api/tunnels/command_line",
75-
"public_url": "https://d95211d2.ngrok.io",
75+
"public_url": "https://d95211d2.ngrok.app",
7676
"proto": "https",
7777
"config": {
7878
"addr": "localhost:80",
@@ -188,7 +188,7 @@ GET/api/tunnels/:name
188188
{
189189
"name": "command_line",
190190
"uri": "/api/tunnels/command_line",
191-
"public_url": "https://ac294125.ngrok.io",
191+
"public_url": "https://ac294125.ngrok.app",
192192
"proto": "https",
193193
"config": {
194194
"addr": "localhost:80",
@@ -292,7 +292,7 @@ curl http://localhost:4040/api/requests/http?limit=50
292292
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36"
293293
],
294294
"X-Original-Host": [
295-
"c159663f.ngrok.io"
295+
"c159663f.ngrok.app"
296296
]
297297
},
298298
"uri": "/favicon.ico",
@@ -392,7 +392,7 @@ GET/api/requests/http/:request_id
392392
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36"
393393
],
394394
"X-Original-Host": [
395-
"c159663f.ngrok.io"
395+
"c159663f.ngrok.app"
396396
]
397397
},
398398
"uri": "/favicon.ico",

0 commit comments

Comments
 (0)