mirror of
https://github.com/speatzle/nfsense.git
synced 2025-06-27 23:09:37 +00:00
add basic schema with all properties
This commit is contained in:
parent
5483f7f39d
commit
8b23444815
26 changed files with 560 additions and 57 deletions
36
internal/validation/schema/config/config.schema.json
Normal file
36
internal/validation/schema/config/config.schema.json
Normal file
|
@ -0,0 +1,36 @@
|
|||
{
|
||||
"$id": "https://nfsense.net/schema/config/config.schema.json",
|
||||
"title": "Config",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"config_version": {
|
||||
"type": "number",
|
||||
"const": 1
|
||||
},
|
||||
"firewall": {
|
||||
"description": "System Settings",
|
||||
"$ref": "https://nfsense.net/schema/firewall/firewall.schema.json"
|
||||
},
|
||||
"object": {
|
||||
"description": "Object Settings",
|
||||
"$ref": "https://nfsense.net/schema/object/object.schema.json"
|
||||
},
|
||||
"network": {
|
||||
"description": "Network Settings",
|
||||
"$ref": "https://nfsense.net/schema/network/network.schema.json"
|
||||
},
|
||||
"service": {
|
||||
"description": "Service Settings",
|
||||
"$ref": "https://nfsense.net/schema/service/service.schema.json"
|
||||
},
|
||||
"vpn": {
|
||||
"description": "VPN Settings",
|
||||
"$ref": "https://nfsense.net/schema/vpn/vpn.schema.json"
|
||||
},
|
||||
"system": {
|
||||
"description": "System Settings",
|
||||
"$ref": "https://nfsense.net/schema/system/system.schema.json"
|
||||
}
|
||||
},
|
||||
"required": ["config_version", "firewall", "object", "network", "service", "vpn", "system"]
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"$id": "https://nfsense.net/schema/firewall/destination_nat_rule.schema.json",
|
||||
"title": "Destination NAT Rule",
|
||||
"$ref": "https://nfsense.net/schema/firewall/rule.schema.json",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"address": {
|
||||
"type": "string"
|
||||
},
|
||||
"service": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
26
internal/validation/schema/firewall/firewall.schema.json
Normal file
26
internal/validation/schema/firewall/firewall.schema.json
Normal file
|
@ -0,0 +1,26 @@
|
|||
{
|
||||
"$id": "https://nfsense.net/schema/firewall/firewall.schema.json",
|
||||
"title": "Firewall",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"forward_rules": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "https://nfsense.net/schema/firewall/forward_rule.schema.json"
|
||||
}
|
||||
},
|
||||
"destination_nat_rules": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "https://nfsense.net/schema/firewall/destination_nat_rule.schema.json"
|
||||
}
|
||||
},
|
||||
"source_nat_rules": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "https://nfsense.net/schema/firewall/source_nat_rule.schema.json"
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": ["forward_rules", "destination_nat_rules", "source_nat_rules"]
|
||||
}
|
12
internal/validation/schema/firewall/forward_rule.schema.json
Normal file
12
internal/validation/schema/firewall/forward_rule.schema.json
Normal file
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"$id": "https://nfsense.net/schema/firewall/forward_rule.schema.json",
|
||||
"title": "Forward Rule",
|
||||
"$ref": "https://nfsense.net/schema/firewall/rule.schema.json",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"verdict": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": ["verdict"]
|
||||
}
|
25
internal/validation/schema/firewall/match.schema.json
Normal file
25
internal/validation/schema/firewall/match.schema.json
Normal file
|
@ -0,0 +1,25 @@
|
|||
{
|
||||
"$id": "https://nfsense.net/schema/firewall/match.schema.json",
|
||||
"title": "Match",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"services": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"source_addresses": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"destination_addresses": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
20
internal/validation/schema/firewall/rule.schema.json
Normal file
20
internal/validation/schema/firewall/rule.schema.json
Normal file
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
"$id": "https://nfsense.net/schema/firewall/rule.schema.json",
|
||||
"title": "Rule",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"match": {
|
||||
"$ref": "https://nfsense.net/schema/firewall/match.schema.json"
|
||||
},
|
||||
"comment": {
|
||||
"type": "string"
|
||||
},
|
||||
"counter": {
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
"required": ["name", "match"]
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"$id": "https://nfsense.net/schema/firewall/source_nat_rule.schema.json",
|
||||
"title": "Source NAT Rule",
|
||||
"$ref": "https://nfsense.net/schema/firewall/rule.schema.json",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"type": {
|
||||
"type": "string"
|
||||
},
|
||||
"address": {
|
||||
"type": "string"
|
||||
},
|
||||
"service": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
44
internal/validation/schema/network/interface.schema.json
Normal file
44
internal/validation/schema/network/interface.schema.json
Normal file
|
@ -0,0 +1,44 @@
|
|||
{
|
||||
"$id": "https://nfsense.net/schema/network/interface.schema.json",
|
||||
"title": "Interface",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"alias": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": {
|
||||
"type": "string"
|
||||
},
|
||||
"addressing_mode": {
|
||||
"type": "string"
|
||||
},
|
||||
"address": {
|
||||
"type": "string"
|
||||
},
|
||||
"hardware_device": {
|
||||
"type": "string"
|
||||
},
|
||||
"vlan_id": {
|
||||
"type": "number"
|
||||
},
|
||||
"vlan_parent": {
|
||||
"type": "string"
|
||||
},
|
||||
"bond_members": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"bridge_members": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"comment": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": ["type", "addressing_mode"]
|
||||
}
|
20
internal/validation/schema/network/network.schema.json
Normal file
20
internal/validation/schema/network/network.schema.json
Normal file
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
"$id": "https://nfsense.net/schema/network/network.schema.json",
|
||||
"title": "Network",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"interfaces": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"$ref": "https://nfsense.net/schema/network/interface.schema.json"
|
||||
}
|
||||
},
|
||||
"static_routes": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "https://nfsense.net/schema/network/static_route.schema.json"
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": ["interfaces"]
|
||||
}
|
23
internal/validation/schema/network/static_route.schema.json
Normal file
23
internal/validation/schema/network/static_route.schema.json
Normal file
|
@ -0,0 +1,23 @@
|
|||
{
|
||||
"$id": "https://nfsense.net/schema/network/static_route.schema.json",
|
||||
"title": "Static Route",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"interface": {
|
||||
"type": "string"
|
||||
},
|
||||
"gateway": {
|
||||
"type": "string"
|
||||
},
|
||||
"destination": {
|
||||
"type": "string"
|
||||
},
|
||||
"metric": {
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
"required": ["name", "interface", "gateway", "destination"]
|
||||
}
|
29
internal/validation/schema/object/address.schema.json
Normal file
29
internal/validation/schema/object/address.schema.json
Normal file
|
@ -0,0 +1,29 @@
|
|||
{
|
||||
"$id": "https://nfsense.net/schema/object/address.schema.json",
|
||||
"title": "Address",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"type": {
|
||||
"type": "string"
|
||||
},
|
||||
"comment": {
|
||||
"type": "string"
|
||||
},
|
||||
"host": {
|
||||
"type": "string"
|
||||
},
|
||||
"range": {
|
||||
"type": "string"
|
||||
},
|
||||
"network": {
|
||||
"type": "string"
|
||||
},
|
||||
"children": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": ["type"]
|
||||
}
|
20
internal/validation/schema/object/object.schema.json
Normal file
20
internal/validation/schema/object/object.schema.json
Normal file
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
"$id": "https://nfsense.net/schema/object/object.schema.json",
|
||||
"title": "Object",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"addresses": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"$ref": "https://nfsense.net/schema/object/address.schema.json"
|
||||
}
|
||||
},
|
||||
"services": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"$ref": "https://nfsense.net/schema/object/service.schema.json"
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": ["addresses", "services"]
|
||||
}
|
35
internal/validation/schema/object/service.schema.json
Normal file
35
internal/validation/schema/object/service.schema.json
Normal file
|
@ -0,0 +1,35 @@
|
|||
{
|
||||
"$id": "https://nfsense.net/schema/object/service.schema.json",
|
||||
"title": "Service",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"type": {
|
||||
"type": "string"
|
||||
},
|
||||
"comment": {
|
||||
"type": "string"
|
||||
},
|
||||
"sport_start": {
|
||||
"type": "number"
|
||||
},
|
||||
"sport_end": {
|
||||
"type": "number"
|
||||
},
|
||||
"dport_start": {
|
||||
"type": "number"
|
||||
},
|
||||
"dport_end": {
|
||||
"type": "number"
|
||||
},
|
||||
"icmp_code": {
|
||||
"type": "number"
|
||||
},
|
||||
"children": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": ["type"]
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
{
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
{
|
||||
"$id": "https://nfsense.net/schema/service/dhcp_v4_server.schema.json",
|
||||
"title": "DHCP Server",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"interface": {
|
||||
"type": "string"
|
||||
},
|
||||
"pool": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"default_lease_time": {
|
||||
"type": "number"
|
||||
},
|
||||
"max_lease_time": {
|
||||
"type": "number"
|
||||
},
|
||||
"gateway_mode": {
|
||||
"type": "string"
|
||||
},
|
||||
"gateway": {
|
||||
"type": "string"
|
||||
},
|
||||
"dns_server_mode": {
|
||||
"type": "string"
|
||||
},
|
||||
"dns_servers": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"ntp_server_mode": {
|
||||
"type": "string"
|
||||
},
|
||||
"ntp_servers": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"reservations": {
|
||||
"type": ["object", "null"],
|
||||
"additionalProperties": {
|
||||
"description": "DHCP Reservations",
|
||||
"$ref": "https://nfsense.net/schema/service/dhcp_reservation.schema.json"
|
||||
}
|
||||
},
|
||||
"comment": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": ["interface", "pool", "default_lease_time", "max_lease_time", "gateway_mode", "dns_server_mode", "ntp_server_mode"]
|
||||
}
|
14
internal/validation/schema/service/dns_server.schema.json
Normal file
14
internal/validation/schema/service/dns_server.schema.json
Normal file
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"$id": "https://nfsense.net/schema/service/dns_server.schema.json",
|
||||
"title": "DNS Server",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"interface": {
|
||||
"type": "string"
|
||||
},
|
||||
"comment": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": ["interface"]
|
||||
}
|
14
internal/validation/schema/service/ntp_server.schema.json
Normal file
14
internal/validation/schema/service/ntp_server.schema.json
Normal file
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"$id": "https://nfsense.net/schema/service/ntp_server.schema.json",
|
||||
"title": "NTP Server",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"interface": {
|
||||
"type": "string"
|
||||
},
|
||||
"comment": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": ["interface"]
|
||||
}
|
31
internal/validation/schema/service/service.schema.json
Normal file
31
internal/validation/schema/service/service.schema.json
Normal file
|
@ -0,0 +1,31 @@
|
|||
{
|
||||
"$id": "https://nfsense.net/schema/service/service.schema.json",
|
||||
"title": "Service",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"dhcp_v4_servers": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "https://nfsense.net/schema/service/dhcp_v4_server.schema.json"
|
||||
}
|
||||
},
|
||||
"dhcp_v6_servers": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "https://nfsense.net/schema/service/dhcp_v4_server.schema.json"
|
||||
}
|
||||
},
|
||||
"dns_servers": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "https://nfsense.net/schema/service/dns_server.schema.json"
|
||||
}
|
||||
},
|
||||
"ntp_servers": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "https://nfsense.net/schema/service/ntp_server.schema.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
15
internal/validation/schema/system/system.schema.json
Normal file
15
internal/validation/schema/system/system.schema.json
Normal file
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
"$id": "https://nfsense.net/schema/system/system.schema.json",
|
||||
"title": "System",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"users": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"description": "System Settings",
|
||||
"$ref": "https://nfsense.net/schema/system/user.schema.json"
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": ["users"]
|
||||
}
|
18
internal/validation/schema/system/user.schema.json
Normal file
18
internal/validation/schema/system/user.schema.json
Normal file
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
"$id": "https://nfsense.net/schema/system/user.schema.json",
|
||||
"title": "User",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"comment": {
|
||||
"type": "string"
|
||||
},
|
||||
"hash": {
|
||||
"type": "string"
|
||||
},
|
||||
"salt": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": ["hash", "salt"]
|
||||
|
||||
}
|
11
internal/validation/schema/vpn/vpn.schema.json
Normal file
11
internal/validation/schema/vpn/vpn.schema.json
Normal file
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"$id": "https://nfsense.net/schema/vpn/vpn.schema.json",
|
||||
"title": "VPN",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"wireguard": {
|
||||
"$ref": "https://nfsense.net/schema/vpn/wireguard.schema.json"
|
||||
}
|
||||
},
|
||||
"required": ["wireguard"]
|
||||
}
|
22
internal/validation/schema/vpn/wireguard.schema.json
Normal file
22
internal/validation/schema/vpn/wireguard.schema.json
Normal file
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
"$id": "https://nfsense.net/schema/vpn/wireguard.schema.json",
|
||||
"title": "Wireguard",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"interfaces": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"description": "Wireguard Interface",
|
||||
"$ref": "https://nfsense.net/schema/vpn/wireguard_interface.schema.json"
|
||||
}
|
||||
},
|
||||
"peers": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"description": "Wireguard Peer",
|
||||
"$ref": "https://nfsense.net/schema/vpn/wireguard_peer.schema.json"
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": ["interfaces", "peers"]
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
{
|
||||
"$id": "https://nfsense.net/schema/vpn/wireguard_interface.schema.json",
|
||||
"title": "Wireguard Interface",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"public_key": {
|
||||
"type": "string"
|
||||
},
|
||||
"private_key": {
|
||||
"type": "string"
|
||||
},
|
||||
"listen_port": {
|
||||
"type": "number"
|
||||
},
|
||||
"peers": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"comment": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": ["public_key", "private_key", "listen_port", "peers"]
|
||||
}
|
29
internal/validation/schema/vpn/wireguard_peer.schema.json
Normal file
29
internal/validation/schema/vpn/wireguard_peer.schema.json
Normal file
|
@ -0,0 +1,29 @@
|
|||
{
|
||||
"$id": "https://nfsense.net/schema/vpn/wireguard_peer.schema.json",
|
||||
"title": "Wireguard Peer",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"public_key": {
|
||||
"type": "string"
|
||||
},
|
||||
"preshared_key": {
|
||||
"type": ["string", "null"]
|
||||
},
|
||||
"allowed_ips": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"endpoint": {
|
||||
"type": ["string", "null"]
|
||||
},
|
||||
"persistent_keepalive": {
|
||||
"type": ["number", "null"]
|
||||
},
|
||||
"comment": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": ["public_key", "allowed_ips"]
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
{
|
||||
"$id": "https://nfsense.net/config.schema.json",
|
||||
"title": "Config",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"config_version": {
|
||||
"type": "number",
|
||||
"const": 1
|
||||
},
|
||||
"firewall": {
|
||||
"type": ["number","string","boolean","object","array", "null"]
|
||||
},
|
||||
"object": {
|
||||
"type": ["number","string","boolean","object","array", "null"]
|
||||
},
|
||||
"network": {
|
||||
"type": ["number","string","boolean","object","array", "null"]
|
||||
},
|
||||
"service": {
|
||||
"type": ["number","string","boolean","object","array", "null"]
|
||||
},
|
||||
"vpn": {
|
||||
"type": ["number","string","boolean","object","array", "null"]
|
||||
},
|
||||
"system": {
|
||||
"description": "System Settings",
|
||||
"$ref": "https://nfsense.net/system.schema.json"
|
||||
}
|
||||
},
|
||||
"required": ["config_version", "firewall", "object", "network", "service", "vpn", "system"]
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
{
|
||||
"$id": "https://nfsense.net/system.schema.json",
|
||||
"title": "System",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"users": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"comment": {
|
||||
"type": "string"
|
||||
},
|
||||
"hash": {
|
||||
"type": "string"
|
||||
},
|
||||
"salt": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": ["hash", "salt"]
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": ["users"]
|
||||
}
|
Loading…
Add table
Reference in a new issue