@teamnetwork-nz/sonicwall-api-mcp-server 0.8.1 → 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -0
- package/dist/index.js +397 -255
- package/dist/strict-tools.js +3 -3
- package/package.json +52 -52
package/dist/index.js
CHANGED
|
@@ -55,21 +55,21 @@ function parsePositiveInt(name, raw, fallback, maximum) {
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
// src/config.ts
|
|
58
|
-
var
|
|
59
|
-
var DeviceProfileSchema =
|
|
60
|
-
name:
|
|
61
|
-
host:
|
|
62
|
-
username:
|
|
63
|
-
password:
|
|
64
|
-
port:
|
|
65
|
-
sslVerify:
|
|
66
|
-
readOnly:
|
|
67
|
-
requestTimeout:
|
|
58
|
+
var import_v3 = require("zod/v3");
|
|
59
|
+
var DeviceProfileSchema = import_v3.z.object({
|
|
60
|
+
name: import_v3.z.string().min(1),
|
|
61
|
+
host: import_v3.z.string().min(1),
|
|
62
|
+
username: import_v3.z.string().min(1),
|
|
63
|
+
password: import_v3.z.string().min(1),
|
|
64
|
+
port: import_v3.z.number().int().min(1).max(65535),
|
|
65
|
+
sslVerify: import_v3.z.boolean(),
|
|
66
|
+
readOnly: import_v3.z.boolean(),
|
|
67
|
+
requestTimeout: import_v3.z.number().int().min(1).max(300)
|
|
68
68
|
}).strict();
|
|
69
|
-
var ConfigSchema =
|
|
70
|
-
profiles:
|
|
71
|
-
transport:
|
|
72
|
-
ssePort:
|
|
69
|
+
var ConfigSchema = import_v3.z.object({
|
|
70
|
+
profiles: import_v3.z.array(DeviceProfileSchema).min(1),
|
|
71
|
+
transport: import_v3.z.enum(["stdio", "http"]),
|
|
72
|
+
ssePort: import_v3.z.number().int().min(1).max(65535)
|
|
73
73
|
}).strict();
|
|
74
74
|
function loadConfig() {
|
|
75
75
|
const devicesFile = process.env.SONICWALL_DEVICES_FILE;
|
|
@@ -306,8 +306,8 @@ var AuthManager = class {
|
|
|
306
306
|
throw new AuthenticationError("Login rejected \u2014 check username and password.");
|
|
307
307
|
}
|
|
308
308
|
if (resp.status >= 400) {
|
|
309
|
-
const
|
|
310
|
-
throw new AuthenticationError(`Login failed with HTTP ${resp.status}: ${
|
|
309
|
+
const text2 = await resp.text().catch(() => "");
|
|
310
|
+
throw new AuthenticationError(`Login failed with HTTP ${resp.status}: ${text2.slice(0, 200)}`);
|
|
311
311
|
}
|
|
312
312
|
try {
|
|
313
313
|
const body = await resp.json();
|
|
@@ -419,7 +419,7 @@ var SonicWallClient = class {
|
|
|
419
419
|
await this.auth.logout(this.baseUrl);
|
|
420
420
|
}
|
|
421
421
|
async request(method, path, options) {
|
|
422
|
-
const isWrite = WRITE_METHODS.has(method.toUpperCase());
|
|
422
|
+
const isWrite = WRITE_METHODS.has(method.toUpperCase()) && !options?.readonlyAction;
|
|
423
423
|
if (this.profile.readOnly && isWrite) {
|
|
424
424
|
throw new ReadOnlyError(method.toUpperCase(), path);
|
|
425
425
|
}
|
|
@@ -472,8 +472,8 @@ var SonicWallClient = class {
|
|
|
472
472
|
await this._throwApiError(resp);
|
|
473
473
|
}
|
|
474
474
|
this.auth.touch();
|
|
475
|
-
const
|
|
476
|
-
return
|
|
475
|
+
const text2 = await resp.text();
|
|
476
|
+
return text2 ? JSON.parse(text2) : {};
|
|
477
477
|
}
|
|
478
478
|
throw new Error("unreachable");
|
|
479
479
|
}
|
|
@@ -506,6 +506,10 @@ var SonicWallClient = class {
|
|
|
506
506
|
post(path, body) {
|
|
507
507
|
return this.request("POST", path, { body });
|
|
508
508
|
}
|
|
509
|
+
/** Execute a POST endpoint whose semantics are read-only (for example diagnostics). */
|
|
510
|
+
postAction(path, body) {
|
|
511
|
+
return this.request("POST", path, { body, readonlyAction: true });
|
|
512
|
+
}
|
|
509
513
|
put(path, body) {
|
|
510
514
|
return this.request("PUT", path, { body });
|
|
511
515
|
}
|
|
@@ -566,7 +570,7 @@ var DeviceRegistry = class {
|
|
|
566
570
|
};
|
|
567
571
|
|
|
568
572
|
// src/tools/system.ts
|
|
569
|
-
var
|
|
573
|
+
var import_v32 = require("zod/v3");
|
|
570
574
|
function registerSystemTools(server, registry) {
|
|
571
575
|
server.tool(
|
|
572
576
|
"list_devices",
|
|
@@ -584,7 +588,7 @@ function registerSystemTools(server, registry) {
|
|
|
584
588
|
server.tool(
|
|
585
589
|
"get_system_status",
|
|
586
590
|
"Return device model, firmware version, serial number, and uptime.",
|
|
587
|
-
{ device:
|
|
591
|
+
{ device: import_v32.z.string().optional() },
|
|
588
592
|
async ({ device }) => {
|
|
589
593
|
try {
|
|
590
594
|
const client = await registry.getClient(device);
|
|
@@ -598,7 +602,7 @@ function registerSystemTools(server, registry) {
|
|
|
598
602
|
server.tool(
|
|
599
603
|
"commit_config",
|
|
600
604
|
"Commit all staged configuration changes so they take effect on the appliance. Must be called after any create/update/delete operation or changes will be lost.",
|
|
601
|
-
{ device:
|
|
605
|
+
{ device: import_v32.z.string().optional() },
|
|
602
606
|
async ({ device }) => {
|
|
603
607
|
try {
|
|
604
608
|
const client = await registry.getClient(device);
|
|
@@ -612,7 +616,7 @@ function registerSystemTools(server, registry) {
|
|
|
612
616
|
server.tool(
|
|
613
617
|
"discard_config",
|
|
614
618
|
"Discard all staged configuration changes without applying them.",
|
|
615
|
-
{ device:
|
|
619
|
+
{ device: import_v32.z.string().optional() },
|
|
616
620
|
async ({ device }) => {
|
|
617
621
|
try {
|
|
618
622
|
const client = await registry.getClient(device);
|
|
@@ -626,7 +630,7 @@ function registerSystemTools(server, registry) {
|
|
|
626
630
|
server.tool(
|
|
627
631
|
"get_pending_config",
|
|
628
632
|
"Show configuration changes that have been staged but not yet committed.",
|
|
629
|
-
{ device:
|
|
633
|
+
{ device: import_v32.z.string().optional() },
|
|
630
634
|
async ({ device }) => {
|
|
631
635
|
try {
|
|
632
636
|
const client = await registry.getClient(device);
|
|
@@ -640,15 +644,15 @@ function registerSystemTools(server, registry) {
|
|
|
640
644
|
}
|
|
641
645
|
|
|
642
646
|
// src/tools/address-objects.ts
|
|
643
|
-
var
|
|
647
|
+
var import_v33 = require("zod/v3");
|
|
644
648
|
var ALL_TYPES = ["ipv4", "ipv6", "fqdn", "mac"];
|
|
645
649
|
function registerAddressObjectTools(server, registry) {
|
|
646
650
|
server.tool(
|
|
647
651
|
"list_address_objects",
|
|
648
652
|
"List address objects on the appliance. type: filter by 'ipv4', 'ipv6', 'fqdn', 'mac', or 'all' (default).",
|
|
649
653
|
{
|
|
650
|
-
type:
|
|
651
|
-
device:
|
|
654
|
+
type: import_v33.z.enum(["ipv4", "ipv6", "fqdn", "mac", "all"]).optional().default("all"),
|
|
655
|
+
device: import_v33.z.string().optional()
|
|
652
656
|
},
|
|
653
657
|
async ({ type, device }) => {
|
|
654
658
|
try {
|
|
@@ -679,9 +683,9 @@ function registerAddressObjectTools(server, registry) {
|
|
|
679
683
|
"get_address_object",
|
|
680
684
|
"Retrieve a single address object by name and type.",
|
|
681
685
|
{
|
|
682
|
-
name:
|
|
683
|
-
type:
|
|
684
|
-
device:
|
|
686
|
+
name: import_v33.z.string(),
|
|
687
|
+
type: import_v33.z.enum(["ipv4", "ipv6", "fqdn", "mac"]),
|
|
688
|
+
device: import_v33.z.string().optional()
|
|
685
689
|
},
|
|
686
690
|
async ({ name, type, device }) => {
|
|
687
691
|
try {
|
|
@@ -697,14 +701,14 @@ function registerAddressObjectTools(server, registry) {
|
|
|
697
701
|
"create_address_object_ipv4",
|
|
698
702
|
"Create an IPv4 address object. Provide exactly one of: host (single IP or CIDR), network+subnet_mask, or range_begin+range_end. Changes are STAGED; call commit_config to apply.",
|
|
699
703
|
{
|
|
700
|
-
name:
|
|
701
|
-
zone:
|
|
702
|
-
host:
|
|
703
|
-
network:
|
|
704
|
-
subnet_mask:
|
|
705
|
-
range_begin:
|
|
706
|
-
range_end:
|
|
707
|
-
device:
|
|
704
|
+
name: import_v33.z.string(),
|
|
705
|
+
zone: import_v33.z.string(),
|
|
706
|
+
host: import_v33.z.string().optional(),
|
|
707
|
+
network: import_v33.z.string().optional(),
|
|
708
|
+
subnet_mask: import_v33.z.string().optional(),
|
|
709
|
+
range_begin: import_v33.z.string().optional(),
|
|
710
|
+
range_end: import_v33.z.string().optional(),
|
|
711
|
+
device: import_v33.z.string().optional()
|
|
708
712
|
},
|
|
709
713
|
async ({ name, zone, host, network, subnet_mask, range_begin, range_end, device }) => {
|
|
710
714
|
try {
|
|
@@ -730,12 +734,12 @@ function registerAddressObjectTools(server, registry) {
|
|
|
730
734
|
"create_address_object_ipv6",
|
|
731
735
|
"Create an IPv6 address object. Provide either address (single IPv6) or network+prefix_length. Changes are STAGED; call commit_config to apply.",
|
|
732
736
|
{
|
|
733
|
-
name:
|
|
734
|
-
zone:
|
|
735
|
-
address:
|
|
736
|
-
network:
|
|
737
|
-
prefix_length:
|
|
738
|
-
device:
|
|
737
|
+
name: import_v33.z.string(),
|
|
738
|
+
zone: import_v33.z.string(),
|
|
739
|
+
address: import_v33.z.string().optional(),
|
|
740
|
+
network: import_v33.z.string().optional(),
|
|
741
|
+
prefix_length: import_v33.z.number().optional(),
|
|
742
|
+
device: import_v33.z.string().optional()
|
|
739
743
|
},
|
|
740
744
|
async ({ name, zone, address, network, prefix_length, device }) => {
|
|
741
745
|
try {
|
|
@@ -759,10 +763,10 @@ function registerAddressObjectTools(server, registry) {
|
|
|
759
763
|
"create_address_object_fqdn",
|
|
760
764
|
"Create an FQDN address object. Changes are STAGED; call commit_config to apply.",
|
|
761
765
|
{
|
|
762
|
-
name:
|
|
763
|
-
zone:
|
|
764
|
-
domain:
|
|
765
|
-
device:
|
|
766
|
+
name: import_v33.z.string(),
|
|
767
|
+
zone: import_v33.z.string(),
|
|
768
|
+
domain: import_v33.z.string(),
|
|
769
|
+
device: import_v33.z.string().optional()
|
|
766
770
|
},
|
|
767
771
|
async ({ name, zone, domain, device }) => {
|
|
768
772
|
try {
|
|
@@ -780,14 +784,14 @@ function registerAddressObjectTools(server, registry) {
|
|
|
780
784
|
"update_address_object",
|
|
781
785
|
"Update an existing address object. Only supplied fields are changed (GET-then-PUT). Changes are STAGED; call commit_config to apply.",
|
|
782
786
|
{
|
|
783
|
-
name:
|
|
784
|
-
type:
|
|
785
|
-
zone:
|
|
786
|
-
host:
|
|
787
|
-
network:
|
|
788
|
-
subnet_mask:
|
|
789
|
-
domain:
|
|
790
|
-
device:
|
|
787
|
+
name: import_v33.z.string(),
|
|
788
|
+
type: import_v33.z.enum(["ipv4", "ipv6", "fqdn", "mac"]),
|
|
789
|
+
zone: import_v33.z.string().optional(),
|
|
790
|
+
host: import_v33.z.string().optional(),
|
|
791
|
+
network: import_v33.z.string().optional(),
|
|
792
|
+
subnet_mask: import_v33.z.string().optional(),
|
|
793
|
+
domain: import_v33.z.string().optional(),
|
|
794
|
+
device: import_v33.z.string().optional()
|
|
791
795
|
},
|
|
792
796
|
async ({ name, type, zone, host, network, subnet_mask, domain, device }) => {
|
|
793
797
|
try {
|
|
@@ -812,9 +816,9 @@ function registerAddressObjectTools(server, registry) {
|
|
|
812
816
|
"delete_address_object",
|
|
813
817
|
"Delete an address object by name and type. Changes are STAGED; call commit_config to apply.",
|
|
814
818
|
{
|
|
815
|
-
name:
|
|
816
|
-
type:
|
|
817
|
-
device:
|
|
819
|
+
name: import_v33.z.string(),
|
|
820
|
+
type: import_v33.z.enum(["ipv4", "ipv6", "fqdn", "mac"]),
|
|
821
|
+
device: import_v33.z.string().optional()
|
|
818
822
|
},
|
|
819
823
|
async ({ name, type, device }) => {
|
|
820
824
|
try {
|
|
@@ -829,14 +833,14 @@ function registerAddressObjectTools(server, registry) {
|
|
|
829
833
|
}
|
|
830
834
|
|
|
831
835
|
// src/tools/address-groups.ts
|
|
832
|
-
var
|
|
836
|
+
var import_v34 = require("zod/v3");
|
|
833
837
|
function registerAddressGroupTools(server, registry) {
|
|
834
838
|
server.tool(
|
|
835
839
|
"list_address_groups",
|
|
836
840
|
"List address groups on the appliance. type: filter by 'ipv4', 'ipv6', or 'all' (default).",
|
|
837
841
|
{
|
|
838
|
-
type:
|
|
839
|
-
device:
|
|
842
|
+
type: import_v34.z.enum(["ipv4", "ipv6", "all"]).optional().default("all"),
|
|
843
|
+
device: import_v34.z.string().optional()
|
|
840
844
|
},
|
|
841
845
|
async ({ type, device }) => {
|
|
842
846
|
try {
|
|
@@ -867,9 +871,9 @@ function registerAddressGroupTools(server, registry) {
|
|
|
867
871
|
"get_address_group",
|
|
868
872
|
"Retrieve a single address group by name.",
|
|
869
873
|
{
|
|
870
|
-
name:
|
|
871
|
-
type:
|
|
872
|
-
device:
|
|
874
|
+
name: import_v34.z.string(),
|
|
875
|
+
type: import_v34.z.enum(["ipv4", "ipv6"]),
|
|
876
|
+
device: import_v34.z.string().optional()
|
|
873
877
|
},
|
|
874
878
|
async ({ name, type, device }) => {
|
|
875
879
|
try {
|
|
@@ -885,10 +889,10 @@ function registerAddressGroupTools(server, registry) {
|
|
|
885
889
|
"create_address_group",
|
|
886
890
|
"Create an address group with the given member object names. members: list of address object names. Changes are STAGED; call commit_config to apply.",
|
|
887
891
|
{
|
|
888
|
-
name:
|
|
889
|
-
type:
|
|
890
|
-
members:
|
|
891
|
-
device:
|
|
892
|
+
name: import_v34.z.string(),
|
|
893
|
+
type: import_v34.z.enum(["ipv4", "ipv6"]),
|
|
894
|
+
members: import_v34.z.array(import_v34.z.string()),
|
|
895
|
+
device: import_v34.z.string().optional()
|
|
892
896
|
},
|
|
893
897
|
async ({ name, type, members, device }) => {
|
|
894
898
|
try {
|
|
@@ -907,10 +911,10 @@ function registerAddressGroupTools(server, registry) {
|
|
|
907
911
|
"add_address_group_member",
|
|
908
912
|
"Add a member address object to an existing address group. Changes are STAGED; call commit_config to apply.",
|
|
909
913
|
{
|
|
910
|
-
group_name:
|
|
911
|
-
type:
|
|
912
|
-
member_name:
|
|
913
|
-
device:
|
|
914
|
+
group_name: import_v34.z.string(),
|
|
915
|
+
type: import_v34.z.enum(["ipv4", "ipv6"]),
|
|
916
|
+
member_name: import_v34.z.string(),
|
|
917
|
+
device: import_v34.z.string().optional()
|
|
914
918
|
},
|
|
915
919
|
async ({ group_name, type, member_name, device }) => {
|
|
916
920
|
try {
|
|
@@ -936,10 +940,10 @@ function registerAddressGroupTools(server, registry) {
|
|
|
936
940
|
"remove_address_group_member",
|
|
937
941
|
"Remove a member address object from an address group. Changes are STAGED; call commit_config to apply.",
|
|
938
942
|
{
|
|
939
|
-
group_name:
|
|
940
|
-
type:
|
|
941
|
-
member_name:
|
|
942
|
-
device:
|
|
943
|
+
group_name: import_v34.z.string(),
|
|
944
|
+
type: import_v34.z.enum(["ipv4", "ipv6"]),
|
|
945
|
+
member_name: import_v34.z.string(),
|
|
946
|
+
device: import_v34.z.string().optional()
|
|
943
947
|
},
|
|
944
948
|
async ({ group_name, type, member_name, device }) => {
|
|
945
949
|
try {
|
|
@@ -962,9 +966,9 @@ function registerAddressGroupTools(server, registry) {
|
|
|
962
966
|
"delete_address_group",
|
|
963
967
|
"Delete an address group by name. Changes are STAGED; call commit_config to apply.",
|
|
964
968
|
{
|
|
965
|
-
name:
|
|
966
|
-
type:
|
|
967
|
-
device:
|
|
969
|
+
name: import_v34.z.string(),
|
|
970
|
+
type: import_v34.z.enum(["ipv4", "ipv6"]),
|
|
971
|
+
device: import_v34.z.string().optional()
|
|
968
972
|
},
|
|
969
973
|
async ({ name, type, device }) => {
|
|
970
974
|
try {
|
|
@@ -979,13 +983,13 @@ function registerAddressGroupTools(server, registry) {
|
|
|
979
983
|
}
|
|
980
984
|
|
|
981
985
|
// src/tools/service-objects.ts
|
|
982
|
-
var
|
|
986
|
+
var import_v35 = require("zod/v3");
|
|
983
987
|
var PROTOCOLS = ["TCP", "UDP", "ICMP", "ICMPv6", "IGMP", "GRE", "ESP", "AH", "OTHER"];
|
|
984
988
|
function registerServiceObjectTools(server, registry) {
|
|
985
989
|
server.tool(
|
|
986
990
|
"list_service_objects",
|
|
987
991
|
"List all service objects on the appliance.",
|
|
988
|
-
{ device:
|
|
992
|
+
{ device: import_v35.z.string().optional() },
|
|
989
993
|
async ({ device }) => {
|
|
990
994
|
try {
|
|
991
995
|
const client = await registry.getClient(device);
|
|
@@ -999,7 +1003,7 @@ function registerServiceObjectTools(server, registry) {
|
|
|
999
1003
|
server.tool(
|
|
1000
1004
|
"get_service_object",
|
|
1001
1005
|
"Retrieve a service object by name.",
|
|
1002
|
-
{ name:
|
|
1006
|
+
{ name: import_v35.z.string(), device: import_v35.z.string().optional() },
|
|
1003
1007
|
async ({ name, device }) => {
|
|
1004
1008
|
try {
|
|
1005
1009
|
const client = await registry.getClient(device);
|
|
@@ -1014,13 +1018,13 @@ function registerServiceObjectTools(server, registry) {
|
|
|
1014
1018
|
"create_service_object",
|
|
1015
1019
|
"Create a service object. For TCP/UDP: provide port_begin (and optionally port_end for a range). For ICMP/ICMPv6: provide icmp_type and optionally icmp_code. Changes are STAGED; call commit_config to apply.",
|
|
1016
1020
|
{
|
|
1017
|
-
name:
|
|
1018
|
-
protocol:
|
|
1019
|
-
port_begin:
|
|
1020
|
-
port_end:
|
|
1021
|
-
icmp_type:
|
|
1022
|
-
icmp_code:
|
|
1023
|
-
device:
|
|
1021
|
+
name: import_v35.z.string(),
|
|
1022
|
+
protocol: import_v35.z.enum(PROTOCOLS),
|
|
1023
|
+
port_begin: import_v35.z.number().optional(),
|
|
1024
|
+
port_end: import_v35.z.number().optional(),
|
|
1025
|
+
icmp_type: import_v35.z.number().optional(),
|
|
1026
|
+
icmp_code: import_v35.z.number().optional(),
|
|
1027
|
+
device: import_v35.z.string().optional()
|
|
1024
1028
|
},
|
|
1025
1029
|
async ({ name, protocol, port_begin, port_end, icmp_type, icmp_code, device }) => {
|
|
1026
1030
|
try {
|
|
@@ -1047,12 +1051,12 @@ function registerServiceObjectTools(server, registry) {
|
|
|
1047
1051
|
"update_service_object",
|
|
1048
1052
|
"Update port or ICMP fields on an existing service object (GET-then-PUT). Changes are STAGED; call commit_config to apply.",
|
|
1049
1053
|
{
|
|
1050
|
-
name:
|
|
1051
|
-
port_begin:
|
|
1052
|
-
port_end:
|
|
1053
|
-
icmp_type:
|
|
1054
|
-
icmp_code:
|
|
1055
|
-
device:
|
|
1054
|
+
name: import_v35.z.string(),
|
|
1055
|
+
port_begin: import_v35.z.number().optional(),
|
|
1056
|
+
port_end: import_v35.z.number().optional(),
|
|
1057
|
+
icmp_type: import_v35.z.number().optional(),
|
|
1058
|
+
icmp_code: import_v35.z.number().optional(),
|
|
1059
|
+
device: import_v35.z.string().optional()
|
|
1056
1060
|
},
|
|
1057
1061
|
async ({ name, port_begin, port_end, icmp_type, icmp_code, device }) => {
|
|
1058
1062
|
try {
|
|
@@ -1089,7 +1093,7 @@ function registerServiceObjectTools(server, registry) {
|
|
|
1089
1093
|
server.tool(
|
|
1090
1094
|
"delete_service_object",
|
|
1091
1095
|
"Delete a service object by name. Changes are STAGED; call commit_config to apply.",
|
|
1092
|
-
{ name:
|
|
1096
|
+
{ name: import_v35.z.string(), device: import_v35.z.string().optional() },
|
|
1093
1097
|
async ({ name, device }) => {
|
|
1094
1098
|
try {
|
|
1095
1099
|
const client = await registry.getClient(device);
|
|
@@ -1103,12 +1107,12 @@ function registerServiceObjectTools(server, registry) {
|
|
|
1103
1107
|
}
|
|
1104
1108
|
|
|
1105
1109
|
// src/tools/service-groups.ts
|
|
1106
|
-
var
|
|
1110
|
+
var import_v36 = require("zod/v3");
|
|
1107
1111
|
function registerServiceGroupTools(server, registry) {
|
|
1108
1112
|
server.tool(
|
|
1109
1113
|
"list_service_groups",
|
|
1110
1114
|
"List all service groups on the appliance.",
|
|
1111
|
-
{ device:
|
|
1115
|
+
{ device: import_v36.z.string().optional() },
|
|
1112
1116
|
async ({ device }) => {
|
|
1113
1117
|
try {
|
|
1114
1118
|
const client = await registry.getClient(device);
|
|
@@ -1122,7 +1126,7 @@ function registerServiceGroupTools(server, registry) {
|
|
|
1122
1126
|
server.tool(
|
|
1123
1127
|
"get_service_group",
|
|
1124
1128
|
"Retrieve a service group by name.",
|
|
1125
|
-
{ name:
|
|
1129
|
+
{ name: import_v36.z.string(), device: import_v36.z.string().optional() },
|
|
1126
1130
|
async ({ name, device }) => {
|
|
1127
1131
|
try {
|
|
1128
1132
|
const client = await registry.getClient(device);
|
|
@@ -1137,9 +1141,9 @@ function registerServiceGroupTools(server, registry) {
|
|
|
1137
1141
|
"create_service_group",
|
|
1138
1142
|
"Create a service group containing the given service object names. Changes are STAGED; call commit_config to apply.",
|
|
1139
1143
|
{
|
|
1140
|
-
name:
|
|
1141
|
-
members:
|
|
1142
|
-
device:
|
|
1144
|
+
name: import_v36.z.string(),
|
|
1145
|
+
members: import_v36.z.array(import_v36.z.string()),
|
|
1146
|
+
device: import_v36.z.string().optional()
|
|
1143
1147
|
},
|
|
1144
1148
|
async ({ name, members, device }) => {
|
|
1145
1149
|
try {
|
|
@@ -1157,9 +1161,9 @@ function registerServiceGroupTools(server, registry) {
|
|
|
1157
1161
|
"add_service_group_member",
|
|
1158
1162
|
"Add a service object to an existing service group (GET-then-PUT). Changes are STAGED; call commit_config to apply.",
|
|
1159
1163
|
{
|
|
1160
|
-
group_name:
|
|
1161
|
-
member_name:
|
|
1162
|
-
device:
|
|
1164
|
+
group_name: import_v36.z.string(),
|
|
1165
|
+
member_name: import_v36.z.string(),
|
|
1166
|
+
device: import_v36.z.string().optional()
|
|
1163
1167
|
},
|
|
1164
1168
|
async ({ group_name, member_name, device }) => {
|
|
1165
1169
|
try {
|
|
@@ -1183,9 +1187,9 @@ function registerServiceGroupTools(server, registry) {
|
|
|
1183
1187
|
"remove_service_group_member",
|
|
1184
1188
|
"Remove a service object from a service group (GET-then-PUT). Changes are STAGED; call commit_config to apply.",
|
|
1185
1189
|
{
|
|
1186
|
-
group_name:
|
|
1187
|
-
member_name:
|
|
1188
|
-
device:
|
|
1190
|
+
group_name: import_v36.z.string(),
|
|
1191
|
+
member_name: import_v36.z.string(),
|
|
1192
|
+
device: import_v36.z.string().optional()
|
|
1189
1193
|
},
|
|
1190
1194
|
async ({ group_name, member_name, device }) => {
|
|
1191
1195
|
try {
|
|
@@ -1205,7 +1209,7 @@ function registerServiceGroupTools(server, registry) {
|
|
|
1205
1209
|
server.tool(
|
|
1206
1210
|
"delete_service_group",
|
|
1207
1211
|
"Delete a service group by name. Changes are STAGED; call commit_config to apply.",
|
|
1208
|
-
{ name:
|
|
1212
|
+
{ name: import_v36.z.string(), device: import_v36.z.string().optional() },
|
|
1209
1213
|
async ({ name, device }) => {
|
|
1210
1214
|
try {
|
|
1211
1215
|
const client = await registry.getClient(device);
|
|
@@ -1219,12 +1223,12 @@ function registerServiceGroupTools(server, registry) {
|
|
|
1219
1223
|
}
|
|
1220
1224
|
|
|
1221
1225
|
// src/tools/access-rules.ts
|
|
1222
|
-
var
|
|
1226
|
+
var import_v37 = require("zod/v3");
|
|
1223
1227
|
function zoneName(v) {
|
|
1224
1228
|
if (typeof v === "string") return v;
|
|
1225
1229
|
if (v && typeof v === "object") {
|
|
1226
|
-
const
|
|
1227
|
-
if (typeof
|
|
1230
|
+
const z18 = v.zone;
|
|
1231
|
+
if (typeof z18 === "string") return z18;
|
|
1228
1232
|
}
|
|
1229
1233
|
return void 0;
|
|
1230
1234
|
}
|
|
@@ -1236,10 +1240,10 @@ function registerAccessRuleTools(server, registry) {
|
|
|
1236
1240
|
"list_access_rules",
|
|
1237
1241
|
"List firewall access rules, optionally filtered by source and/or destination zone. Filtering is applied client-side over the complete ruleset; matched is the number returned and total is the unfiltered rule count (not pagination). Use each rule's uuid value as rule_uuid for get/update/enable/disable/delete tools.",
|
|
1238
1242
|
{
|
|
1239
|
-
ip_version:
|
|
1240
|
-
from_zone:
|
|
1241
|
-
to_zone:
|
|
1242
|
-
device:
|
|
1243
|
+
ip_version: import_v37.z.enum(["ipv4", "ipv6"]).optional().default("ipv4"),
|
|
1244
|
+
from_zone: import_v37.z.string().optional(),
|
|
1245
|
+
to_zone: import_v37.z.string().optional(),
|
|
1246
|
+
device: import_v37.z.string().optional()
|
|
1243
1247
|
},
|
|
1244
1248
|
async ({ ip_version, from_zone, to_zone, device }) => {
|
|
1245
1249
|
try {
|
|
@@ -1267,9 +1271,9 @@ function registerAccessRuleTools(server, registry) {
|
|
|
1267
1271
|
"get_access_rule",
|
|
1268
1272
|
"Retrieve a single access rule by UUID. Pass a rule's uuid value from list_access_rules as rule_uuid.",
|
|
1269
1273
|
{
|
|
1270
|
-
rule_uuid:
|
|
1271
|
-
ip_version:
|
|
1272
|
-
device:
|
|
1274
|
+
rule_uuid: import_v37.z.string().uuid(),
|
|
1275
|
+
ip_version: import_v37.z.enum(["ipv4", "ipv6"]).optional().default("ipv4"),
|
|
1276
|
+
device: import_v37.z.string().optional()
|
|
1273
1277
|
},
|
|
1274
1278
|
async ({ rule_uuid, ip_version, device }) => {
|
|
1275
1279
|
try {
|
|
@@ -1285,20 +1289,20 @@ function registerAccessRuleTools(server, registry) {
|
|
|
1285
1289
|
"create_access_rule",
|
|
1286
1290
|
"Create a firewall access rule. source/destination/service: name of an existing address/service object or 'Any'. geo_ip_policy: name of a GeoIP policy that already exists on the appliance (GeoIP policies cannot be created or listed via this server \u2014 manage them in the appliance web UI). Changes are STAGED; call commit_config to apply.",
|
|
1287
1291
|
{
|
|
1288
|
-
ip_version:
|
|
1289
|
-
name:
|
|
1290
|
-
action:
|
|
1291
|
-
from_zone:
|
|
1292
|
-
to_zone:
|
|
1293
|
-
source:
|
|
1294
|
-
destination:
|
|
1295
|
-
service:
|
|
1296
|
-
enabled:
|
|
1297
|
-
log:
|
|
1298
|
-
priority:
|
|
1299
|
-
geo_ip_policy:
|
|
1300
|
-
comment:
|
|
1301
|
-
device:
|
|
1292
|
+
ip_version: import_v37.z.enum(["ipv4", "ipv6"]),
|
|
1293
|
+
name: import_v37.z.string(),
|
|
1294
|
+
action: import_v37.z.enum(["allow", "deny", "discard"]),
|
|
1295
|
+
from_zone: import_v37.z.string(),
|
|
1296
|
+
to_zone: import_v37.z.string(),
|
|
1297
|
+
source: import_v37.z.string(),
|
|
1298
|
+
destination: import_v37.z.string(),
|
|
1299
|
+
service: import_v37.z.string(),
|
|
1300
|
+
enabled: import_v37.z.boolean().optional().default(true),
|
|
1301
|
+
log: import_v37.z.boolean().optional().default(true),
|
|
1302
|
+
priority: import_v37.z.number().optional(),
|
|
1303
|
+
geo_ip_policy: import_v37.z.string().optional(),
|
|
1304
|
+
comment: import_v37.z.string().optional(),
|
|
1305
|
+
device: import_v37.z.string().optional()
|
|
1302
1306
|
},
|
|
1303
1307
|
async ({ ip_version, name, action, from_zone, to_zone, source, destination, service, enabled, log, priority, geo_ip_policy, comment, device }) => {
|
|
1304
1308
|
try {
|
|
@@ -1330,17 +1334,17 @@ function registerAccessRuleTools(server, registry) {
|
|
|
1330
1334
|
"update_access_rule",
|
|
1331
1335
|
"Update an access rule selected by UUID (GET-then-PUT). Pass a rule's uuid value from list_access_rules as rule_uuid. Only provided fields are changed. geo_ip_policy: name of an existing appliance GeoIP policy, or '' to remove it. Changes are STAGED; call commit_config to apply.",
|
|
1332
1336
|
{
|
|
1333
|
-
rule_uuid:
|
|
1334
|
-
ip_version:
|
|
1335
|
-
action:
|
|
1336
|
-
source:
|
|
1337
|
-
destination:
|
|
1338
|
-
service:
|
|
1339
|
-
enabled:
|
|
1340
|
-
log:
|
|
1341
|
-
geo_ip_policy:
|
|
1342
|
-
comment:
|
|
1343
|
-
device:
|
|
1337
|
+
rule_uuid: import_v37.z.string().uuid(),
|
|
1338
|
+
ip_version: import_v37.z.enum(["ipv4", "ipv6"]).optional().default("ipv4"),
|
|
1339
|
+
action: import_v37.z.enum(["allow", "deny", "discard"]).optional(),
|
|
1340
|
+
source: import_v37.z.string().optional(),
|
|
1341
|
+
destination: import_v37.z.string().optional(),
|
|
1342
|
+
service: import_v37.z.string().optional(),
|
|
1343
|
+
enabled: import_v37.z.boolean().optional(),
|
|
1344
|
+
log: import_v37.z.boolean().optional(),
|
|
1345
|
+
geo_ip_policy: import_v37.z.string().optional(),
|
|
1346
|
+
comment: import_v37.z.string().optional(),
|
|
1347
|
+
device: import_v37.z.string().optional()
|
|
1344
1348
|
},
|
|
1345
1349
|
async ({ rule_uuid, ip_version, action, source, destination, service, enabled, log, geo_ip_policy, comment, device }) => {
|
|
1346
1350
|
try {
|
|
@@ -1382,9 +1386,9 @@ function registerAccessRuleTools(server, registry) {
|
|
|
1382
1386
|
"delete_access_rule",
|
|
1383
1387
|
"Delete an access rule by UUID. Copy rule_uuid from list_access_rules. Changes are STAGED; call commit_config to apply.",
|
|
1384
1388
|
{
|
|
1385
|
-
rule_uuid:
|
|
1386
|
-
ip_version:
|
|
1387
|
-
device:
|
|
1389
|
+
rule_uuid: import_v37.z.string().uuid(),
|
|
1390
|
+
ip_version: import_v37.z.enum(["ipv4", "ipv6"]).optional().default("ipv4"),
|
|
1391
|
+
device: import_v37.z.string().optional()
|
|
1388
1392
|
},
|
|
1389
1393
|
async ({ rule_uuid, ip_version, device }) => {
|
|
1390
1394
|
try {
|
|
@@ -1400,9 +1404,9 @@ function registerAccessRuleTools(server, registry) {
|
|
|
1400
1404
|
"enable_access_rule",
|
|
1401
1405
|
"Enable an access rule selected by UUID without modifying other fields. Copy rule_uuid from list_access_rules. Changes are STAGED; call commit_config to apply.",
|
|
1402
1406
|
{
|
|
1403
|
-
rule_uuid:
|
|
1404
|
-
ip_version:
|
|
1405
|
-
device:
|
|
1407
|
+
rule_uuid: import_v37.z.string().uuid(),
|
|
1408
|
+
ip_version: import_v37.z.enum(["ipv4", "ipv6"]).optional().default("ipv4"),
|
|
1409
|
+
device: import_v37.z.string().optional()
|
|
1406
1410
|
},
|
|
1407
1411
|
async ({ rule_uuid, ip_version, device }) => {
|
|
1408
1412
|
try {
|
|
@@ -1425,9 +1429,9 @@ function registerAccessRuleTools(server, registry) {
|
|
|
1425
1429
|
"disable_access_rule",
|
|
1426
1430
|
"Disable an access rule selected by UUID without deleting it. Copy rule_uuid from list_access_rules. Changes are STAGED; call commit_config to apply.",
|
|
1427
1431
|
{
|
|
1428
|
-
rule_uuid:
|
|
1429
|
-
ip_version:
|
|
1430
|
-
device:
|
|
1432
|
+
rule_uuid: import_v37.z.string().uuid(),
|
|
1433
|
+
ip_version: import_v37.z.enum(["ipv4", "ipv6"]).optional().default("ipv4"),
|
|
1434
|
+
device: import_v37.z.string().optional()
|
|
1431
1435
|
},
|
|
1432
1436
|
async ({ rule_uuid, ip_version, device }) => {
|
|
1433
1437
|
try {
|
|
@@ -1449,7 +1453,7 @@ function registerAccessRuleTools(server, registry) {
|
|
|
1449
1453
|
}
|
|
1450
1454
|
|
|
1451
1455
|
// src/tools/nat-policies.ts
|
|
1452
|
-
var
|
|
1456
|
+
var import_v38 = require("zod/v3");
|
|
1453
1457
|
function interfaceValue(value) {
|
|
1454
1458
|
return value.toLowerCase() === "any" ? "any" : value;
|
|
1455
1459
|
}
|
|
@@ -1466,7 +1470,7 @@ async function resolveRef(client, kind, value, ipVersion, allowOriginal) {
|
|
|
1466
1470
|
throw e;
|
|
1467
1471
|
}
|
|
1468
1472
|
}
|
|
1469
|
-
var prioritySchema =
|
|
1473
|
+
var prioritySchema = import_v38.z.union([import_v38.z.number().int().min(1), import_v38.z.literal("auto")]).optional().describe("Rule order: lower number = evaluated first. A positive integer sets a manual priority; 'auto' lets SonicOS assign it.");
|
|
1470
1474
|
function priorityField(priority) {
|
|
1471
1475
|
return priority === "auto" ? { auto: true } : { manual: priority };
|
|
1472
1476
|
}
|
|
@@ -1475,8 +1479,8 @@ function registerNatPolicyTools(server, registry) {
|
|
|
1475
1479
|
"list_nat_policies",
|
|
1476
1480
|
"List all NAT policies. ip_version: 'ipv4' (default) or 'ipv6'. Use each policy's uuid value as policy_uuid for get/update/enable/disable/delete tools.",
|
|
1477
1481
|
{
|
|
1478
|
-
ip_version:
|
|
1479
|
-
device:
|
|
1482
|
+
ip_version: import_v38.z.enum(["ipv4", "ipv6"]).optional().default("ipv4"),
|
|
1483
|
+
device: import_v38.z.string().optional()
|
|
1480
1484
|
},
|
|
1481
1485
|
async ({ ip_version, device }) => {
|
|
1482
1486
|
try {
|
|
@@ -1492,9 +1496,9 @@ function registerNatPolicyTools(server, registry) {
|
|
|
1492
1496
|
"get_nat_policy",
|
|
1493
1497
|
"Retrieve a NAT policy by UUID. Pass a policy's uuid value from list_nat_policies as policy_uuid.",
|
|
1494
1498
|
{
|
|
1495
|
-
policy_uuid:
|
|
1496
|
-
ip_version:
|
|
1497
|
-
device:
|
|
1499
|
+
policy_uuid: import_v38.z.string().uuid(),
|
|
1500
|
+
ip_version: import_v38.z.enum(["ipv4", "ipv6"]).optional().default("ipv4"),
|
|
1501
|
+
device: import_v38.z.string().optional()
|
|
1498
1502
|
},
|
|
1499
1503
|
async ({ policy_uuid, ip_version, device }) => {
|
|
1500
1504
|
try {
|
|
@@ -1510,21 +1514,21 @@ function registerNatPolicyTools(server, registry) {
|
|
|
1510
1514
|
"create_nat_policy",
|
|
1511
1515
|
"Create a NAT policy. Address and service fields take an object or group name (groups are detected automatically) or 'Any'; translated fields also accept 'Original' for no translation. Interfaces take a name like 'X1' or 'Any'. Optional priority sets rule order (lower number = evaluated first). Changes are STAGED; call commit_config to apply.",
|
|
1512
1516
|
{
|
|
1513
|
-
name:
|
|
1514
|
-
original_source:
|
|
1515
|
-
translated_source:
|
|
1516
|
-
original_destination:
|
|
1517
|
-
translated_destination:
|
|
1518
|
-
original_service:
|
|
1519
|
-
translated_service:
|
|
1520
|
-
inbound_interface:
|
|
1521
|
-
outbound_interface:
|
|
1522
|
-
ip_version:
|
|
1523
|
-
enabled:
|
|
1524
|
-
dns_doctoring:
|
|
1517
|
+
name: import_v38.z.string(),
|
|
1518
|
+
original_source: import_v38.z.string(),
|
|
1519
|
+
translated_source: import_v38.z.string(),
|
|
1520
|
+
original_destination: import_v38.z.string(),
|
|
1521
|
+
translated_destination: import_v38.z.string(),
|
|
1522
|
+
original_service: import_v38.z.string(),
|
|
1523
|
+
translated_service: import_v38.z.string(),
|
|
1524
|
+
inbound_interface: import_v38.z.string().optional().default("Any"),
|
|
1525
|
+
outbound_interface: import_v38.z.string().optional().default("Any"),
|
|
1526
|
+
ip_version: import_v38.z.enum(["ipv4", "ipv6"]).optional().default("ipv4"),
|
|
1527
|
+
enabled: import_v38.z.boolean().optional().default(true),
|
|
1528
|
+
dns_doctoring: import_v38.z.boolean().optional().default(false),
|
|
1525
1529
|
priority: prioritySchema,
|
|
1526
|
-
comment:
|
|
1527
|
-
device:
|
|
1530
|
+
comment: import_v38.z.string().optional(),
|
|
1531
|
+
device: import_v38.z.string().optional()
|
|
1528
1532
|
},
|
|
1529
1533
|
async ({ name, original_source, translated_source, original_destination, translated_destination, original_service, translated_service, inbound_interface, outbound_interface, ip_version, enabled, dns_doctoring, priority, comment, device }) => {
|
|
1530
1534
|
try {
|
|
@@ -1557,21 +1561,21 @@ function registerNatPolicyTools(server, registry) {
|
|
|
1557
1561
|
"update_nat_policy",
|
|
1558
1562
|
"Update a NAT policy selected by UUID (GET-then-PUT). Pass a policy's uuid value from list_nat_policies as policy_uuid. dns_doctoring can be changed independently. priority changes rule order (lower number = evaluated first; 'auto' lets SonicOS assign it). Position 1 is held by the built-in IKE policy, so use 2 or higher; an unavailable priority can return success yet be ignored, so confirm with get_nat_policy. Changes are STAGED; call commit_config to apply.",
|
|
1559
1563
|
{
|
|
1560
|
-
policy_uuid:
|
|
1561
|
-
ip_version:
|
|
1562
|
-
original_source:
|
|
1563
|
-
translated_source:
|
|
1564
|
-
original_destination:
|
|
1565
|
-
translated_destination:
|
|
1566
|
-
original_service:
|
|
1567
|
-
translated_service:
|
|
1568
|
-
inbound_interface:
|
|
1569
|
-
outbound_interface:
|
|
1570
|
-
enabled:
|
|
1571
|
-
dns_doctoring:
|
|
1564
|
+
policy_uuid: import_v38.z.string().uuid(),
|
|
1565
|
+
ip_version: import_v38.z.enum(["ipv4", "ipv6"]).optional().default("ipv4"),
|
|
1566
|
+
original_source: import_v38.z.string().optional(),
|
|
1567
|
+
translated_source: import_v38.z.string().optional(),
|
|
1568
|
+
original_destination: import_v38.z.string().optional(),
|
|
1569
|
+
translated_destination: import_v38.z.string().optional(),
|
|
1570
|
+
original_service: import_v38.z.string().optional(),
|
|
1571
|
+
translated_service: import_v38.z.string().optional(),
|
|
1572
|
+
inbound_interface: import_v38.z.string().optional(),
|
|
1573
|
+
outbound_interface: import_v38.z.string().optional(),
|
|
1574
|
+
enabled: import_v38.z.boolean().optional(),
|
|
1575
|
+
dns_doctoring: import_v38.z.boolean().optional(),
|
|
1572
1576
|
priority: prioritySchema,
|
|
1573
|
-
comment:
|
|
1574
|
-
device:
|
|
1577
|
+
comment: import_v38.z.string().optional(),
|
|
1578
|
+
device: import_v38.z.string().optional()
|
|
1575
1579
|
},
|
|
1576
1580
|
async ({ policy_uuid, ip_version, original_source, translated_source, original_destination, translated_destination, original_service, translated_service, inbound_interface, outbound_interface, enabled, dns_doctoring, priority, comment, device }) => {
|
|
1577
1581
|
try {
|
|
@@ -1605,9 +1609,9 @@ function registerNatPolicyTools(server, registry) {
|
|
|
1605
1609
|
"delete_nat_policy",
|
|
1606
1610
|
"Delete a NAT policy by UUID. Copy policy_uuid from list_nat_policies. Changes are STAGED; call commit_config to apply.",
|
|
1607
1611
|
{
|
|
1608
|
-
policy_uuid:
|
|
1609
|
-
ip_version:
|
|
1610
|
-
device:
|
|
1612
|
+
policy_uuid: import_v38.z.string().uuid(),
|
|
1613
|
+
ip_version: import_v38.z.enum(["ipv4", "ipv6"]).optional().default("ipv4"),
|
|
1614
|
+
device: import_v38.z.string().optional()
|
|
1611
1615
|
},
|
|
1612
1616
|
async ({ policy_uuid, ip_version, device }) => {
|
|
1613
1617
|
try {
|
|
@@ -1632,9 +1636,9 @@ function registerNatPolicyTools(server, registry) {
|
|
|
1632
1636
|
"enable_nat_policy",
|
|
1633
1637
|
"Enable a NAT policy selected by UUID without modifying other fields. Copy policy_uuid from list_nat_policies. Changes are STAGED; call commit_config to apply.",
|
|
1634
1638
|
{
|
|
1635
|
-
policy_uuid:
|
|
1636
|
-
ip_version:
|
|
1637
|
-
device:
|
|
1639
|
+
policy_uuid: import_v38.z.string().uuid(),
|
|
1640
|
+
ip_version: import_v38.z.enum(["ipv4", "ipv6"]).optional().default("ipv4"),
|
|
1641
|
+
device: import_v38.z.string().optional()
|
|
1638
1642
|
},
|
|
1639
1643
|
async ({ policy_uuid, ip_version, device }) => {
|
|
1640
1644
|
try {
|
|
@@ -1649,9 +1653,9 @@ function registerNatPolicyTools(server, registry) {
|
|
|
1649
1653
|
"disable_nat_policy",
|
|
1650
1654
|
"Disable a NAT policy selected by UUID without deleting it. Copy policy_uuid from list_nat_policies. Changes are STAGED; call commit_config to apply.",
|
|
1651
1655
|
{
|
|
1652
|
-
policy_uuid:
|
|
1653
|
-
ip_version:
|
|
1654
|
-
device:
|
|
1656
|
+
policy_uuid: import_v38.z.string().uuid(),
|
|
1657
|
+
ip_version: import_v38.z.enum(["ipv4", "ipv6"]).optional().default("ipv4"),
|
|
1658
|
+
device: import_v38.z.string().optional()
|
|
1655
1659
|
},
|
|
1656
1660
|
async ({ policy_uuid, ip_version, device }) => {
|
|
1657
1661
|
try {
|
|
@@ -1665,12 +1669,12 @@ function registerNatPolicyTools(server, registry) {
|
|
|
1665
1669
|
}
|
|
1666
1670
|
|
|
1667
1671
|
// src/tools/security-policies.ts
|
|
1668
|
-
var
|
|
1672
|
+
var import_v39 = require("zod/v3");
|
|
1669
1673
|
function zoneName2(v) {
|
|
1670
1674
|
if (typeof v === "string") return v;
|
|
1671
1675
|
if (v && typeof v === "object") {
|
|
1672
|
-
const
|
|
1673
|
-
if (typeof
|
|
1676
|
+
const z18 = v.zone;
|
|
1677
|
+
if (typeof z18 === "string") return z18;
|
|
1674
1678
|
}
|
|
1675
1679
|
return void 0;
|
|
1676
1680
|
}
|
|
@@ -1682,10 +1686,10 @@ function registerSecurityPolicyTools(server, registry) {
|
|
|
1682
1686
|
"list_security_policies",
|
|
1683
1687
|
"List security policies, optionally filtered by source and/or destination zone. Filtering is applied client-side (the SonicOS endpoint returns the full ruleset), so use from_zone/to_zone to keep responses small.",
|
|
1684
1688
|
{
|
|
1685
|
-
ip_version:
|
|
1686
|
-
from_zone:
|
|
1687
|
-
to_zone:
|
|
1688
|
-
device:
|
|
1689
|
+
ip_version: import_v39.z.enum(["ipv4", "ipv6"]).optional().default("ipv4"),
|
|
1690
|
+
from_zone: import_v39.z.string().optional(),
|
|
1691
|
+
to_zone: import_v39.z.string().optional(),
|
|
1692
|
+
device: import_v39.z.string().optional()
|
|
1689
1693
|
},
|
|
1690
1694
|
async ({ ip_version, from_zone, to_zone, device }) => {
|
|
1691
1695
|
try {
|
|
@@ -1713,9 +1717,9 @@ function registerSecurityPolicyTools(server, registry) {
|
|
|
1713
1717
|
"get_security_policy",
|
|
1714
1718
|
"Retrieve a security policy by its numeric ID.",
|
|
1715
1719
|
{
|
|
1716
|
-
policy_id:
|
|
1717
|
-
ip_version:
|
|
1718
|
-
device:
|
|
1720
|
+
policy_id: import_v39.z.number(),
|
|
1721
|
+
ip_version: import_v39.z.enum(["ipv4", "ipv6"]).optional().default("ipv4"),
|
|
1722
|
+
device: import_v39.z.string().optional()
|
|
1719
1723
|
},
|
|
1720
1724
|
async ({ policy_id, ip_version, device }) => {
|
|
1721
1725
|
try {
|
|
@@ -1731,20 +1735,20 @@ function registerSecurityPolicyTools(server, registry) {
|
|
|
1731
1735
|
"create_security_policy",
|
|
1732
1736
|
"Create a security policy. action: typically 'allow' or 'deny'. source_address/destination_address: address object or group name, or 'Any'. service: service object or group name, or 'Any'. Changes are STAGED; call commit_config to apply.",
|
|
1733
1737
|
{
|
|
1734
|
-
name:
|
|
1735
|
-
source_zone:
|
|
1736
|
-
destination_zone:
|
|
1737
|
-
source_address:
|
|
1738
|
-
destination_address:
|
|
1739
|
-
service:
|
|
1740
|
-
action:
|
|
1741
|
-
ip_version:
|
|
1742
|
-
users:
|
|
1743
|
-
schedule:
|
|
1744
|
-
enabled:
|
|
1745
|
-
log:
|
|
1746
|
-
comment:
|
|
1747
|
-
device:
|
|
1738
|
+
name: import_v39.z.string(),
|
|
1739
|
+
source_zone: import_v39.z.string(),
|
|
1740
|
+
destination_zone: import_v39.z.string(),
|
|
1741
|
+
source_address: import_v39.z.string(),
|
|
1742
|
+
destination_address: import_v39.z.string(),
|
|
1743
|
+
service: import_v39.z.string(),
|
|
1744
|
+
action: import_v39.z.string(),
|
|
1745
|
+
ip_version: import_v39.z.enum(["ipv4", "ipv6"]).optional().default("ipv4"),
|
|
1746
|
+
users: import_v39.z.array(import_v39.z.string()).optional(),
|
|
1747
|
+
schedule: import_v39.z.string().optional(),
|
|
1748
|
+
enabled: import_v39.z.boolean().optional().default(true),
|
|
1749
|
+
log: import_v39.z.boolean().optional().default(true),
|
|
1750
|
+
comment: import_v39.z.string().optional(),
|
|
1751
|
+
device: import_v39.z.string().optional()
|
|
1748
1752
|
},
|
|
1749
1753
|
async ({ name, source_zone, destination_zone, source_address, destination_address, service, action, ip_version, users, schedule, enabled, log, comment, device }) => {
|
|
1750
1754
|
try {
|
|
@@ -1776,16 +1780,16 @@ function registerSecurityPolicyTools(server, registry) {
|
|
|
1776
1780
|
"update_security_policy",
|
|
1777
1781
|
"Update fields on an existing security policy (GET-then-PUT). Only provided fields are changed. Changes are STAGED; call commit_config to apply.",
|
|
1778
1782
|
{
|
|
1779
|
-
policy_id:
|
|
1780
|
-
ip_version:
|
|
1781
|
-
action:
|
|
1782
|
-
source_address:
|
|
1783
|
-
destination_address:
|
|
1784
|
-
service:
|
|
1785
|
-
enabled:
|
|
1786
|
-
log:
|
|
1787
|
-
comment:
|
|
1788
|
-
device:
|
|
1783
|
+
policy_id: import_v39.z.number(),
|
|
1784
|
+
ip_version: import_v39.z.enum(["ipv4", "ipv6"]).optional().default("ipv4"),
|
|
1785
|
+
action: import_v39.z.string().optional(),
|
|
1786
|
+
source_address: import_v39.z.string().optional(),
|
|
1787
|
+
destination_address: import_v39.z.string().optional(),
|
|
1788
|
+
service: import_v39.z.string().optional(),
|
|
1789
|
+
enabled: import_v39.z.boolean().optional(),
|
|
1790
|
+
log: import_v39.z.boolean().optional(),
|
|
1791
|
+
comment: import_v39.z.string().optional(),
|
|
1792
|
+
device: import_v39.z.string().optional()
|
|
1789
1793
|
},
|
|
1790
1794
|
async ({ policy_id, ip_version, action, source_address, destination_address, service, enabled, log, comment, device }) => {
|
|
1791
1795
|
try {
|
|
@@ -1819,9 +1823,9 @@ function registerSecurityPolicyTools(server, registry) {
|
|
|
1819
1823
|
"delete_security_policy",
|
|
1820
1824
|
"Delete a security policy by ID. Changes are STAGED; call commit_config to apply.",
|
|
1821
1825
|
{
|
|
1822
|
-
policy_id:
|
|
1823
|
-
ip_version:
|
|
1824
|
-
device:
|
|
1826
|
+
policy_id: import_v39.z.number(),
|
|
1827
|
+
ip_version: import_v39.z.enum(["ipv4", "ipv6"]).optional().default("ipv4"),
|
|
1828
|
+
device: import_v39.z.string().optional()
|
|
1825
1829
|
},
|
|
1826
1830
|
async ({ policy_id, ip_version, device }) => {
|
|
1827
1831
|
try {
|
|
@@ -1836,7 +1840,7 @@ function registerSecurityPolicyTools(server, registry) {
|
|
|
1836
1840
|
}
|
|
1837
1841
|
|
|
1838
1842
|
// src/tools/geo-ip.ts
|
|
1839
|
-
var
|
|
1843
|
+
var import_v310 = require("zod/v3");
|
|
1840
1844
|
function parseGeoLookup(ip, raw) {
|
|
1841
1845
|
const parsed = {
|
|
1842
1846
|
ip,
|
|
@@ -1881,7 +1885,7 @@ function registerGeoIpTools(server, registry) {
|
|
|
1881
1885
|
server.tool(
|
|
1882
1886
|
"lookup_ip_country",
|
|
1883
1887
|
"Look up the geographic location of an IP address using the appliance's built-in GeoIP database. Returns country, city, region, and botnet classification if available. Requires an active GeoIP subscription.",
|
|
1884
|
-
{ ip:
|
|
1888
|
+
{ ip: import_v310.z.string(), device: import_v310.z.string().optional() },
|
|
1885
1889
|
async ({ ip, device }) => {
|
|
1886
1890
|
try {
|
|
1887
1891
|
const client = await registry.getClient(device);
|
|
@@ -1896,7 +1900,7 @@ function registerGeoIpTools(server, registry) {
|
|
|
1896
1900
|
}
|
|
1897
1901
|
|
|
1898
1902
|
// src/tools/logs.ts
|
|
1899
|
-
var
|
|
1903
|
+
var import_v311 = require("zod/v3");
|
|
1900
1904
|
async function getWithFallback(client, candidates) {
|
|
1901
1905
|
let lastError;
|
|
1902
1906
|
for (const path of candidates) {
|
|
@@ -1916,7 +1920,7 @@ function registerLogTools(server, registry) {
|
|
|
1916
1920
|
server.tool(
|
|
1917
1921
|
"get_log_categories",
|
|
1918
1922
|
"List SonicOS log category configuration. This describes available event categories; it does not return recorded runtime log entries.",
|
|
1919
|
-
{ device:
|
|
1923
|
+
{ device: import_v311.z.string().optional() },
|
|
1920
1924
|
async ({ device }) => {
|
|
1921
1925
|
try {
|
|
1922
1926
|
const client = await registry.getClient(device);
|
|
@@ -1930,7 +1934,7 @@ function registerLogTools(server, registry) {
|
|
|
1930
1934
|
server.tool(
|
|
1931
1935
|
"list_log_event_definitions",
|
|
1932
1936
|
"List SonicOS event-definition configuration (event names, categories, priorities, and alert/syslog settings). This is not the appliance event history and cannot be searched by IP, message, or timestamp.",
|
|
1933
|
-
{ device:
|
|
1937
|
+
{ device: import_v311.z.string().optional() },
|
|
1934
1938
|
async ({ device }) => {
|
|
1935
1939
|
try {
|
|
1936
1940
|
const client = await registry.getClient(device);
|
|
@@ -1944,12 +1948,12 @@ function registerLogTools(server, registry) {
|
|
|
1944
1948
|
}
|
|
1945
1949
|
|
|
1946
1950
|
// src/tools/zones.ts
|
|
1947
|
-
var
|
|
1951
|
+
var import_v312 = require("zod/v3");
|
|
1948
1952
|
function registerZoneTools(server, registry) {
|
|
1949
1953
|
server.tool(
|
|
1950
1954
|
"list_zones",
|
|
1951
1955
|
"List all security zones (LAN, WAN, DMZ, etc.) with their security type and interface membership. Use this to discover valid zone names before creating access rules or security policies.",
|
|
1952
|
-
{ device:
|
|
1956
|
+
{ device: import_v312.z.string().optional() },
|
|
1953
1957
|
async ({ device }) => {
|
|
1954
1958
|
try {
|
|
1955
1959
|
const client = await registry.getClient(device);
|
|
@@ -1963,7 +1967,7 @@ function registerZoneTools(server, registry) {
|
|
|
1963
1967
|
server.tool(
|
|
1964
1968
|
"get_zone",
|
|
1965
1969
|
"Retrieve a single security zone by name.",
|
|
1966
|
-
{ name:
|
|
1970
|
+
{ name: import_v312.z.string(), device: import_v312.z.string().optional() },
|
|
1967
1971
|
async ({ name, device }) => {
|
|
1968
1972
|
try {
|
|
1969
1973
|
const client = await registry.getClient(device);
|
|
@@ -1977,7 +1981,7 @@ function registerZoneTools(server, registry) {
|
|
|
1977
1981
|
}
|
|
1978
1982
|
|
|
1979
1983
|
// src/tools/interfaces.ts
|
|
1980
|
-
var
|
|
1984
|
+
var import_v313 = require("zod/v3");
|
|
1981
1985
|
var SECRET_FIELD = /(?:password|passwd|secret|private_key|pre_shared_key|community)$/i;
|
|
1982
1986
|
function redactSecrets(value) {
|
|
1983
1987
|
if (Array.isArray(value)) return value.map(redactSecrets);
|
|
@@ -1993,7 +1997,7 @@ function registerInterfaceTools(server, registry) {
|
|
|
1993
1997
|
server.tool(
|
|
1994
1998
|
"list_interfaces",
|
|
1995
1999
|
"List IPv4 network interfaces with their IP assignment, zone, and mode (static/DHCP). Use this to discover the appliance's addressing and which interfaces belong to which zone.",
|
|
1996
|
-
{ device:
|
|
2000
|
+
{ device: import_v313.z.string().optional() },
|
|
1997
2001
|
async ({ device }) => {
|
|
1998
2002
|
try {
|
|
1999
2003
|
const client = await registry.getClient(device);
|
|
@@ -2007,7 +2011,7 @@ function registerInterfaceTools(server, registry) {
|
|
|
2007
2011
|
server.tool(
|
|
2008
2012
|
"get_interface",
|
|
2009
2013
|
'Retrieve a single IPv4 interface by name (e.g. "X0").',
|
|
2010
|
-
{ name:
|
|
2014
|
+
{ name: import_v313.z.string(), device: import_v313.z.string().optional() },
|
|
2011
2015
|
async ({ name, device }) => {
|
|
2012
2016
|
try {
|
|
2013
2017
|
const client = await registry.getClient(device);
|
|
@@ -2021,12 +2025,12 @@ function registerInterfaceTools(server, registry) {
|
|
|
2021
2025
|
}
|
|
2022
2026
|
|
|
2023
2027
|
// src/tools/schedules.ts
|
|
2024
|
-
var
|
|
2028
|
+
var import_v314 = require("zod/v3");
|
|
2025
2029
|
function registerScheduleTools(server, registry) {
|
|
2026
2030
|
server.tool(
|
|
2027
2031
|
"list_schedules",
|
|
2028
2032
|
'List schedule objects (recurring time windows like "Work Hours"). Security policies reference schedules by name to restrict when a rule is active \u2014 use this to discover valid schedule names.',
|
|
2029
|
-
{ device:
|
|
2033
|
+
{ device: import_v314.z.string().optional() },
|
|
2030
2034
|
async ({ device }) => {
|
|
2031
2035
|
try {
|
|
2032
2036
|
const client = await registry.getClient(device);
|
|
@@ -2040,7 +2044,7 @@ function registerScheduleTools(server, registry) {
|
|
|
2040
2044
|
server.tool(
|
|
2041
2045
|
"get_schedule",
|
|
2042
2046
|
"Retrieve a single schedule object by name.",
|
|
2043
|
-
{ name:
|
|
2047
|
+
{ name: import_v314.z.string(), device: import_v314.z.string().optional() },
|
|
2044
2048
|
async ({ name, device }) => {
|
|
2045
2049
|
try {
|
|
2046
2050
|
const client = await registry.getClient(device);
|
|
@@ -2054,14 +2058,14 @@ function registerScheduleTools(server, registry) {
|
|
|
2054
2058
|
}
|
|
2055
2059
|
|
|
2056
2060
|
// src/tools/route-policies.ts
|
|
2057
|
-
var
|
|
2061
|
+
var import_v315 = require("zod/v3");
|
|
2058
2062
|
function registerRoutePolicyTools(server, registry) {
|
|
2059
2063
|
server.tool(
|
|
2060
2064
|
"list_route_policies",
|
|
2061
2065
|
"List static/policy-based routes with their destination, gateway, interface, and metric. Useful for understanding how traffic is routed off the appliance.",
|
|
2062
2066
|
{
|
|
2063
|
-
ip_version:
|
|
2064
|
-
device:
|
|
2067
|
+
ip_version: import_v315.z.enum(["ipv4", "ipv6"]).optional().default("ipv4"),
|
|
2068
|
+
device: import_v315.z.string().optional()
|
|
2065
2069
|
},
|
|
2066
2070
|
async ({ ip_version, device }) => {
|
|
2067
2071
|
try {
|
|
@@ -2075,6 +2079,142 @@ function registerRoutePolicyTools(server, registry) {
|
|
|
2075
2079
|
);
|
|
2076
2080
|
}
|
|
2077
2081
|
|
|
2082
|
+
// src/tools/diagnostics.ts
|
|
2083
|
+
var import_v316 = require("zod/v3");
|
|
2084
|
+
function text(value) {
|
|
2085
|
+
return { content: [{ type: "text", text: JSON.stringify(value, null, 2) }] };
|
|
2086
|
+
}
|
|
2087
|
+
function failure(e) {
|
|
2088
|
+
return { content: [{ type: "text", text: `Error: ${e.message}` }], isError: true };
|
|
2089
|
+
}
|
|
2090
|
+
function actionPath(action, host, iface, preferIpv6 = false) {
|
|
2091
|
+
const base = `diag/${action}-action/${encodeURIComponent(host)}`;
|
|
2092
|
+
if (!iface) return base;
|
|
2093
|
+
return `${base}/interface/${encodeURIComponent(iface)}/${preferIpv6 ? "true" : "false"}`;
|
|
2094
|
+
}
|
|
2095
|
+
async function readArpCache(client) {
|
|
2096
|
+
const paths = ["reporting/arp/caches", "arp/entries"];
|
|
2097
|
+
let lastError;
|
|
2098
|
+
for (const path of paths) {
|
|
2099
|
+
try {
|
|
2100
|
+
return await client.get(path);
|
|
2101
|
+
} catch (e) {
|
|
2102
|
+
lastError = e;
|
|
2103
|
+
if (!(e instanceof APIError) || ![400, 404].includes(e.status)) throw e;
|
|
2104
|
+
}
|
|
2105
|
+
}
|
|
2106
|
+
throw lastError;
|
|
2107
|
+
}
|
|
2108
|
+
function matchingEntries(value, ip) {
|
|
2109
|
+
const matches2 = [];
|
|
2110
|
+
const visit = (item) => {
|
|
2111
|
+
if (Array.isArray(item)) {
|
|
2112
|
+
for (const child of item) visit(child);
|
|
2113
|
+
} else if (item && typeof item === "object") {
|
|
2114
|
+
const object = item;
|
|
2115
|
+
if (Object.values(object).some((v) => typeof v === "string" && v === ip)) matches2.push(object);
|
|
2116
|
+
else for (const child of Object.values(object)) visit(child);
|
|
2117
|
+
}
|
|
2118
|
+
};
|
|
2119
|
+
visit(value);
|
|
2120
|
+
return matches2;
|
|
2121
|
+
}
|
|
2122
|
+
function registerDiagnosticTools(server, registry) {
|
|
2123
|
+
const targetSchema = {
|
|
2124
|
+
host: import_v316.z.string().min(1).describe("Destination IP address or hostname"),
|
|
2125
|
+
interface: import_v316.z.string().min(1).optional().describe("Source interface, such as X1; omit to let SonicOS choose"),
|
|
2126
|
+
prefer_ipv6: import_v316.z.boolean().optional().default(false),
|
|
2127
|
+
device: import_v316.z.string().optional()
|
|
2128
|
+
};
|
|
2129
|
+
server.tool(
|
|
2130
|
+
"ping_from_appliance",
|
|
2131
|
+
"Ping an IP address or hostname from the SonicWall appliance, optionally through a specific interface. This is a live, read-only diagnostic.",
|
|
2132
|
+
targetSchema,
|
|
2133
|
+
async ({ host, interface: iface, prefer_ipv6, device }) => {
|
|
2134
|
+
try {
|
|
2135
|
+
const client = await registry.getClient(device);
|
|
2136
|
+
return text(await client.postAction(actionPath("ping", host, iface, prefer_ipv6)));
|
|
2137
|
+
} catch (e) {
|
|
2138
|
+
return failure(e);
|
|
2139
|
+
}
|
|
2140
|
+
}
|
|
2141
|
+
);
|
|
2142
|
+
server.tool(
|
|
2143
|
+
"traceroute_from_appliance",
|
|
2144
|
+
"Trace the network path from the SonicWall appliance to an IP address or hostname, optionally through a specific interface. This can take several minutes.",
|
|
2145
|
+
targetSchema,
|
|
2146
|
+
async ({ host, interface: iface, prefer_ipv6, device }) => {
|
|
2147
|
+
try {
|
|
2148
|
+
const client = await registry.getClient(device);
|
|
2149
|
+
return text(await client.postAction(actionPath("traceroute", host, iface, prefer_ipv6)));
|
|
2150
|
+
} catch (e) {
|
|
2151
|
+
return failure(e);
|
|
2152
|
+
}
|
|
2153
|
+
}
|
|
2154
|
+
);
|
|
2155
|
+
server.tool(
|
|
2156
|
+
"find_network_path",
|
|
2157
|
+
"Ask the appliance to resolve the network path for a destination, including the route/interface selected by SonicOS.",
|
|
2158
|
+
{ host: import_v316.z.string().min(1), device: import_v316.z.string().optional() },
|
|
2159
|
+
async ({ host, device }) => {
|
|
2160
|
+
try {
|
|
2161
|
+
const client = await registry.getClient(device);
|
|
2162
|
+
return text(await client.postAction(`diag/network-path-action/${encodeURIComponent(host)}`));
|
|
2163
|
+
} catch (e) {
|
|
2164
|
+
return failure(e);
|
|
2165
|
+
}
|
|
2166
|
+
}
|
|
2167
|
+
);
|
|
2168
|
+
server.tool(
|
|
2169
|
+
"lookup_arp",
|
|
2170
|
+
"Read the appliance ARP cache. When ip is supplied, return only entries exactly matching that address.",
|
|
2171
|
+
{ ip: import_v316.z.string().min(1).optional(), device: import_v316.z.string().optional() },
|
|
2172
|
+
async ({ ip, device }) => {
|
|
2173
|
+
try {
|
|
2174
|
+
const client = await registry.getClient(device);
|
|
2175
|
+
const result = await readArpCache(client);
|
|
2176
|
+
return text(ip ? { ip, entries: matchingEntries(result, ip) } : result);
|
|
2177
|
+
} catch (e) {
|
|
2178
|
+
return failure(e);
|
|
2179
|
+
}
|
|
2180
|
+
}
|
|
2181
|
+
);
|
|
2182
|
+
server.tool(
|
|
2183
|
+
"diagnose_ip",
|
|
2184
|
+
"Run a combined, read-only diagnosis for an IP from the appliance: collect network-path selection, interface configuration, route policies, matching ARP state, ping, and optionally traceroute. Individual failures are reported without aborting the remaining checks.",
|
|
2185
|
+
{
|
|
2186
|
+
ip: import_v316.z.string().ip(),
|
|
2187
|
+
interface: import_v316.z.string().min(1).optional(),
|
|
2188
|
+
include_traceroute: import_v316.z.boolean().optional().default(true),
|
|
2189
|
+
device: import_v316.z.string().optional()
|
|
2190
|
+
},
|
|
2191
|
+
async ({ ip, interface: iface, include_traceroute, device }) => {
|
|
2192
|
+
try {
|
|
2193
|
+
const client = await registry.getClient(device);
|
|
2194
|
+
const checks = { target: ip, requested_interface: iface ?? null };
|
|
2195
|
+
const capture = async (name, fn) => {
|
|
2196
|
+
try {
|
|
2197
|
+
checks[name] = await fn();
|
|
2198
|
+
} catch (e) {
|
|
2199
|
+
checks[name] = { error: e.message };
|
|
2200
|
+
}
|
|
2201
|
+
};
|
|
2202
|
+
await capture("network_path", () => client.postAction(`diag/network-path-action/${encodeURIComponent(ip)}`));
|
|
2203
|
+
await capture("interfaces", () => client.get("interfaces/ipv4"));
|
|
2204
|
+
await capture("route_policies", () => client.get("route-policies/ipv4"));
|
|
2205
|
+
await capture("arp", async () => ({ entries: matchingEntries(await readArpCache(client), ip) }));
|
|
2206
|
+
await capture("ping", () => client.postAction(actionPath("ping", ip, iface)));
|
|
2207
|
+
if (include_traceroute) {
|
|
2208
|
+
await capture("traceroute", () => client.postAction(actionPath("traceroute", ip, iface)));
|
|
2209
|
+
}
|
|
2210
|
+
return text(checks);
|
|
2211
|
+
} catch (e) {
|
|
2212
|
+
return failure(e);
|
|
2213
|
+
}
|
|
2214
|
+
}
|
|
2215
|
+
);
|
|
2216
|
+
}
|
|
2217
|
+
|
|
2078
2218
|
// src/http-server.ts
|
|
2079
2219
|
var import_node_crypto = require("crypto");
|
|
2080
2220
|
var import_node_http = __toESM(require("http"));
|
|
@@ -2162,7 +2302,7 @@ var packageName = packageJson.name ?? "sonicwall-api-mcp-server";
|
|
|
2162
2302
|
var packageVersion = packageJson.version ?? "0.0.0";
|
|
2163
2303
|
|
|
2164
2304
|
// src/strict-tools.ts
|
|
2165
|
-
var
|
|
2305
|
+
var import_v317 = require("zod/v3");
|
|
2166
2306
|
function isSchema(value) {
|
|
2167
2307
|
return typeof value === "object" && value !== null && "_def" in value;
|
|
2168
2308
|
}
|
|
@@ -2172,8 +2312,8 @@ function isRawShape(value) {
|
|
|
2172
2312
|
return values.length === 0 || values.some(isSchema);
|
|
2173
2313
|
}
|
|
2174
2314
|
function strictSchema(schema) {
|
|
2175
|
-
if (schema === void 0) return
|
|
2176
|
-
if (isRawShape(schema)) return
|
|
2315
|
+
if (schema === void 0) return import_v317.z.object({}).strict();
|
|
2316
|
+
if (isRawShape(schema)) return import_v317.z.object(schema).strict();
|
|
2177
2317
|
if (isSchema(schema) && typeof schema.strict === "function") return schema.strict();
|
|
2178
2318
|
return schema;
|
|
2179
2319
|
}
|
|
@@ -2226,6 +2366,7 @@ IMPORTANT: All create/update/delete operations are STAGED and do not take effect
|
|
|
2226
2366
|
- Access rules (create_access_rule / list_access_rules) control traffic flow between zones with allow/deny/discard actions. Security policies (create_security_policy / list_security_policies) are zone-based and additionally support user and schedule filtering \u2014 use them when you need user-aware or time-restricted policies.
|
|
2227
2367
|
- Always call list_access_rules, list_nat_policies, or list_security_policies before modifying, to confirm current state and avoid duplicates. Access-rule and NAT-policy mutations use the UUID returned by their list tools; numeric IDs are not accepted.
|
|
2228
2368
|
- Rules and policies reference zones and schedules by name: use list_zones and list_schedules to discover valid names. list_interfaces shows interface IP/zone assignments and list_route_policies shows static routing \u2014 both are read-only discovery aids.
|
|
2369
|
+
- For reachability problems, use diagnose_ip for a combined appliance-side network-path, interface, route-policy, ARP, ping, and traceroute report. Use the individual diagnostic tools when you need a targeted test or a specific source interface.
|
|
2229
2370
|
- lookup_ip_country identifies which country an IP address belongs to (uses the appliance GeoIP database). Note: GeoIP *policy* management is not available via the SonicOS REST API.
|
|
2230
2371
|
|
|
2231
2372
|
## Read-only API note
|
|
@@ -2249,6 +2390,7 @@ SonicOS allows only ONE concurrent API session per appliance. If a session error
|
|
|
2249
2390
|
registerInterfaceTools(server, registry);
|
|
2250
2391
|
registerScheduleTools(server, registry);
|
|
2251
2392
|
registerRoutePolicyTools(server, registry);
|
|
2393
|
+
registerDiagnosticTools(server, registry);
|
|
2252
2394
|
return server;
|
|
2253
2395
|
};
|
|
2254
2396
|
const transport = config.transport;
|