forked from firezone/firezone
-
Notifications
You must be signed in to change notification settings - Fork 0
/
asyncapi.yml
265 lines (248 loc) · 7.16 KB
/
asyncapi.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
#
# Copy the contents of this file to studio.asyncapi.com to view the generated
# output.
#
# TODO: Add this to docs when repo goes public.
asyncapi: "2.5.0"
tags:
- name: gateway
description: Realtime API for Firezone Gateway
info:
license:
name: Apache 2.0
url: http://www.apache.org/licenses/LICENSE-2.0.html
title: Firezone Realtime API
version: "1.0.0"
contact:
name: Firezone
url: https://www.firezone.dev/
email: [email protected]
description: |
Realtime API documentation for Firezone's control plane.
externalDocs:
url: https://docs.firezone.dev/
servers:
public:
url: wss://firezone.example.com
protocol: wss
channels:
/v1/gateway-ctl:
subscribe:
operationId: subscribe
summary: Receive control commands for a connected gateway.
description: |
The gateway WebSocket channel.
message:
oneOf:
- $ref: "#/components/messages/add_rule"
- $ref: "#/components/messages/delete_rule"
- $ref: "#/components/messages/add_peer"
- $ref: "#/components/messages/delete_peer"
- $ref: "#/components/messages/init"
components:
messages:
add_rule:
summary: Adds an egress rule to the Gateway.
payload:
$ref: "#/components/schemas/add_rule"
examples:
- payload:
add_rule:
dst: 0.0.0.0/8
port_range:
range_start: 80
range_end: 81
protocol: tcp
user_uuid: 3118158c-29cb-47d6-adbf-5edd15f1af17
delete_rule:
summary: Removes an egress rule from the Gateway.
payload:
$ref: "#/components/schemas/delete_rule"
examples:
- payload:
delete_rule:
dst: 0.0.0.0/8
port_range:
range_start: 80
range_end: 81
protocol: tcp
user_uuid: 3118158c-29cb-47d6-adbf-5edd15f1af17
add_peer:
summary: Adds a peer to the receiver's WireGuard configuration.
payload:
$ref: "#/components/schemas/add_peer"
examples:
- name: Gateway example
payload:
add_peer:
public_key: AxVaJsPC1FSrOM5RpEXg4umTKMxkHkgMy1fl7t1xNyw=
preshared_key: LZBIpoLNCkIe56cPM+5pY/hP2pu7SGARvQZEThmuPYM=
user_uuid: 3118158c-29cb-47d6-adbf-5edd15f1af17
allowed_ips:
- 100.64.11.22/32
delete_peer:
summary: Removes a peer from the receiver's WireGuard configuration.
payload:
$ref: "#/components/schemas/delete_peer"
examples:
- name: Gateway example
payload:
delete_peer:
public_key: AxVaJsPC1FSrOM5RpEXg4umTKMxkHkgMy1fl7t1xNyw=
init:
summary: A control command to initialize the client with initial config
description: |
This command initializes a client with its configuration after successfully connecting the WebSocket.
payload:
$ref: "#/components/schemas/init"
examples:
- name: Gateway example
payload:
init:
default_action: deny
interface:
address:
- 100.64.11.22/10
mtu: 1280
peers:
- allowed_ips:
- 100.64.11.22/32
public_key: AxVaJsPC1FSrOM5RpEXg4umTKMxkHkgMy1fl7t1xNyw=
preshared_key: LZBIpoLNCkIe56cPM+5pY/hP2pu7SGARvQZEThmuPYM=
user_uuid: 3118158c-29cb-47d6-adbf-5edd15f1af17
schemas:
init:
required:
- init
summary: Gateway initialization
description: |
This message indicates the gateway should reconfigure itself with the contained configuration.
properties:
init:
type: object
required:
- peers
- interface
properties:
default_action:
summary: The default action taken by the gateway for the egress firewall.
type: string
enum:
- deny
- allow
peers:
type: array
items:
$ref: "#/components/schemas/peer"
interface:
required:
- mtu
- address
type: object
properties:
dns:
type: array
items:
type: string
mtu:
type: integer
listen_port:
type: integer
address:
type: array
description: The IPv4 and/or IPv6 address(es) to set on the interface.
items:
type: string
add_peer:
required:
- add_peer
summary: Add a Peer to the WireGuard configuration.
properties:
add_peer:
$ref: "#/components/schemas/peer"
delete_peer:
summary: Remove a Peer from the WireGuard configuration.
required:
- delete_peer
properties:
delete_peer:
type: object
required:
- public_key
properties:
public_key:
type: string
add_rule:
type: object
required:
- add_rule
summary: Add rule
description: |
A JSON representation of the rule specification.
properties:
add_rule:
$ref: "#/components/schemas/rule"
delete_rule:
required:
- delete_rule
summary: Delete Rule
type: object
properties:
delete_rule:
$ref: "#/components/schemas/rule"
rule:
type: object
description: |
A JSON representation of the rule specification.
required:
- dst
properties:
dst:
type: string
user_uuid:
type: string
port_range:
$ref: "#/components/schemas/port_range"
peer:
type: object
required:
- public_key
- preshared_key
- allowed_ips
properties:
user_uuid:
type: string
summary: Optional user_uuid used by the Gateway to group this peer's egress rules.
endpoint:
type: string
persistent_keepalive:
type: integer
public_key:
type: string
preshared_key:
type: string
allowed_ips:
type: array
items:
type: string
description: |
The IPs addresses to send through the tunnel.
For connected end-user devices, this will always be a /32 and/or /128.
For static tunnels to other gateways (site to site configuration) this can include multiple CIDRs.
port_range:
type: object
required:
- range_start
- range_end
properties:
range_start:
type: number
summary: starting port of the range, inclusive.
range_end:
type: number
summary: ending port of the range, inclusive.
protocol:
type: string
enum:
- tcp
- udp