add basic schema with all properties

This commit is contained in:
Samuel Lorch 2023-10-10 19:57:04 +02:00
parent 5483f7f39d
commit 8b23444815
26 changed files with 560 additions and 57 deletions

View 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"]
}

View file

@ -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"
}
}
}

View 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"]
}

View 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"]
}

View 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"
}
}
}
}

View 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"]
}

View file

@ -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"
}
}
}

View 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"]
}

View 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"]
}

View 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"]
}

View 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"]
}

View 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"]
}

View 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"]
}

View file

@ -0,0 +1,2 @@
{
}

View file

@ -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"]
}

View 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"]
}

View 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"]
}

View 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"
}
}
}
}

View 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"]
}

View 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"]
}

View 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"]
}

View 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"]
}

View file

@ -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"]
}

View 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"]
}

View file

@ -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"]
}

View file

@ -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"]
}