* feat: Decide upstream based on user's unix group membership If a username is not defined, groupname is parsed. Check if the user is part of that group and route them to the associated host defined in the config file for the yaml plugin * style: fix formatting with gofmt * feat: Look up user groups only when groupname defined in yaml config * fix: inefficient assignment because of unused var * feat: fallback to next rule on group lookup failure Instead of failing on group lookup errors, the matcher now skips the groupname rule and proceeds to the next, eventually failing through to the catchall rule. * feat: test cases for group based routing in yaml plugin * Revert "feat: fallback to next rule on group lookup failure" This reverts commit 622ee9f1eb3157d04f57c068179bb74de8db3a1f. Handles the error returned by getUserGroups instead of ignoring it, to prevent potential runtime issues when user lookup fail * feat: Check if a user is known to the system before group lookup This will let the rule matching logic skip to the next pipe in the yaml config when a user is not found on the system. Note the variable name change from user to username to avoid ambiguity dur to name collision with os/user package. * feat: Avoid redundant user lookup * feat: Improve error handling for user and group lookup failures * feat: Use appropriate test user name for group routing
167 lines
4.8 KiB
JSON
167 lines
4.8 KiB
JSON
{
|
|
"$schema": "http://json-schema.org/draft-06/schema#",
|
|
"$ref": "#/definitions/sshpiperd",
|
|
"definitions": {
|
|
"sshpiperd": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"properties": {
|
|
"version": {
|
|
"type": "string"
|
|
},
|
|
"pipes": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/definitions/pipe"
|
|
}
|
|
}
|
|
},
|
|
"required": [
|
|
"pipes",
|
|
"version"
|
|
]
|
|
},
|
|
"pipe": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"properties": {
|
|
"from": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/definitions/from"
|
|
}
|
|
},
|
|
"to": {
|
|
"$ref": "#/definitions/to"
|
|
}
|
|
},
|
|
"required": [
|
|
"from",
|
|
"to"
|
|
]
|
|
},
|
|
"from": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"properties": {
|
|
"username": {
|
|
"type": "string"
|
|
},
|
|
"username_regex_match": {
|
|
"type": "boolean"
|
|
},
|
|
"groupname": {
|
|
"type": "string"
|
|
},
|
|
"authorized_keys": {
|
|
"oneOf": [
|
|
{
|
|
"type": "array",
|
|
"items": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
{
|
|
"type": "string"
|
|
}
|
|
]
|
|
},
|
|
"authorized_keys_data": {
|
|
"oneOf": [
|
|
{
|
|
"type": "array",
|
|
"items": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
{
|
|
"type": "string"
|
|
}
|
|
]
|
|
},
|
|
"trusted_user_ca_keys": {
|
|
"oneOf": [
|
|
{
|
|
"type": "array",
|
|
"items": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
{
|
|
"type": "string"
|
|
}
|
|
]
|
|
},
|
|
"trusted_user_ca_keys_data": {
|
|
"oneOf": [
|
|
{
|
|
"type": "array",
|
|
"items": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
{
|
|
"type": "string"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"required": [
|
|
"username"
|
|
]
|
|
},
|
|
"to": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"properties": {
|
|
"host": {
|
|
"type": "string"
|
|
},
|
|
"username": {
|
|
"type": "string"
|
|
},
|
|
"ignore_hostkey": {
|
|
"type": "boolean"
|
|
},
|
|
"password": {
|
|
"type": "string"
|
|
},
|
|
"private_key": {
|
|
"type": "string"
|
|
},
|
|
"private_key_data": {
|
|
"type": "string"
|
|
},
|
|
"known_hosts": {
|
|
"oneOf": [
|
|
{
|
|
"type": "array",
|
|
"items": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
{
|
|
"type": "string"
|
|
}
|
|
]
|
|
},
|
|
"known_hosts_data": {
|
|
"oneOf": [
|
|
{
|
|
"type": "array",
|
|
"items": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
{
|
|
"type": "string"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"required": [
|
|
"host"
|
|
]
|
|
}
|
|
}
|
|
}
|