mirror of
https://github.com/juanfont/headscale.git
synced 2026-04-28 03:27:15 +02:00
testdata: convert .json to .hujson with header comments
Rename all 594 test data files from .json to .hujson and add descriptive header comments to each file documenting what policy rules are under test and what outcome is expected. Update test loaders in all 5 _test.go files to parse HuJSON via hujson.Parse/Standardize/Pack before json.Unmarshal. Add cross-dependency warning to via_compat_test.go documenting that GRANT-V29/V30/V31/V36 are shared with TestGrantsCompat. Add .gitignore exemption for testdata HuJSON files.
This commit is contained in:
245
hscontrol/policy/v2/testdata/ssh_results/SSH-E6.hujson
vendored
Normal file
245
hscontrol/policy/v2/testdata/ssh_results/SSH-E6.hujson
vendored
Normal file
@@ -0,0 +1,245 @@
|
||||
// SSH-E6
|
||||
//
|
||||
// SSH: check: src=['autogroup:member'] dst=['tag:server'] users=['localpart:*@passkey']
|
||||
//
|
||||
// Expected: SSH rules on 4 of 5 nodes
|
||||
{
|
||||
"test_id": "SSH-E6",
|
||||
"policy_file": "ssh_policies/ssh_e6.json",
|
||||
"ssh_section": [
|
||||
{
|
||||
"action": "check",
|
||||
"src": [
|
||||
"autogroup:member"
|
||||
],
|
||||
"dst": [
|
||||
"tag:server"
|
||||
],
|
||||
"users": [
|
||||
"localpart:*@passkey"
|
||||
],
|
||||
"checkPeriod": "1h"
|
||||
}
|
||||
],
|
||||
"nodes": {
|
||||
"user1": {
|
||||
"rules": [
|
||||
{
|
||||
"principals": [
|
||||
{
|
||||
"nodeIP": "100.90.199.68"
|
||||
},
|
||||
{
|
||||
"nodeIP": "fd7a:115c:a1e0::2d01:c747"
|
||||
}
|
||||
],
|
||||
"sshUsers": {
|
||||
"root": ""
|
||||
},
|
||||
"action": {
|
||||
"holdAndDelegate": "unused-server-url/machine/ssh/action/from/$SRC_NODE_ID/to/$DST_NODE_ID?ssh_user=$SSH_USER&local_user=$LOCAL_USER",
|
||||
"allowAgentForwarding": true,
|
||||
"allowLocalPortForwarding": true,
|
||||
"allowRemotePortForwarding": true,
|
||||
"sessionDuration": 3600000000000
|
||||
}
|
||||
},
|
||||
{
|
||||
"principals": [
|
||||
{
|
||||
"nodeIP": "100.90.199.68"
|
||||
},
|
||||
{
|
||||
"nodeIP": "fd7a:115c:a1e0::2d01:c747"
|
||||
}
|
||||
],
|
||||
"sshUsers": {
|
||||
"kratail2tid": "kratail2tid"
|
||||
},
|
||||
"action": {
|
||||
"holdAndDelegate": "unused-server-url/machine/ssh/action/from/$SRC_NODE_ID/to/$DST_NODE_ID?ssh_user=$SSH_USER&local_user=$LOCAL_USER",
|
||||
"allowAgentForwarding": true,
|
||||
"allowLocalPortForwarding": true,
|
||||
"allowRemotePortForwarding": true,
|
||||
"sessionDuration": 3600000000000
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"user-kris": {
|
||||
"rules": [
|
||||
{
|
||||
"principals": [
|
||||
{
|
||||
"nodeIP": "100.110.121.96"
|
||||
},
|
||||
{
|
||||
"nodeIP": "fd7a:115c:a1e0::1737:7960"
|
||||
}
|
||||
],
|
||||
"sshUsers": {
|
||||
"root": ""
|
||||
},
|
||||
"action": {
|
||||
"holdAndDelegate": "unused-server-url/machine/ssh/action/from/$SRC_NODE_ID/to/$DST_NODE_ID?ssh_user=$SSH_USER&local_user=$LOCAL_USER",
|
||||
"allowAgentForwarding": true,
|
||||
"allowLocalPortForwarding": true,
|
||||
"allowRemotePortForwarding": true,
|
||||
"sessionDuration": 3600000000000
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"user-mon": {
|
||||
"rules": [
|
||||
{
|
||||
"principals": [
|
||||
{
|
||||
"nodeIP": "100.103.90.82"
|
||||
},
|
||||
{
|
||||
"nodeIP": "fd7a:115c:a1e0::9e37:5a52"
|
||||
}
|
||||
],
|
||||
"sshUsers": {
|
||||
"root": ""
|
||||
},
|
||||
"action": {
|
||||
"holdAndDelegate": "unused-server-url/machine/ssh/action/from/$SRC_NODE_ID/to/$DST_NODE_ID?ssh_user=$SSH_USER&local_user=$LOCAL_USER",
|
||||
"allowAgentForwarding": true,
|
||||
"allowLocalPortForwarding": true,
|
||||
"allowRemotePortForwarding": true,
|
||||
"sessionDuration": 3600000000000
|
||||
}
|
||||
},
|
||||
{
|
||||
"principals": [
|
||||
{
|
||||
"nodeIP": "100.103.90.82"
|
||||
},
|
||||
{
|
||||
"nodeIP": "fd7a:115c:a1e0::9e37:5a52"
|
||||
}
|
||||
],
|
||||
"sshUsers": {
|
||||
"monitorpasskeykradalby": "monitorpasskeykradalby"
|
||||
},
|
||||
"action": {
|
||||
"holdAndDelegate": "unused-server-url/machine/ssh/action/from/$SRC_NODE_ID/to/$DST_NODE_ID?ssh_user=$SSH_USER&local_user=$LOCAL_USER",
|
||||
"allowAgentForwarding": true,
|
||||
"allowLocalPortForwarding": true,
|
||||
"allowRemotePortForwarding": true,
|
||||
"sessionDuration": 3600000000000
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"tagged-server": {
|
||||
"rules": [
|
||||
{
|
||||
"principals": [
|
||||
{
|
||||
"nodeIP": "100.90.199.68"
|
||||
},
|
||||
{
|
||||
"nodeIP": "fd7a:115c:a1e0::2d01:c747"
|
||||
}
|
||||
],
|
||||
"sshUsers": {
|
||||
"root": ""
|
||||
},
|
||||
"action": {
|
||||
"holdAndDelegate": "unused-server-url/machine/ssh/action/from/$SRC_NODE_ID/to/$DST_NODE_ID?ssh_user=$SSH_USER&local_user=$LOCAL_USER",
|
||||
"allowAgentForwarding": true,
|
||||
"allowLocalPortForwarding": true,
|
||||
"allowRemotePortForwarding": true,
|
||||
"sessionDuration": 3600000000000
|
||||
}
|
||||
},
|
||||
{
|
||||
"principals": [
|
||||
{
|
||||
"nodeIP": "100.90.199.68"
|
||||
},
|
||||
{
|
||||
"nodeIP": "fd7a:115c:a1e0::2d01:c747"
|
||||
}
|
||||
],
|
||||
"sshUsers": {
|
||||
"kratail2tid": "kratail2tid"
|
||||
},
|
||||
"action": {
|
||||
"holdAndDelegate": "unused-server-url/machine/ssh/action/from/$SRC_NODE_ID/to/$DST_NODE_ID?ssh_user=$SSH_USER&local_user=$LOCAL_USER",
|
||||
"allowAgentForwarding": true,
|
||||
"allowLocalPortForwarding": true,
|
||||
"allowRemotePortForwarding": true,
|
||||
"sessionDuration": 3600000000000
|
||||
}
|
||||
},
|
||||
{
|
||||
"principals": [
|
||||
{
|
||||
"nodeIP": "100.110.121.96"
|
||||
},
|
||||
{
|
||||
"nodeIP": "fd7a:115c:a1e0::1737:7960"
|
||||
}
|
||||
],
|
||||
"sshUsers": {
|
||||
"root": ""
|
||||
},
|
||||
"action": {
|
||||
"holdAndDelegate": "unused-server-url/machine/ssh/action/from/$SRC_NODE_ID/to/$DST_NODE_ID?ssh_user=$SSH_USER&local_user=$LOCAL_USER",
|
||||
"allowAgentForwarding": true,
|
||||
"allowLocalPortForwarding": true,
|
||||
"allowRemotePortForwarding": true,
|
||||
"sessionDuration": 3600000000000
|
||||
}
|
||||
},
|
||||
{
|
||||
"principals": [
|
||||
{
|
||||
"nodeIP": "100.103.90.82"
|
||||
},
|
||||
{
|
||||
"nodeIP": "fd7a:115c:a1e0::9e37:5a52"
|
||||
}
|
||||
],
|
||||
"sshUsers": {
|
||||
"root": ""
|
||||
},
|
||||
"action": {
|
||||
"holdAndDelegate": "unused-server-url/machine/ssh/action/from/$SRC_NODE_ID/to/$DST_NODE_ID?ssh_user=$SSH_USER&local_user=$LOCAL_USER",
|
||||
"allowAgentForwarding": true,
|
||||
"allowLocalPortForwarding": true,
|
||||
"allowRemotePortForwarding": true,
|
||||
"sessionDuration": 3600000000000
|
||||
}
|
||||
},
|
||||
{
|
||||
"principals": [
|
||||
{
|
||||
"nodeIP": "100.103.90.82"
|
||||
},
|
||||
{
|
||||
"nodeIP": "fd7a:115c:a1e0::9e37:5a52"
|
||||
}
|
||||
],
|
||||
"sshUsers": {
|
||||
"monitorpasskeykradalby": "monitorpasskeykradalby"
|
||||
},
|
||||
"action": {
|
||||
"holdAndDelegate": "unused-server-url/machine/ssh/action/from/$SRC_NODE_ID/to/$DST_NODE_ID?ssh_user=$SSH_USER&local_user=$LOCAL_USER",
|
||||
"allowAgentForwarding": true,
|
||||
"allowLocalPortForwarding": true,
|
||||
"allowRemotePortForwarding": true,
|
||||
"sessionDuration": 3600000000000
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"tagged-prod": {
|
||||
"rules": []
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user