Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mgmt API: find config-types has some unexpected values #1356

Open
qrkourier opened this issue Mar 10, 2023 · 3 comments
Open

mgmt API: find config-types has some unexpected values #1356

qrkourier opened this issue Mar 10, 2023 · 3 comments

Comments

@qrkourier
Copy link
Member

When I list the built-in config-types the id attributes have several different shapes. That might be for reverse compatibility because the older types have UUIDs and the newer ones have what look like NanoIDs.

The id for the host.v2 type is host.v2, though. Is that right or should it be a NanoID?

@qrkourier
Copy link
Member Author

        {
            "_links": {
                "self": {
                    "href": "./config-types/host.v2"
                }
            },
            "createdAt": "2023-03-10T14:58:29.424Z",
            "id": "host.v2",
            "tags": {},
            "updatedAt": "2023-03-10T14:58:29.424Z",
            "name": "host.v2",
            "schema": {
                "$id": "http://ziti-edge.netfoundry.io/schemas/host.v2.schema.json",
                "additionalProperties": false,
                "definitions": {
                    "action": {
                        "additionalProperties": false,
                        "properties": {
                            "action": {
                                "pattern": "(mark (un)?healthy|increase cost [0-9]+|decrease cost [0-9]+|send event)",
                                "type": "string"
                            },
                            "consecutiveEvents": {
                                "maximum": 65535,
                                "minimum": 0,
                                "type": "integer"
                            },
                            "duration": {
                                "$ref": "#/definitions/duration"
                            },
                            "trigger": {
                                "enum": [
                                    "fail",
                                    "pass",
                                    "change"
                                ],
                                "type": "string"
                            }
                        },
                        "required": [
                            "trigger",
                            "action"
                        ],
                        "type": "object"
                    },
                    "actionList": {
                        "items": {
                            "$ref": "#/definitions/action"
                        },
                        "maxItems": 20,
                        "minItems": 1,
                        "type": "array"
                    },
                    "cidr": {
                        "oneOf": [
                            {
                                "pattern": "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\/(3[0-2]|[1-2][0-9]|[0-9]))$"
                            },
                            {
                                "pattern": "^s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:)))(%.+)?s*(\/(12[0-8]|1[0-1][0-9]|[1-9][0-9]|[0-9]))$"
                            }
                        ],
                        "type": "string"
                    },
                    "dialAddress": {
                        "oneOf": [
                            {
                                "$ref": "#/definitions/ipAddress"
                            },
                            {
                                "$ref": "#/definitions/hostname"
                            }
                        ]
                    },
                    "duration": {
                        "pattern": "[0-9]+(h|m|s|ms)",
                        "type": "string"
                    },
                    "hostname": {
                        "format": "hostname",
                        "not": {
                            "$ref": "#/definitions/ipAddressFormat"
                        },
                        "type": "string"
                    },
                    "httpCheck": {
                        "additionalProperties": false,
                        "properties": {
                            "actions": {
                                "$ref": "#/definitions/actionList"
                            },
                            "body": {
                                "type": "string"
                            },
                            "expectInBody": {
                                "type": "string"
                            },
                            "expectStatus": {
                                "maximum": 599,
                                "minimum": 100,
                                "type": "integer"
                            },
                            "interval": {
                                "$ref": "#/definitions/duration"
                            },
                            "method": {
                                "$ref": "#/definitions/method"
                            },
                            "timeout": {
                                "$ref": "#/definitions/duration"
                            },
                            "url": {
                                "type": "string"
                            }
                        },
                        "required": [
                            "interval",
                            "timeout",
                            "url"
                        ],
                        "type": "object"
                    },
                    "httpCheckList": {
                        "items": {
                            "$ref": "#/definitions/httpCheck"
                        },
                        "type": "array"
                    },
                    "inhabitedSet": {
                        "minItems": 1,
                        "type": "array",
                        "uniqueItems": true
                    },
                    "ipAddress": {
                        "$ref": "#/definitions/ipAddressFormat",
                        "type": "string"
                    },
                    "ipAddressFormat": {
                        "oneOf": [
                            {
                                "format": "ipv4"
                            },
                            {
                                "format": "ipv6"
                            }
                        ]
                    },
                    "listenAddress": {
                        "oneOf": [
                            {
                                "$ref": "#/definitions/ipAddress"
                            },
                            {
                                "$ref": "#/definitions/hostname"
                            },
                            {
                                "$ref": "#/definitions/wildcardDomain"
                            },
                            {
                                "$ref": "#/definitions/cidr"
                            }
                        ]
                    },
                    "method": {
                        "enum": [
                            "GET",
                            "POST",
                            "PUT",
                            "PATCH"
                        ],
                        "type": "string"
                    },
                    "portCheck": {
                        "additionalProperties": false,
                        "properties": {
                            "actions": {
                                "$ref": "#/definitions/actionList"
                            },
                            "address": {
                                "type": "string"
                            },
                            "interval": {
                                "$ref": "#/definitions/duration"
                            },
                            "timeout": {
                                "$ref": "#/definitions/duration"
                            }
                        },
                        "required": [
                            "interval",
                            "timeout",
                            "address"
                        ],
                        "type": "object"
                    },
                    "portCheckList": {
                        "items": {
                            "$ref": "#/definitions/portCheck"
                        },
                        "type": "array"
                    },
                    "portNumber": {
                        "maximum": 65535,
                        "minimum": 0,
                        "type": "integer"
                    },
                    "portRange": {
                        "additionalProperties": false,
                        "properties": {
                            "high": {
                                "$ref": "#/definitions/portNumber"
                            },
                            "low": {
                                "$ref": "#/definitions/portNumber"
                            }
                        },
                        "required": [
                            "low",
                            "high"
                        ],
                        "type": "object"
                    },
                    "protocolName": {
                        "enum": [
                            "tcp",
                            "udp"
                        ],
                        "type": "string"
                    },
                    "terminator": {
                        "additionalProperties": false,
                        "allOf": [
                            {
                                "else": {
                                    "required": [
                                        "protocol"
                                    ]
                                },
                                "if": {
                                    "properties": {
                                        "forwardProtocol": {
                                            "const": true
                                        }
                                    },
                                    "required": [
                                        "forwardProtocol"
                                    ]
                                },
                                "then": {
                                    "required": [
                                        "allowedProtocols"
                                    ]
                                }
                            },
                            {
                                "else": {
                                    "required": [
                                        "address"
                                    ]
                                },
                                "if": {
                                    "properties": {
                                        "forwardAddress": {
                                            "const": true
                                        }
                                    },
                                    "required": [
                                        "forwardAddress"
                                    ]
                                },
                                "then": {
                                    "required": [
                                        "allowedAddresses"
                                    ]
                                }
                            },
                            {
                                "else": {
                                    "required": [
                                        "port"
                                    ]
                                },
                                "if": {
                                    "properties": {
                                        "forwardPort": {
                                            "const": true
                                        }
                                    },
                                    "required": [
                                        "forwardPort"
                                    ]
                                },
                                "then": {
                                    "required": [
                                        "allowedPortRanges"
                                    ]
                                }
                            }
                        ],
                        "properties": {
                            "address": {
                                "$ref": "#/definitions/dialAddress",
                                "description": "Dial the specified ip address or hostname when a ziti client connects to the service."
                            },
                            "allowedAddresses": {
                                "allOf": [
                                    {
                                        "$ref": "#/definitions/inhabitedSet"
                                    },
                                    {
                                        "items": {
                                            "$ref": "#/definitions/listenAddress"
                                        }
                                    }
                                ],
                                "description": "Only allow addresses from this set to be dialed"
                            },
                            "allowedPortRanges": {
                                "allOf": [
                                    {
                                        "$ref": "#/definitions/inhabitedSet"
                                    },
                                    {
                                        "items": {
                                            "$ref": "#/definitions/portRange"
                                        }
                                    }
                                ],
                                "description": "Only allow ports from this set to be dialed"
                            },
                            "allowedProtocols": {
                                "allOf": [
                                    {
                                        "$ref": "#/definitions/inhabitedSet"
                                    },
                                    {
                                        "items": {
                                            "$ref": "#/definitions/protocolName"
                                        }
                                    }
                                ],
                                "description": "Only allow protocols from this set to be dialed"
                            },
                            "allowedSourceAddresses": {
                                "allOf": [
                                    {
                                        "$ref": "#/definitions/inhabitedSet"
                                    },
                                    {
                                        "items": {
                                            "$ref": "#/definitions/listenAddress"
                                        }
                                    }
                                ],
                                "description": "hosting tunnelers establish local routes for the specified source addresses so binding will succeed"
                            },
                            "forwardAddress": {
                                "description": "Dial the same ip address that was intercepted at the client tunneler. 'address' and 'forwardAddress' are mutually exclusive.",
                                "enum": [
                                    true
                                ],
                                "type": "boolean"
                            },
                            "forwardPort": {
                                "description": "Dial the same port that was intercepted at the client tunneler. 'port' and 'forwardPort' are mutually exclusive.",
                                "enum": [
                                    true
                                ],
                                "type": "boolean"
                            },
                            "forwardProtocol": {
                                "description": "Dial the same protocol that was intercepted at the client tunneler. 'protocol' and 'forwardProtocol' are mutually exclusive.",
                                "enum": [
                                    true
                                ],
                                "type": "boolean"
                            },
                            "httpChecks": {
                                "$ref": "#/definitions/httpCheckList"
                            },
                            "listenOptions": {
                                "additionalProperties": false,
                                "properties": {
                                    "bindUsingEdgeIdentity": {
                                        "description": "Associate the hosting terminator with the name of the hosting tunneler's identity. Setting this to 'true' is equivalent to setting 'identiy=$tunneler_id.name'",
                                        "type": "boolean"
                                    },
                                    "connectTimeoutSeconds": {
                                        "$ref": "#/definitions/timeoutSeconds",
                                        "description": "defaults to 5"
                                    },
                                    "cost": {
                                        "description": "defaults to 0",
                                        "maximum": 65535,
                                        "minimum": 0,
                                        "type": "integer"
                                    },
                                    "identity": {
                                        "description": "Associate the hosting terminator with the specified identity. '$tunneler_id.name' resolves to the name of the hosting tunneler's identity. '$tunneler_id.tag[tagName]' resolves to the value of the 'tagName' tag on the hosting tunneler's identity.",
                                        "type": "string"
                                    },
                                    "maxConnections": {
                                        "description": "defaults to 3",
                                        "minimum": 1,
                                        "type": "integer"
                                    },
                                    "precedence": {
                                        "description": "defaults to 'default'",
                                        "enum": [
                                            "default",
                                            "required",
                                            "failed"
                                        ],
                                        "type": "string"
                                    }
                                },
                                "type": "object"
                            },
                            "port": {
                                "$ref": "#/definitions/portNumber",
                                "description": "Dial the specified port when a ziti client connects to the service."
                            },
                            "portChecks": {
                                "$ref": "#/definitions/portCheckList"
                            },
                            "protocol": {
                                "$ref": "#/definitions/protocolName",
                                "description": "Dial the specified protocol when a ziti client connects to the service."
                            }
                        },
                        "type": "object"
                    },
                    "terminatorList": {
                        "items": {
                            "$ref": "#/definitions/terminator"
                        },
                        "minItems": 1,
                        "type": "array"
                    },
                    "timeoutSeconds": {
                        "maximum": 2147483647,
                        "minimum": 0,
                        "type": "integer"
                    },
                    "wildcardDomain": {
                        "pattern": "^\\*\\.(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9])$",
                        "type": "string"
                    }
                },
                "properties": {
                    "terminators": {
                        "$ref": "#/definitions/terminatorList"
                    }
                },
                "required": [
                    "terminators"
                ],
                "type": "object"
            }
        }

@qrkourier
Copy link
Member Author

It would in fact be convenient if the id was the unique name of the built-in config type. I see I can do this, but only for host.v2 because the others have unpredictable IDs.

GET {{baseUrl}}/config-types/host.v2

@qrkourier qrkourier transferred this issue from openziti/edge Sep 28, 2023
plorenz added a commit that referenced this issue Sep 30, 2023
Handle duplicate tunnel terminator creation gracefully. Fixes #1355
@ekoby
Copy link
Member

ekoby commented Jul 31, 2024

investigate making them consistent

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants