-
Notifications
You must be signed in to change notification settings - Fork 137
/
Copy pathapi-doc.yml
1233 lines (1229 loc) · 41.4 KB
/
api-doc.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
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
swagger: "2.0"
info:
description: "To run API, use `--api-addr=yourserver:3000` CLI argument or enable it in config file"
version: "1.0.0"
title: "rportd HTTP(S) API"
host: "yourserver:3000"
basePath: "/api/v1"
securityDefinitions:
basic_auth:
type: basic
description: "HTTP-basic authentication works for all routes"
bearer_auth:
description: "Instead of HTTP basic authentication you can retrieve a bearer token using /login endpoint. Send the retrieved token in 'Authorization: Bearer <TOKEN>' header"
type: apiKey # actually apiKey is not correct type but 'bearer' type is not supported in swagger v2.0
in: header
name: "Authorization"
security:
- bearer_auth: []
- basic_auth: []
schemes:
- http
- https
tags:
- name: "Login"
description: For more details https://github.com/cloudradar-monitoring/rport/blob/master/docs/api-auth.md
- name: "Status"
- name: "Clients and Tunnels"
description: For more details https://github.com/cloudradar-monitoring/rport/blob/master/docs/managing-tunnels.md
- name: "Client Groups"
description: For more details https://github.com/cloudradar-monitoring/rport/blob/master/docs/client-groups.md
- name: "Rport Client Auth Credentials"
description: For more details https://github.com/cloudradar-monitoring/rport/blob/master/docs/client-auth.md
- name: "Commands"
description: For more details https://github.com/cloudradar-monitoring/rport/blob/master/docs/command-execution.md
paths:
/login:
get:
tags:
- "Login"
summary: "Generate or renew auth token. Requires HTTP-basic authorization"
description: ""
parameters:
- name: "token-lifetime"
in: "query"
description: "initial lifetime in seconds. Max value is 90 days. Default: 10 min"
required: false
default: 360
maximum: 7776000
type: "integer"
produces:
- "application/json"
responses:
"200":
description: "Successful Operation"
schema:
type: "object"
properties:
data:
type: "object"
properties:
token:
type: "string"
meta:
type: "object"
"400":
description: "Invalid parameters"
schema:
$ref: "#/definitions/ErrorPayload"
"401":
description: "Unauthorized"
schema:
$ref: "#/definitions/ErrorPayload"
"500":
description: "Invalid Operation"
schema:
$ref: "#/definitions/ErrorPayload"
post:
tags:
- "Login"
summary: "Generate or renew auth token. Requires username and password provided in request body"
description: "username and password parameters are required. They can be provided either in JSON either in x-www-formurlencoded format"
# swagger 2.0 does not allow describing a method that accepts multiple content-types
parameters:
- name: "token-lifetime"
in: "query"
description: "initial lifetime in seconds. Max value is 90 days. Default: 10 min"
required: false
default: 360
maximum: 7776000
type: "integer"
produces:
- "application/json"
responses:
"200":
description: ""
schema:
type: "object"
properties:
data:
type: "object"
properties:
token:
type: "string"
meta:
type: "object"
"400":
description: "Invalid parameters"
schema:
$ref: "#/definitions/ErrorPayload"
"401":
description: "Unauthorized"
schema:
$ref: "#/definitions/ErrorPayload"
"500":
description: "Invalid Operation"
schema:
$ref: "#/definitions/ErrorPayload"
delete:
tags:
- "Login"
summary: "Revoke token (logoff). Requires Bearer authorization provided"
description: ""
produces:
- "application/json"
responses:
"204":
description: "Token revoked"
"400":
description: "Invalid parameters"
schema:
$ref: "#/definitions/ErrorPayload"
"500":
description: "Invalid Operation"
schema:
$ref: "#/definitions/ErrorPayload"
/me:
get:
tags:
- "Login"
summary: "Return currently logged in user and groups the user belongs to"
description: ""
produces:
- "application/json"
responses:
"200":
description: "Successful Operation"
schema:
type: "object"
properties:
data:
type: "object"
properties:
user:
type: "string"
groups:
type: "array"
items:
type: string
meta:
type: "object"
"404":
description: "User not found"
schema:
$ref: "#/definitions/ErrorPayload"
"500":
description: "Invalid Operation"
schema:
$ref: "#/definitions/ErrorPayload"
/me/ip:
get:
tags:
- "Login"
summary: "Return a public ip address of a client who makes the request."
description: ""
produces:
- "application/json"
responses:
"200":
description: "Client's ip address"
schema:
type: "object"
properties:
data:
type: "object"
properties:
ip:
type: "string"
/status:
get:
tags:
- "Status"
summary: "Get information about rport server"
description: "Show health status, server version, etc"
produces:
- "application/json"
responses:
"200":
description: "Successful Operation"
schema:
type: "object"
properties:
data:
type: "object"
properties:
version:
type: "string"
clients_connected:
type: "integer"
clients_disconnected:
type: "integer"
clients_auth_source:
description: "The source of clients authentication credentials"
type: "string"
enum: ["Static Credentials", "File", "DB"]
clients_auth_mode:
description: "Shows whether it's allowed or not to create/update/delete clients authentication credentials"
type: "string"
enum: ["Read Only", "Read Write"]
fingerprint:
type: "string"
connect_url:
type: "string"
meta:
type: "object"
"500":
description: "Invalid Operation"
schema:
$ref: "#/definitions/ErrorPayload"
/clients:
get:
tags:
- "Clients and Tunnels"
parameters:
- name: "sort"
in: "query"
description: "Sort option `-<field>`(desc) or `<field>`(asc). `<field>` can be one of `'id', 'name', 'os', 'hostname', 'version'`. For example, `&sort=-name` or `&sort=hostname`, etc"
required: false
type: "string"
summary: "List all active and disconnected client connections. By default sorted by ID in asc order"
description: ""
produces:
- "application/json"
responses:
"200":
description: "success response"
schema:
type: "object"
properties:
data:
type: "array"
items:
$ref: "#/definitions/Client"
"400":
description: "invalid request parameters"
schema:
$ref: "#/definitions/ErrorPayload"
"500":
description: "invalid operation"
schema:
$ref: "#/definitions/ErrorPayload"
/clients/{client_id}/tunnels:
parameters:
- name: "client_id"
in: "path"
description: "unique client id retrieved previously"
required: true
type: "string"
- name: "local"
in: "query"
description: "local refers to the local port of the rport server to use for a new tunnel, e.g. '3390' or '0.0.0.0:3390'. If local is not specified, a random free server port will be selected automatically"
required: false
type: "string"
- name: "remote"
in: "query"
description: "remote address endpoint, e.g. '3389', '0.0.0.0:22' or '192.168.178.1:80', etc"
required: true
type: "string"
- name: "scheme"
in: "query"
description: "URI scheme to be used. For example, 'ssh', 'rdp', etc."
required: false
type: "string"
- name: "acl"
in: "query"
description: "ACL, IP addresses or ranges who is allowed to use the tunnel. For example, '142.78.90.8,201.98.123.0/24'"
required: false
type: "string"
- name: "check_port"
in: "query"
description: "A flag whether to check availability of a public port (remote). By default check is enabled. To disable it specify 'check_port=0'."
required: false
type: "string"
- name: "idle-timeout-minutes"
in: "query"
description: "Auto-close the tunnel after given period of inactivity in minutes. If 0 or not provided - auto-closing is disabled."
required: false
type: "integer"
maximum: 10080
minimum: 0
put:
tags:
- "Clients and Tunnels"
summary: "Request a new tunnel for an active client connection"
description: ""
produces:
- "application/json"
responses:
"200":
description: "success response"
schema:
type: "object"
properties:
data:
type: "object"
$ref: "#/definitions/Tunnel"
"400":
description: "invalid parameters. Error codes: ERR_CODE_LOCAL_PORT_IN_USE, ERR_CODE_REMOTE_PORT_NOT_OPEN, ERR_CODE_INVALID_ACL, ERR_CODE_TUNNEL_EXIST, ERR_CODE_TUNNEL_TO_PORT_EXIST, ERR_CODE_URI_SCHEME_LENGTH_EXCEED, ERR_CODE_INVALID_IDLE_TIMEOUT."
schema:
$ref: "#/definitions/ErrorPayload"
"404":
description: "specified client does not exist, already terminated ot disconnected"
schema:
$ref: "#/definitions/ErrorPayload"
"409":
description: "can't create requested tunnel. Probably port already busy"
schema:
$ref: "#/definitions/ErrorPayload"
"500":
description: "invalid operation"
schema:
$ref: "#/definitions/ErrorPayload"
/clients/{client_id}/tunnels/{tunnel_id}:
parameters:
- name: "client_id"
in: "path"
description: "unique client id retrieved previously"
required: true
type: "string"
- name: "tunnel_id"
in: "path"
description: "unique tunnel id retrieved previously"
required: true
type: "string"
- name: "force"
in: "query"
description: "If true, terminate a tunnel even when it is still active."
required: false
type: "boolean"
delete:
tags:
- "Clients and Tunnels"
summary: "Terminate a specified tunnel"
description: ""
responses:
"204":
description: "tunnel terminated"
"400":
description: "invalid parameters"
schema:
$ref: "#/definitions/ErrorPayload"
"404":
description: "specified client or tunnel does not exist or already terminated"
schema:
$ref: "#/definitions/ErrorPayload"
"409":
description: "specified tunnel is still active: it has active connections"
schema:
$ref: "#/definitions/ErrorPayload"
"500":
description: "invalid operation"
schema:
$ref: "#/definitions/ErrorPayload"
/clients/{client_id}/commands:
get:
tags:
- "Commands"
summary: "Return a short info about all client commands"
description: "Return a list of all running and finished commands sorted by finished time in desc order with running commands at the beginning"
produces:
- "application/json"
parameters:
- name: "client_id"
in: "path"
description: "unique client id retrieved previously"
required: true
type: "string"
responses:
"200":
description: "Successful Operation"
schema:
type: "object"
properties:
data:
type: "array"
items:
$ref: "#/definitions/JobSummary"
"500":
description: "Invalid Operation"
schema:
$ref: "#/definitions/ErrorPayload"
post:
tags:
- "Commands"
summary: "Execute a command by the rport client"
description: "NOTE: if command limitation is enabled by an rport client then a full path command can be required to use. See https://github.com/cloudradar-monitoring/rport/blob/master/docs/command-execution.md for more details"
produces:
- "application/json"
parameters:
- name: "client_id"
in: "path"
description: "unique client id retrieved previously"
required: true
type: "string"
- in: "body"
name: "body"
description: "remote command to execute by the rport client"
required: true
schema:
type: "object"
properties:
command:
type: "string"
description: "remote command to execute by the rport client. NOTE: if command limitation is enabled by an rport client then a full path command can be required to use. See https://github.com/cloudradar-monitoring/rport/blob/master/docs/command-execution.md for more details"
shell:
type: "string"
enum: [cmd, powershell]
description: "command shell to use to execute the command. Is applicable only for windows clients. If not set 'cmd' is used by default"
timeout_sec:
type: "integer"
description: "timeout in seconds to observe the command execution. If not set a default timeout (60 seconds) is used"
default: 60
responses:
"200":
description: "Successful Operation"
schema:
type: "object"
properties:
data:
type: "object"
properties:
jid:
type: "string"
description: "job id of the corresponding command"
"400":
description: "Invalid request parameters"
schema:
$ref: "#/definitions/ErrorPayload"
"404":
description: "Active client not found"
schema:
$ref: "#/definitions/ErrorPayload"
"409":
description: "Could not execute the command. Probably a previous command is still running"
schema:
$ref: "#/definitions/ErrorPayload"
"500":
description: "Invalid Operation"
schema:
$ref: "#/definitions/ErrorPayload"
/clients/{client_id}/commands/{job_id}:
get:
tags:
- "Commands"
summary: "Return a detailed info about a specific client command"
description: "Return a detailed info about a command by given job id"
produces:
- "application/json"
parameters:
- name: "client_id"
in: "path"
description: "unique client id retrieved previously"
required: true
type: "string"
- name: "job_id"
in: "path"
description: "unique job id retrieved previously"
required: true
type: "string"
responses:
"200":
description: "Successful Operation"
schema:
type: "object"
properties:
data:
$ref: "#/definitions/Job"
"404":
description: "Command not found with given client id and job id"
schema:
$ref: "#/definitions/ErrorPayload"
"500":
description: "Invalid Operation"
schema:
$ref: "#/definitions/ErrorPayload"
/commands:
get:
tags:
- "Commands"
summary: "Return a short info about all multi-client commands"
description: "Return a list of all running and finished commands sorted by started time in desc order"
produces:
- "application/json"
responses:
"200":
description: "Successful Operation"
schema:
type: "object"
properties:
data:
type: "array"
items:
$ref: "#/definitions/MultiJobSummary"
"500":
description: "Invalid Operation"
schema:
$ref: "#/definitions/ErrorPayload"
post:
tags:
- "Commands"
summary: "Execute a command on multiple rport clients"
description: "NOTE: if command limitation is enabled by an rport client then a full path command can be required to use. See https://github.com/cloudradar-monitoring/rport/blob/master/docs/command-execution.md for more details"
produces:
- "application/json"
parameters:
- in: "body"
name: "body"
description: "properties and remote command to execute by rport clients"
required: true
schema:
type: "object"
properties:
command:
type: "string"
description: "remote command to execute by rport clients. NOTE: if command limitation is enabled by an rport client then a full path command can be required to use. See https://github.com/cloudradar-monitoring/rport/blob/master/docs/command-execution.md for more details"
client_ids:
type: "array"
items:
type: string
description: "list of client IDs where to run the command. Min items is 2 if group_ids is not specified"
group_ids:
type: "array"
items:
type: string
description: "list of client group IDs. A command will be executed on all clients that belong to given group(s)"
shell:
type: "string"
enum: [cmd, powershell]
description: "command shell to use to execute the command. Is applicable only for windows clients. If not set 'cmd' is used by default"
timeout_sec:
type: "integer"
description: "timeout in seconds to observe the command execution on each client separately. If not set a default timeout (60 seconds) is used"
default: 60
execute_concurrently:
type: "boolean"
description: "if true - execute the command concurrently on clients. If false - sequentially in order that is in 'client_ids'. By default is false"
default: false
abort_on_error:
type: "boolean"
description: "applicable only if 'execute_concurrently' is false. If true - abort the entire cycle if the execution fails on some client. By default is true"
default: true
responses:
"200":
description: "Successful Operation"
schema:
type: "object"
properties:
data:
type: "object"
properties:
jid:
type: "string"
description: "multi job id of the corresponding command"
"400":
description: "Invalid request parameters"
schema:
$ref: "#/definitions/ErrorPayload"
"404":
description: "Client not found"
schema:
$ref: "#/definitions/ErrorPayload"
"500":
description: "Invalid Operation"
schema:
$ref: "#/definitions/ErrorPayload"
/commands/{job_id}:
get:
tags:
- "Commands"
summary: "Return a detailed info about a specific multi-client command"
description: "Return a detailed info about a multi-client command by given id with child jobs as well"
produces:
- "application/json"
parameters:
- name: "job_id"
in: "path"
description: "unique multi job id retrieved previously"
required: true
type: "string"
responses:
"200":
description: "Successful Operation"
schema:
type: "object"
properties:
data:
$ref: "#/definitions/MultiJob"
"400":
description: "Command not found with a given multi job id"
schema:
$ref: "#/definitions/ErrorPayload"
"500":
description: "Invalid Operation"
schema:
$ref: "#/definitions/ErrorPayload"
/ws/commands:
get:
tags:
- "Commands"
summary: "Web Socket Connection to execute a remote command on rport client(s)"
description: "
NOTE: swagger is not designed to document WebSocket API. This is a temporary solution.\n
A new web socket is created for each new request to execute a remote command on rport client(s).\n
Steps:\n
1. To pass authentication - include \"access_token\" param into the url. The value is a jwt token that is created by 'login' API endpoint.\n
2. Upgrades the current connection to Web Socket.\n
3. Then server waits for an inbound message from UI client. It should be a JSON object `ExecuteCmdRequest`(see in 'Models')\n
For example,\n
{\n
\"command\": \"/usr/bin/whoami\",\n
\"client_ids\": [ \"qa-lin-debian9\", \"qa-lin-debian10\", \"qa-lin-centos8\", \"qa-lin-ubuntu18\", \"qa-lin-ubuntu16\" ],\n
\"group_ids\": [ \"group-1\"],\n
\"timeout_sec\": 30,\n
\"execute_concurrently\": true\n
}\n
4. Validates the inbound msg. If it fails - server sends an outbound JSON message `ErrorPayload`(see in 'Models') and closes the connection.\n
5. Server sends a given command to rport client(s) to execute.\n
6. As soon as it gets a result from each rport client - it sends an outbound JSON message `Job`(see in 'Models').\n
It can contain a non-empty 'error' field if server wasn't able to send the command to the rport client.\n
Number of outbound messages is expected to be as many as rport clients. Or less if it's not a concurrent mode and 'abort_on_error' is turned on.\n
7. As soon as all rport clients send back the result - connection is closed by server.\n
8. Also, a current connection can be closed by UI client.\n
There is a simple UI for testing. Try it out http://127.0.0.1:3000/api/v1/test/commands/ui\n
"
produces:
- "application/json"
parameters:
- name: "access_token"
in: "query"
description: "JWT token that is created by 'login' API endpoint. Required to pass the authentication."
required: true
type: "string"
responses:
"200":
description: "On success upgrades current connection to websocket"
schema:
type: "object"
/clients-auth:
get:
tags:
- "Rport Client Auth Credentials"
summary: "Return all rport clients authentication credentials. Sorted by ID in asc order"
description: ""
produces:
- "application/json"
responses:
"200":
description: "Successful Operation"
schema:
type: "object"
properties:
data:
type: "array"
items:
$ref: "#/definitions/ClientAuth"
"500":
description: "Invalid Operation"
schema:
$ref: "#/definitions/ErrorPayload"
post:
tags:
- "Rport Client Auth Credentials"
summary: "Add new rport client authentication credentials"
description: ""
produces:
- "application/json"
parameters:
- in: "body"
name: "body"
description: "Client auth credentials to add"
required: true
schema:
$ref: "#/definitions/ClientAuth"
responses:
"204":
description: "New client auth credentials added"
"400":
description: "Invalid parameters"
schema:
$ref: "#/definitions/ErrorPayload"
"409":
description: "Client auth credentials already exist. Err code: ERR_CODE_ALREADY_EXIST"
schema:
$ref: "#/definitions/ErrorPayload"
"500":
description: "Invalid Operation"
schema:
$ref: "#/definitions/ErrorPayload"
/clients-auth/{client_auth_id}:
parameters:
- name: "client_auth_id"
in: "path"
description: "client auth ID"
required: true
type: "string"
- name: "force"
in: "query"
description: "If true, delete a client auth even when it has active/disconnected clients."
required: false
type: "boolean"
delete:
tags:
- "Rport Client Auth Credentials"
summary: "Delete rport client authentication credentials"
description: ""
responses:
"204":
description: "Client auth credentials deleted."
"400":
description: "Invalid parameters"
schema:
$ref: "#/definitions/ErrorPayload"
"404":
description: "Client auth credentials not found"
schema:
$ref: "#/definitions/ErrorPayload"
"405":
description: "Operation not allowed. Error codes: ERR_CODE_CLIENT_AUTH_SINGLE, ERR_CODE_CLIENT_AUTH_RO"
schema:
$ref: "#/definitions/ErrorPayload"
"409":
description: "Could not delete. Client Auth has active or disconnected bound client(s). Err code: ERR_CODE_CLIENT_AUTH_HAS_CLIENT"
schema:
$ref: "#/definitions/ErrorPayload"
"500":
description: "Invalid Operation"
schema:
$ref: "#/definitions/ErrorPayload"
/client-groups:
get:
tags:
- "Client Groups"
summary: "Return all client groups"
description: "Return a list of all existing client groups sorted by ID in asc order"
produces:
- "application/json"
responses:
"200":
description: "Successful Operation"
schema:
type: "object"
properties:
data:
type: "array"
items:
$ref: "#/definitions/ClientGroup"
"500":
description: "Invalid Operation"
schema:
$ref: "#/definitions/ErrorPayload"
post:
tags:
- "Client Groups"
summary: "Create a new client group"
description: "Create a new client group."
produces:
- "application/json"
parameters:
- in: "body"
name: "client group"
description: "Client group to create. Note: ClientGroup.client_ids field should not be set. It's read-only"
required: true
schema:
$ref: '#/definitions/ClientGroup'
responses:
"201":
description: "Successful Operation"
"400":
description: "Invalid request parameters"
schema:
$ref: "#/definitions/ErrorPayload"
"500":
description: "Invalid Operation"
schema:
$ref: "#/definitions/ErrorPayload"
/client-groups/{group_id}:
get:
tags:
- "Client Groups"
summary: "Return a client group"
description: "Return a detailed info about a client group by a given id"
produces:
- "application/json"
parameters:
- name: "group_id"
in: "path"
description: "unique client group ID"
required: true
type: "string"
responses:
"200":
description: "Successful Operation"
schema:
type: "object"
properties:
data:
$ref: "#/definitions/ClientGroup"
"404":
description: "Client group not found"
schema:
$ref: "#/definitions/ErrorPayload"
"500":
description: "Invalid Operation"
schema:
$ref: "#/definitions/ErrorPayload"
put:
tags:
- "Client Groups"
summary: "Save a client group"
description: "Update an existing client group or save a new client group"
produces:
- "application/json"
parameters:
- name: "group_id"
in: "path"
description: "unique client group ID"
required: true
type: "string"
- in: "body"
name: "client group"
description: "Client group to save. Note: ClientGroup.client_ids field should not be set."
required: true
schema:
$ref: '#/definitions/ClientGroup'
responses:
"204":
description: "Successful Operation"
"400":
description: "Invalid request parameters"
schema:
$ref: "#/definitions/ErrorPayload"
"500":
description: "Invalid Operation"
schema:
$ref: "#/definitions/ErrorPayload"
delete:
tags:
- "Client Groups"
summary: "Delete a client group"
description: "Delete a client group by a given id"
produces:
- "application/json"
parameters:
- name: "group_id"
in: "path"
description: "unique client group ID"
required: true
type: "string"
responses:
"204":
description: "Successful Operation"
"500":
description: "Invalid Operation"
schema:
$ref: "#/definitions/ErrorPayload"
definitions:
Tunnel:
type: "object"
properties:
id:
type: "string"
lhost:
type: "string"
description: "server listens to this host"
lport:
type: "string"
description: "server listens to this port"
rhost:
type: "string"
description: "client proxies connection to this host"
rport:
type: "string"
description: "client proxies connection to this port"
lport_random:
type: "boolean"
description: "True if lport was chosen automatically with a random available port."
scheme:
type: "string"
description: "URI scheme."
acl:
type: "string"
description: "IP addresses who is allowed to use the tunnel. For example, '142.78.90.8,201.98.123.0/24,'."
Client:
type: "object"
properties:
id:
type: "string"
name:
type: "string"
description: "client name"
os:
type: "string"
description: "client OS description"
os_arch:
type: "string"
description: "client cpu architecture (ex: 386, amd64)"
os_family:
type: "string"
description: "client OS family (ex: debian, alpine, Standalone Workstation)"
os_kernel:
type: "string"
description: "client OS kernel (ex: linux, windows)"
hostname:
type: "string"
description: "client hostname"
ipv4:
type: "array"
items:
type: string
description: "list of IPv4 addresses of the client"
ipv6:
type: "array"
items:
type: string
description: "list of IPv6 addresses of the client"
tags:
type: "array"
items:
type: string
version:
type: "string"
description: "client version"
address:
type: "string"
description: "client address"
tunnels:
type: "array"
items:
$ref: "#/definitions/Tunnel"
connection_state:
type: "string"
enum: [connected, disconnected]
description: "indicates whether a client is connected or disconnected"
disconnected_at:
type: "string"
format: "data-time"
description: "time when a client was disconnected. If null - it's connected"
client_auth_id:
type: "string"
description: "rport client authentication ID that was used to connect to server"
ClientGroup:
type: "object"
properties:
id:
type: "string"
description: "Client Group ID"
description:
type: "string"
description: "Client Group description"
client_ids:
type: "array"
items:
type: string
description: "Read Only field. Shows active and disconnected clients that belong to this group."
params:
type: "object"
description: "Parameters that define what clients belong to a given client group.\n
Each parameter can be specified by:\n
1. exact match of the property (ignoring case). For example, \"client_id\": [\"test-win2019-tk01\", \"qa-lin-ubuntu16\"]\n
2. dynamic criteria using wildcards (ignoring case). For example, \"os_family\": [\"linux*\"]\n
For more details please see https://github.com/cloudradar-monitoring/rport/blob/master/docs/client-groups.md\n"
properties:
client_id:
type: "array"
items:
type: string
description: "client ID(s)"
name:
type: "array"
items:
type: string
description: "client name(s)"
os:
type: "array"
items:
type: string
description: "client OS description(s)"