|
|
@ -909,38 +909,38 @@ func Test_listMachinesInUser(t *testing.T) {
|
|
|
|
name: "1 machine in user",
|
|
|
|
name: "1 machine in user",
|
|
|
|
args: args{
|
|
|
|
args: args{
|
|
|
|
machines: types.Machines{
|
|
|
|
machines: types.Machines{
|
|
|
|
{User: types.User{Name: "joe"}},
|
|
|
|
types.Machine{User: types.User{Name: "joe"}},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
user: "joe",
|
|
|
|
user: "joe",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
want: types.Machines{
|
|
|
|
want: types.Machines{
|
|
|
|
{User: types.User{Name: "joe"}},
|
|
|
|
types.Machine{User: types.User{Name: "joe"}},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{
|
|
|
|
name: "3 machines, 2 in user",
|
|
|
|
name: "3 machines, 2 in user",
|
|
|
|
args: args{
|
|
|
|
args: args{
|
|
|
|
machines: types.Machines{
|
|
|
|
machines: types.Machines{
|
|
|
|
{ID: 1, User: types.User{Name: "joe"}},
|
|
|
|
types.Machine{ID: 1, User: types.User{Name: "joe"}},
|
|
|
|
{ID: 2, User: types.User{Name: "marc"}},
|
|
|
|
types.Machine{ID: 2, User: types.User{Name: "marc"}},
|
|
|
|
{ID: 3, User: types.User{Name: "marc"}},
|
|
|
|
types.Machine{ID: 3, User: types.User{Name: "marc"}},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
user: "marc",
|
|
|
|
user: "marc",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
want: types.Machines{
|
|
|
|
want: types.Machines{
|
|
|
|
{ID: 2, User: types.User{Name: "marc"}},
|
|
|
|
types.Machine{ID: 2, User: types.User{Name: "marc"}},
|
|
|
|
{ID: 3, User: types.User{Name: "marc"}},
|
|
|
|
types.Machine{ID: 3, User: types.User{Name: "marc"}},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{
|
|
|
|
name: "5 machines, 0 in user",
|
|
|
|
name: "5 machines, 0 in user",
|
|
|
|
args: args{
|
|
|
|
args: args{
|
|
|
|
machines: types.Machines{
|
|
|
|
machines: types.Machines{
|
|
|
|
{ID: 1, User: types.User{Name: "joe"}},
|
|
|
|
types.Machine{ID: 1, User: types.User{Name: "joe"}},
|
|
|
|
{ID: 2, User: types.User{Name: "marc"}},
|
|
|
|
types.Machine{ID: 2, User: types.User{Name: "marc"}},
|
|
|
|
{ID: 3, User: types.User{Name: "marc"}},
|
|
|
|
types.Machine{ID: 3, User: types.User{Name: "marc"}},
|
|
|
|
{ID: 4, User: types.User{Name: "marc"}},
|
|
|
|
types.Machine{ID: 4, User: types.User{Name: "marc"}},
|
|
|
|
{ID: 5, User: types.User{Name: "marc"}},
|
|
|
|
types.Machine{ID: 5, User: types.User{Name: "marc"}},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
user: "mickael",
|
|
|
|
user: "mickael",
|
|
|
|
},
|
|
|
|
},
|
|
|
@ -998,8 +998,10 @@ func Test_expandAlias(t *testing.T) {
|
|
|
|
args: args{
|
|
|
|
args: args{
|
|
|
|
alias: "*",
|
|
|
|
alias: "*",
|
|
|
|
machines: types.Machines{
|
|
|
|
machines: types.Machines{
|
|
|
|
{IPAddresses: types.MachineAddresses{netip.MustParseAddr("100.64.0.1")}},
|
|
|
|
types.Machine{
|
|
|
|
{
|
|
|
|
IPAddresses: types.MachineAddresses{netip.MustParseAddr("100.64.0.1")},
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
types.Machine{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
netip.MustParseAddr("100.78.84.227"),
|
|
|
|
netip.MustParseAddr("100.78.84.227"),
|
|
|
|
},
|
|
|
|
},
|
|
|
@ -1022,25 +1024,25 @@ func Test_expandAlias(t *testing.T) {
|
|
|
|
args: args{
|
|
|
|
args: args{
|
|
|
|
alias: "group:accountant",
|
|
|
|
alias: "group:accountant",
|
|
|
|
machines: types.Machines{
|
|
|
|
machines: types.Machines{
|
|
|
|
{
|
|
|
|
types.Machine{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
netip.MustParseAddr("100.64.0.1"),
|
|
|
|
netip.MustParseAddr("100.64.0.1"),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
User: types.User{Name: "joe"},
|
|
|
|
User: types.User{Name: "joe"},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
types.Machine{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
netip.MustParseAddr("100.64.0.2"),
|
|
|
|
netip.MustParseAddr("100.64.0.2"),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
User: types.User{Name: "joe"},
|
|
|
|
User: types.User{Name: "joe"},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
types.Machine{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
netip.MustParseAddr("100.64.0.3"),
|
|
|
|
netip.MustParseAddr("100.64.0.3"),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
User: types.User{Name: "marc"},
|
|
|
|
User: types.User{Name: "marc"},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
types.Machine{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
netip.MustParseAddr("100.64.0.4"),
|
|
|
|
netip.MustParseAddr("100.64.0.4"),
|
|
|
|
},
|
|
|
|
},
|
|
|
@ -1063,25 +1065,25 @@ func Test_expandAlias(t *testing.T) {
|
|
|
|
args: args{
|
|
|
|
args: args{
|
|
|
|
alias: "group:hr",
|
|
|
|
alias: "group:hr",
|
|
|
|
machines: types.Machines{
|
|
|
|
machines: types.Machines{
|
|
|
|
{
|
|
|
|
types.Machine{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
netip.MustParseAddr("100.64.0.1"),
|
|
|
|
netip.MustParseAddr("100.64.0.1"),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
User: types.User{Name: "joe"},
|
|
|
|
User: types.User{Name: "joe"},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
types.Machine{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
netip.MustParseAddr("100.64.0.2"),
|
|
|
|
netip.MustParseAddr("100.64.0.2"),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
User: types.User{Name: "joe"},
|
|
|
|
User: types.User{Name: "joe"},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
types.Machine{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
netip.MustParseAddr("100.64.0.3"),
|
|
|
|
netip.MustParseAddr("100.64.0.3"),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
User: types.User{Name: "marc"},
|
|
|
|
User: types.User{Name: "marc"},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
types.Machine{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
netip.MustParseAddr("100.64.0.4"),
|
|
|
|
netip.MustParseAddr("100.64.0.4"),
|
|
|
|
},
|
|
|
|
},
|
|
|
@ -1128,7 +1130,7 @@ func Test_expandAlias(t *testing.T) {
|
|
|
|
args: args{
|
|
|
|
args: args{
|
|
|
|
alias: "10.0.0.1",
|
|
|
|
alias: "10.0.0.1",
|
|
|
|
machines: types.Machines{
|
|
|
|
machines: types.Machines{
|
|
|
|
{
|
|
|
|
types.Machine{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
netip.MustParseAddr("10.0.0.1"),
|
|
|
|
netip.MustParseAddr("10.0.0.1"),
|
|
|
|
},
|
|
|
|
},
|
|
|
@ -1149,7 +1151,7 @@ func Test_expandAlias(t *testing.T) {
|
|
|
|
args: args{
|
|
|
|
args: args{
|
|
|
|
alias: "10.0.0.1",
|
|
|
|
alias: "10.0.0.1",
|
|
|
|
machines: types.Machines{
|
|
|
|
machines: types.Machines{
|
|
|
|
{
|
|
|
|
types.Machine{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
netip.MustParseAddr("10.0.0.1"),
|
|
|
|
netip.MustParseAddr("10.0.0.1"),
|
|
|
|
netip.MustParseAddr("fd7a:115c:a1e0:ab12:4843:2222:6273:2222"),
|
|
|
|
netip.MustParseAddr("fd7a:115c:a1e0:ab12:4843:2222:6273:2222"),
|
|
|
@ -1171,7 +1173,7 @@ func Test_expandAlias(t *testing.T) {
|
|
|
|
args: args{
|
|
|
|
args: args{
|
|
|
|
alias: "fd7a:115c:a1e0:ab12:4843:2222:6273:2222",
|
|
|
|
alias: "fd7a:115c:a1e0:ab12:4843:2222:6273:2222",
|
|
|
|
machines: types.Machines{
|
|
|
|
machines: types.Machines{
|
|
|
|
{
|
|
|
|
types.Machine{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
netip.MustParseAddr("10.0.0.1"),
|
|
|
|
netip.MustParseAddr("10.0.0.1"),
|
|
|
|
netip.MustParseAddr("fd7a:115c:a1e0:ab12:4843:2222:6273:2222"),
|
|
|
|
netip.MustParseAddr("fd7a:115c:a1e0:ab12:4843:2222:6273:2222"),
|
|
|
@ -1240,7 +1242,7 @@ func Test_expandAlias(t *testing.T) {
|
|
|
|
args: args{
|
|
|
|
args: args{
|
|
|
|
alias: "tag:hr-webserver",
|
|
|
|
alias: "tag:hr-webserver",
|
|
|
|
machines: types.Machines{
|
|
|
|
machines: types.Machines{
|
|
|
|
{
|
|
|
|
types.Machine{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
netip.MustParseAddr("100.64.0.1"),
|
|
|
|
netip.MustParseAddr("100.64.0.1"),
|
|
|
|
},
|
|
|
|
},
|
|
|
@ -1251,7 +1253,7 @@ func Test_expandAlias(t *testing.T) {
|
|
|
|
RequestTags: []string{"tag:hr-webserver"},
|
|
|
|
RequestTags: []string{"tag:hr-webserver"},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
types.Machine{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
netip.MustParseAddr("100.64.0.2"),
|
|
|
|
netip.MustParseAddr("100.64.0.2"),
|
|
|
|
},
|
|
|
|
},
|
|
|
@ -1262,13 +1264,13 @@ func Test_expandAlias(t *testing.T) {
|
|
|
|
RequestTags: []string{"tag:hr-webserver"},
|
|
|
|
RequestTags: []string{"tag:hr-webserver"},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
types.Machine{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
netip.MustParseAddr("100.64.0.3"),
|
|
|
|
netip.MustParseAddr("100.64.0.3"),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
User: types.User{Name: "marc"},
|
|
|
|
User: types.User{Name: "marc"},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
types.Machine{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
netip.MustParseAddr("100.64.0.4"),
|
|
|
|
netip.MustParseAddr("100.64.0.4"),
|
|
|
|
},
|
|
|
|
},
|
|
|
@ -1294,25 +1296,25 @@ func Test_expandAlias(t *testing.T) {
|
|
|
|
args: args{
|
|
|
|
args: args{
|
|
|
|
alias: "tag:hr-webserver",
|
|
|
|
alias: "tag:hr-webserver",
|
|
|
|
machines: types.Machines{
|
|
|
|
machines: types.Machines{
|
|
|
|
{
|
|
|
|
types.Machine{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
netip.MustParseAddr("100.64.0.1"),
|
|
|
|
netip.MustParseAddr("100.64.0.1"),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
User: types.User{Name: "joe"},
|
|
|
|
User: types.User{Name: "joe"},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
types.Machine{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
netip.MustParseAddr("100.64.0.2"),
|
|
|
|
netip.MustParseAddr("100.64.0.2"),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
User: types.User{Name: "joe"},
|
|
|
|
User: types.User{Name: "joe"},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
types.Machine{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
netip.MustParseAddr("100.64.0.3"),
|
|
|
|
netip.MustParseAddr("100.64.0.3"),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
User: types.User{Name: "marc"},
|
|
|
|
User: types.User{Name: "marc"},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
types.Machine{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
netip.MustParseAddr("100.64.0.4"),
|
|
|
|
netip.MustParseAddr("100.64.0.4"),
|
|
|
|
},
|
|
|
|
},
|
|
|
@ -1331,27 +1333,27 @@ func Test_expandAlias(t *testing.T) {
|
|
|
|
args: args{
|
|
|
|
args: args{
|
|
|
|
alias: "tag:hr-webserver",
|
|
|
|
alias: "tag:hr-webserver",
|
|
|
|
machines: types.Machines{
|
|
|
|
machines: types.Machines{
|
|
|
|
{
|
|
|
|
types.Machine{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
netip.MustParseAddr("100.64.0.1"),
|
|
|
|
netip.MustParseAddr("100.64.0.1"),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
User: types.User{Name: "joe"},
|
|
|
|
User: types.User{Name: "joe"},
|
|
|
|
ForcedTags: []string{"tag:hr-webserver"},
|
|
|
|
ForcedTags: []string{"tag:hr-webserver"},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
types.Machine{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
netip.MustParseAddr("100.64.0.2"),
|
|
|
|
netip.MustParseAddr("100.64.0.2"),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
User: types.User{Name: "joe"},
|
|
|
|
User: types.User{Name: "joe"},
|
|
|
|
ForcedTags: []string{"tag:hr-webserver"},
|
|
|
|
ForcedTags: []string{"tag:hr-webserver"},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
types.Machine{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
netip.MustParseAddr("100.64.0.3"),
|
|
|
|
netip.MustParseAddr("100.64.0.3"),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
User: types.User{Name: "marc"},
|
|
|
|
User: types.User{Name: "marc"},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
types.Machine{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
netip.MustParseAddr("100.64.0.4"),
|
|
|
|
netip.MustParseAddr("100.64.0.4"),
|
|
|
|
},
|
|
|
|
},
|
|
|
@ -1374,14 +1376,14 @@ func Test_expandAlias(t *testing.T) {
|
|
|
|
args: args{
|
|
|
|
args: args{
|
|
|
|
alias: "tag:hr-webserver",
|
|
|
|
alias: "tag:hr-webserver",
|
|
|
|
machines: types.Machines{
|
|
|
|
machines: types.Machines{
|
|
|
|
{
|
|
|
|
types.Machine{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
netip.MustParseAddr("100.64.0.1"),
|
|
|
|
netip.MustParseAddr("100.64.0.1"),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
User: types.User{Name: "joe"},
|
|
|
|
User: types.User{Name: "joe"},
|
|
|
|
ForcedTags: []string{"tag:hr-webserver"},
|
|
|
|
ForcedTags: []string{"tag:hr-webserver"},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
types.Machine{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
netip.MustParseAddr("100.64.0.2"),
|
|
|
|
netip.MustParseAddr("100.64.0.2"),
|
|
|
|
},
|
|
|
|
},
|
|
|
@ -1392,13 +1394,13 @@ func Test_expandAlias(t *testing.T) {
|
|
|
|
RequestTags: []string{"tag:hr-webserver"},
|
|
|
|
RequestTags: []string{"tag:hr-webserver"},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
types.Machine{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
netip.MustParseAddr("100.64.0.3"),
|
|
|
|
netip.MustParseAddr("100.64.0.3"),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
User: types.User{Name: "marc"},
|
|
|
|
User: types.User{Name: "marc"},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
types.Machine{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
netip.MustParseAddr("100.64.0.4"),
|
|
|
|
netip.MustParseAddr("100.64.0.4"),
|
|
|
|
},
|
|
|
|
},
|
|
|
@ -1419,7 +1421,7 @@ func Test_expandAlias(t *testing.T) {
|
|
|
|
args: args{
|
|
|
|
args: args{
|
|
|
|
alias: "joe",
|
|
|
|
alias: "joe",
|
|
|
|
machines: types.Machines{
|
|
|
|
machines: types.Machines{
|
|
|
|
{
|
|
|
|
types.Machine{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
netip.MustParseAddr("100.64.0.1"),
|
|
|
|
netip.MustParseAddr("100.64.0.1"),
|
|
|
|
},
|
|
|
|
},
|
|
|
@ -1430,7 +1432,7 @@ func Test_expandAlias(t *testing.T) {
|
|
|
|
RequestTags: []string{"tag:accountant-webserver"},
|
|
|
|
RequestTags: []string{"tag:accountant-webserver"},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
types.Machine{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
netip.MustParseAddr("100.64.0.2"),
|
|
|
|
netip.MustParseAddr("100.64.0.2"),
|
|
|
|
},
|
|
|
|
},
|
|
|
@ -1441,13 +1443,13 @@ func Test_expandAlias(t *testing.T) {
|
|
|
|
RequestTags: []string{"tag:accountant-webserver"},
|
|
|
|
RequestTags: []string{"tag:accountant-webserver"},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
types.Machine{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
netip.MustParseAddr("100.64.0.3"),
|
|
|
|
netip.MustParseAddr("100.64.0.3"),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
User: types.User{Name: "marc"},
|
|
|
|
User: types.User{Name: "marc"},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
types.Machine{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
netip.MustParseAddr("100.64.0.4"),
|
|
|
|
netip.MustParseAddr("100.64.0.4"),
|
|
|
|
},
|
|
|
|
},
|
|
|
@ -1496,7 +1498,7 @@ func Test_excludeCorrectlyTaggedNodes(t *testing.T) {
|
|
|
|
TagOwners: TagOwners{"tag:accountant-webserver": []string{"joe"}},
|
|
|
|
TagOwners: TagOwners{"tag:accountant-webserver": []string{"joe"}},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
nodes: types.Machines{
|
|
|
|
nodes: types.Machines{
|
|
|
|
{
|
|
|
|
types.Machine{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
netip.MustParseAddr("100.64.0.1"),
|
|
|
|
netip.MustParseAddr("100.64.0.1"),
|
|
|
|
},
|
|
|
|
},
|
|
|
@ -1507,7 +1509,7 @@ func Test_excludeCorrectlyTaggedNodes(t *testing.T) {
|
|
|
|
RequestTags: []string{"tag:accountant-webserver"},
|
|
|
|
RequestTags: []string{"tag:accountant-webserver"},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
types.Machine{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
netip.MustParseAddr("100.64.0.2"),
|
|
|
|
netip.MustParseAddr("100.64.0.2"),
|
|
|
|
},
|
|
|
|
},
|
|
|
@ -1518,7 +1520,7 @@ func Test_excludeCorrectlyTaggedNodes(t *testing.T) {
|
|
|
|
RequestTags: []string{"tag:accountant-webserver"},
|
|
|
|
RequestTags: []string{"tag:accountant-webserver"},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
types.Machine{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
netip.MustParseAddr("100.64.0.4"),
|
|
|
|
netip.MustParseAddr("100.64.0.4"),
|
|
|
|
},
|
|
|
|
},
|
|
|
@ -1528,7 +1530,7 @@ func Test_excludeCorrectlyTaggedNodes(t *testing.T) {
|
|
|
|
user: "joe",
|
|
|
|
user: "joe",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
want: types.Machines{
|
|
|
|
want: types.Machines{
|
|
|
|
{
|
|
|
|
types.Machine{
|
|
|
|
IPAddresses: types.MachineAddresses{netip.MustParseAddr("100.64.0.4")},
|
|
|
|
IPAddresses: types.MachineAddresses{netip.MustParseAddr("100.64.0.4")},
|
|
|
|
User: types.User{Name: "joe"},
|
|
|
|
User: types.User{Name: "joe"},
|
|
|
|
},
|
|
|
|
},
|
|
|
@ -1546,7 +1548,7 @@ func Test_excludeCorrectlyTaggedNodes(t *testing.T) {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
nodes: types.Machines{
|
|
|
|
nodes: types.Machines{
|
|
|
|
{
|
|
|
|
types.Machine{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
netip.MustParseAddr("100.64.0.1"),
|
|
|
|
netip.MustParseAddr("100.64.0.1"),
|
|
|
|
},
|
|
|
|
},
|
|
|
@ -1557,7 +1559,7 @@ func Test_excludeCorrectlyTaggedNodes(t *testing.T) {
|
|
|
|
RequestTags: []string{"tag:accountant-webserver"},
|
|
|
|
RequestTags: []string{"tag:accountant-webserver"},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
types.Machine{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
netip.MustParseAddr("100.64.0.2"),
|
|
|
|
netip.MustParseAddr("100.64.0.2"),
|
|
|
|
},
|
|
|
|
},
|
|
|
@ -1568,7 +1570,7 @@ func Test_excludeCorrectlyTaggedNodes(t *testing.T) {
|
|
|
|
RequestTags: []string{"tag:accountant-webserver"},
|
|
|
|
RequestTags: []string{"tag:accountant-webserver"},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
types.Machine{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
netip.MustParseAddr("100.64.0.4"),
|
|
|
|
netip.MustParseAddr("100.64.0.4"),
|
|
|
|
},
|
|
|
|
},
|
|
|
@ -1578,7 +1580,7 @@ func Test_excludeCorrectlyTaggedNodes(t *testing.T) {
|
|
|
|
user: "joe",
|
|
|
|
user: "joe",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
want: types.Machines{
|
|
|
|
want: types.Machines{
|
|
|
|
{
|
|
|
|
types.Machine{
|
|
|
|
IPAddresses: types.MachineAddresses{netip.MustParseAddr("100.64.0.4")},
|
|
|
|
IPAddresses: types.MachineAddresses{netip.MustParseAddr("100.64.0.4")},
|
|
|
|
User: types.User{Name: "joe"},
|
|
|
|
User: types.User{Name: "joe"},
|
|
|
|
},
|
|
|
|
},
|
|
|
@ -1591,7 +1593,7 @@ func Test_excludeCorrectlyTaggedNodes(t *testing.T) {
|
|
|
|
TagOwners: TagOwners{"tag:accountant-webserver": []string{"joe"}},
|
|
|
|
TagOwners: TagOwners{"tag:accountant-webserver": []string{"joe"}},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
nodes: types.Machines{
|
|
|
|
nodes: types.Machines{
|
|
|
|
{
|
|
|
|
types.Machine{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
netip.MustParseAddr("100.64.0.1"),
|
|
|
|
netip.MustParseAddr("100.64.0.1"),
|
|
|
|
},
|
|
|
|
},
|
|
|
@ -1602,14 +1604,14 @@ func Test_excludeCorrectlyTaggedNodes(t *testing.T) {
|
|
|
|
RequestTags: []string{"tag:accountant-webserver"},
|
|
|
|
RequestTags: []string{"tag:accountant-webserver"},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
types.Machine{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
netip.MustParseAddr("100.64.0.2"),
|
|
|
|
netip.MustParseAddr("100.64.0.2"),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
User: types.User{Name: "joe"},
|
|
|
|
User: types.User{Name: "joe"},
|
|
|
|
ForcedTags: []string{"tag:accountant-webserver"},
|
|
|
|
ForcedTags: []string{"tag:accountant-webserver"},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
types.Machine{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
netip.MustParseAddr("100.64.0.4"),
|
|
|
|
netip.MustParseAddr("100.64.0.4"),
|
|
|
|
},
|
|
|
|
},
|
|
|
@ -1619,7 +1621,7 @@ func Test_excludeCorrectlyTaggedNodes(t *testing.T) {
|
|
|
|
user: "joe",
|
|
|
|
user: "joe",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
want: types.Machines{
|
|
|
|
want: types.Machines{
|
|
|
|
{
|
|
|
|
types.Machine{
|
|
|
|
IPAddresses: types.MachineAddresses{netip.MustParseAddr("100.64.0.4")},
|
|
|
|
IPAddresses: types.MachineAddresses{netip.MustParseAddr("100.64.0.4")},
|
|
|
|
User: types.User{Name: "joe"},
|
|
|
|
User: types.User{Name: "joe"},
|
|
|
|
},
|
|
|
|
},
|
|
|
@ -1632,7 +1634,7 @@ func Test_excludeCorrectlyTaggedNodes(t *testing.T) {
|
|
|
|
TagOwners: TagOwners{"tag:accountant-webserver": []string{"joe"}},
|
|
|
|
TagOwners: TagOwners{"tag:accountant-webserver": []string{"joe"}},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
nodes: types.Machines{
|
|
|
|
nodes: types.Machines{
|
|
|
|
{
|
|
|
|
types.Machine{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
netip.MustParseAddr("100.64.0.1"),
|
|
|
|
netip.MustParseAddr("100.64.0.1"),
|
|
|
|
},
|
|
|
|
},
|
|
|
@ -1643,7 +1645,7 @@ func Test_excludeCorrectlyTaggedNodes(t *testing.T) {
|
|
|
|
RequestTags: []string{"tag:hr-webserver"},
|
|
|
|
RequestTags: []string{"tag:hr-webserver"},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
types.Machine{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
netip.MustParseAddr("100.64.0.2"),
|
|
|
|
netip.MustParseAddr("100.64.0.2"),
|
|
|
|
},
|
|
|
|
},
|
|
|
@ -1654,7 +1656,7 @@ func Test_excludeCorrectlyTaggedNodes(t *testing.T) {
|
|
|
|
RequestTags: []string{"tag:hr-webserver"},
|
|
|
|
RequestTags: []string{"tag:hr-webserver"},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
types.Machine{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
netip.MustParseAddr("100.64.0.4"),
|
|
|
|
netip.MustParseAddr("100.64.0.4"),
|
|
|
|
},
|
|
|
|
},
|
|
|
@ -1664,7 +1666,7 @@ func Test_excludeCorrectlyTaggedNodes(t *testing.T) {
|
|
|
|
user: "joe",
|
|
|
|
user: "joe",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
want: types.Machines{
|
|
|
|
want: types.Machines{
|
|
|
|
{
|
|
|
|
types.Machine{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
netip.MustParseAddr("100.64.0.1"),
|
|
|
|
netip.MustParseAddr("100.64.0.1"),
|
|
|
|
},
|
|
|
|
},
|
|
|
@ -1675,7 +1677,7 @@ func Test_excludeCorrectlyTaggedNodes(t *testing.T) {
|
|
|
|
RequestTags: []string{"tag:hr-webserver"},
|
|
|
|
RequestTags: []string{"tag:hr-webserver"},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
types.Machine{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
netip.MustParseAddr("100.64.0.2"),
|
|
|
|
netip.MustParseAddr("100.64.0.2"),
|
|
|
|
},
|
|
|
|
},
|
|
|
@ -1686,7 +1688,7 @@ func Test_excludeCorrectlyTaggedNodes(t *testing.T) {
|
|
|
|
RequestTags: []string{"tag:hr-webserver"},
|
|
|
|
RequestTags: []string{"tag:hr-webserver"},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
types.Machine{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
netip.MustParseAddr("100.64.0.4"),
|
|
|
|
netip.MustParseAddr("100.64.0.4"),
|
|
|
|
},
|
|
|
|
},
|
|
|
@ -1798,7 +1800,7 @@ func TestACLPolicy_generateFilterRules(t *testing.T) {
|
|
|
|
User: types.User{Name: "mickael"},
|
|
|
|
User: types.User{Name: "mickael"},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
peers: types.Machines{
|
|
|
|
peers: types.Machines{
|
|
|
|
{
|
|
|
|
types.Machine{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
netip.MustParseAddr("100.64.0.2"),
|
|
|
|
netip.MustParseAddr("100.64.0.2"),
|
|
|
|
netip.MustParseAddr("fd7a:115c:a1e0:ab12:4843:2222:6273:2222"),
|
|
|
|
netip.MustParseAddr("fd7a:115c:a1e0:ab12:4843:2222:6273:2222"),
|
|
|
@ -1881,7 +1883,7 @@ func TestReduceFilterRules(t *testing.T) {
|
|
|
|
User: types.User{Name: "mickael"},
|
|
|
|
User: types.User{Name: "mickael"},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
peers: types.Machines{
|
|
|
|
peers: types.Machines{
|
|
|
|
{
|
|
|
|
types.Machine{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
netip.MustParseAddr("100.64.0.2"),
|
|
|
|
netip.MustParseAddr("100.64.0.2"),
|
|
|
|
netip.MustParseAddr("fd7a:115c:a1e0:ab12:4843:2222:6273:2222"),
|
|
|
|
netip.MustParseAddr("fd7a:115c:a1e0:ab12:4843:2222:6273:2222"),
|
|
|
@ -2072,21 +2074,21 @@ func Test_getFilteredByACLPeers(t *testing.T) {
|
|
|
|
name: "all hosts can talk to each other",
|
|
|
|
name: "all hosts can talk to each other",
|
|
|
|
args: args{
|
|
|
|
args: args{
|
|
|
|
machines: types.Machines{ // list of all machines in the database
|
|
|
|
machines: types.Machines{ // list of all machines in the database
|
|
|
|
{
|
|
|
|
types.Machine{
|
|
|
|
ID: 1,
|
|
|
|
ID: 1,
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
netip.MustParseAddr("100.64.0.1"),
|
|
|
|
netip.MustParseAddr("100.64.0.1"),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
User: types.User{Name: "joe"},
|
|
|
|
User: types.User{Name: "joe"},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
types.Machine{
|
|
|
|
ID: 2,
|
|
|
|
ID: 2,
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
netip.MustParseAddr("100.64.0.2"),
|
|
|
|
netip.MustParseAddr("100.64.0.2"),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
User: types.User{Name: "marc"},
|
|
|
|
User: types.User{Name: "marc"},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
types.Machine{
|
|
|
|
ID: 3,
|
|
|
|
ID: 3,
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
netip.MustParseAddr("100.64.0.3"),
|
|
|
|
netip.MustParseAddr("100.64.0.3"),
|
|
|
@ -2109,12 +2111,12 @@ func Test_getFilteredByACLPeers(t *testing.T) {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
want: types.Machines{
|
|
|
|
want: types.Machines{
|
|
|
|
{
|
|
|
|
types.Machine{
|
|
|
|
ID: 2,
|
|
|
|
ID: 2,
|
|
|
|
IPAddresses: types.MachineAddresses{netip.MustParseAddr("100.64.0.2")},
|
|
|
|
IPAddresses: types.MachineAddresses{netip.MustParseAddr("100.64.0.2")},
|
|
|
|
User: types.User{Name: "marc"},
|
|
|
|
User: types.User{Name: "marc"},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
types.Machine{
|
|
|
|
ID: 3,
|
|
|
|
ID: 3,
|
|
|
|
IPAddresses: types.MachineAddresses{netip.MustParseAddr("100.64.0.3")},
|
|
|
|
IPAddresses: types.MachineAddresses{netip.MustParseAddr("100.64.0.3")},
|
|
|
|
User: types.User{Name: "mickael"},
|
|
|
|
User: types.User{Name: "mickael"},
|
|
|
@ -2125,21 +2127,21 @@ func Test_getFilteredByACLPeers(t *testing.T) {
|
|
|
|
name: "One host can talk to another, but not all hosts",
|
|
|
|
name: "One host can talk to another, but not all hosts",
|
|
|
|
args: args{
|
|
|
|
args: args{
|
|
|
|
machines: types.Machines{ // list of all machines in the database
|
|
|
|
machines: types.Machines{ // list of all machines in the database
|
|
|
|
{
|
|
|
|
types.Machine{
|
|
|
|
ID: 1,
|
|
|
|
ID: 1,
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
netip.MustParseAddr("100.64.0.1"),
|
|
|
|
netip.MustParseAddr("100.64.0.1"),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
User: types.User{Name: "joe"},
|
|
|
|
User: types.User{Name: "joe"},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
types.Machine{
|
|
|
|
ID: 2,
|
|
|
|
ID: 2,
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
netip.MustParseAddr("100.64.0.2"),
|
|
|
|
netip.MustParseAddr("100.64.0.2"),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
User: types.User{Name: "marc"},
|
|
|
|
User: types.User{Name: "marc"},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
types.Machine{
|
|
|
|
ID: 3,
|
|
|
|
ID: 3,
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
netip.MustParseAddr("100.64.0.3"),
|
|
|
|
netip.MustParseAddr("100.64.0.3"),
|
|
|
@ -2162,7 +2164,7 @@ func Test_getFilteredByACLPeers(t *testing.T) {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
want: types.Machines{
|
|
|
|
want: types.Machines{
|
|
|
|
{
|
|
|
|
types.Machine{
|
|
|
|
ID: 2,
|
|
|
|
ID: 2,
|
|
|
|
IPAddresses: types.MachineAddresses{netip.MustParseAddr("100.64.0.2")},
|
|
|
|
IPAddresses: types.MachineAddresses{netip.MustParseAddr("100.64.0.2")},
|
|
|
|
User: types.User{Name: "marc"},
|
|
|
|
User: types.User{Name: "marc"},
|
|
|
@ -2173,21 +2175,21 @@ func Test_getFilteredByACLPeers(t *testing.T) {
|
|
|
|
name: "host cannot directly talk to destination, but return path is authorized",
|
|
|
|
name: "host cannot directly talk to destination, but return path is authorized",
|
|
|
|
args: args{
|
|
|
|
args: args{
|
|
|
|
machines: types.Machines{ // list of all machines in the database
|
|
|
|
machines: types.Machines{ // list of all machines in the database
|
|
|
|
{
|
|
|
|
types.Machine{
|
|
|
|
ID: 1,
|
|
|
|
ID: 1,
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
netip.MustParseAddr("100.64.0.1"),
|
|
|
|
netip.MustParseAddr("100.64.0.1"),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
User: types.User{Name: "joe"},
|
|
|
|
User: types.User{Name: "joe"},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
types.Machine{
|
|
|
|
ID: 2,
|
|
|
|
ID: 2,
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
netip.MustParseAddr("100.64.0.2"),
|
|
|
|
netip.MustParseAddr("100.64.0.2"),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
User: types.User{Name: "marc"},
|
|
|
|
User: types.User{Name: "marc"},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
types.Machine{
|
|
|
|
ID: 3,
|
|
|
|
ID: 3,
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
netip.MustParseAddr("100.64.0.3"),
|
|
|
|
netip.MustParseAddr("100.64.0.3"),
|
|
|
@ -2210,7 +2212,7 @@ func Test_getFilteredByACLPeers(t *testing.T) {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
want: types.Machines{
|
|
|
|
want: types.Machines{
|
|
|
|
{
|
|
|
|
types.Machine{
|
|
|
|
ID: 3,
|
|
|
|
ID: 3,
|
|
|
|
IPAddresses: types.MachineAddresses{netip.MustParseAddr("100.64.0.3")},
|
|
|
|
IPAddresses: types.MachineAddresses{netip.MustParseAddr("100.64.0.3")},
|
|
|
|
User: types.User{Name: "mickael"},
|
|
|
|
User: types.User{Name: "mickael"},
|
|
|
@ -2221,21 +2223,21 @@ func Test_getFilteredByACLPeers(t *testing.T) {
|
|
|
|
name: "rules allows all hosts to reach one destination",
|
|
|
|
name: "rules allows all hosts to reach one destination",
|
|
|
|
args: args{
|
|
|
|
args: args{
|
|
|
|
machines: types.Machines{ // list of all machines in the database
|
|
|
|
machines: types.Machines{ // list of all machines in the database
|
|
|
|
{
|
|
|
|
types.Machine{
|
|
|
|
ID: 1,
|
|
|
|
ID: 1,
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
netip.MustParseAddr("100.64.0.1"),
|
|
|
|
netip.MustParseAddr("100.64.0.1"),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
User: types.User{Name: "joe"},
|
|
|
|
User: types.User{Name: "joe"},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
types.Machine{
|
|
|
|
ID: 2,
|
|
|
|
ID: 2,
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
netip.MustParseAddr("100.64.0.2"),
|
|
|
|
netip.MustParseAddr("100.64.0.2"),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
User: types.User{Name: "marc"},
|
|
|
|
User: types.User{Name: "marc"},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
types.Machine{
|
|
|
|
ID: 3,
|
|
|
|
ID: 3,
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
netip.MustParseAddr("100.64.0.3"),
|
|
|
|
netip.MustParseAddr("100.64.0.3"),
|
|
|
@ -2260,7 +2262,7 @@ func Test_getFilteredByACLPeers(t *testing.T) {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
want: types.Machines{
|
|
|
|
want: types.Machines{
|
|
|
|
{
|
|
|
|
types.Machine{
|
|
|
|
ID: 2,
|
|
|
|
ID: 2,
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
netip.MustParseAddr("100.64.0.2"),
|
|
|
|
netip.MustParseAddr("100.64.0.2"),
|
|
|
@ -2273,21 +2275,21 @@ func Test_getFilteredByACLPeers(t *testing.T) {
|
|
|
|
name: "rules allows all hosts to reach one destination, destination can reach all hosts",
|
|
|
|
name: "rules allows all hosts to reach one destination, destination can reach all hosts",
|
|
|
|
args: args{
|
|
|
|
args: args{
|
|
|
|
machines: types.Machines{ // list of all machines in the database
|
|
|
|
machines: types.Machines{ // list of all machines in the database
|
|
|
|
{
|
|
|
|
types.Machine{
|
|
|
|
ID: 1,
|
|
|
|
ID: 1,
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
netip.MustParseAddr("100.64.0.1"),
|
|
|
|
netip.MustParseAddr("100.64.0.1"),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
User: types.User{Name: "joe"},
|
|
|
|
User: types.User{Name: "joe"},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
types.Machine{
|
|
|
|
ID: 2,
|
|
|
|
ID: 2,
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
netip.MustParseAddr("100.64.0.2"),
|
|
|
|
netip.MustParseAddr("100.64.0.2"),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
User: types.User{Name: "marc"},
|
|
|
|
User: types.User{Name: "marc"},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
types.Machine{
|
|
|
|
ID: 3,
|
|
|
|
ID: 3,
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
netip.MustParseAddr("100.64.0.3"),
|
|
|
|
netip.MustParseAddr("100.64.0.3"),
|
|
|
@ -2312,14 +2314,14 @@ func Test_getFilteredByACLPeers(t *testing.T) {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
want: types.Machines{
|
|
|
|
want: types.Machines{
|
|
|
|
{
|
|
|
|
types.Machine{
|
|
|
|
ID: 1,
|
|
|
|
ID: 1,
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
netip.MustParseAddr("100.64.0.1"),
|
|
|
|
netip.MustParseAddr("100.64.0.1"),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
User: types.User{Name: "joe"},
|
|
|
|
User: types.User{Name: "joe"},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
types.Machine{
|
|
|
|
ID: 3,
|
|
|
|
ID: 3,
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
netip.MustParseAddr("100.64.0.3"),
|
|
|
|
netip.MustParseAddr("100.64.0.3"),
|
|
|
@ -2332,21 +2334,21 @@ func Test_getFilteredByACLPeers(t *testing.T) {
|
|
|
|
name: "rule allows all hosts to reach all destinations",
|
|
|
|
name: "rule allows all hosts to reach all destinations",
|
|
|
|
args: args{
|
|
|
|
args: args{
|
|
|
|
machines: types.Machines{ // list of all machines in the database
|
|
|
|
machines: types.Machines{ // list of all machines in the database
|
|
|
|
{
|
|
|
|
types.Machine{
|
|
|
|
ID: 1,
|
|
|
|
ID: 1,
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
netip.MustParseAddr("100.64.0.1"),
|
|
|
|
netip.MustParseAddr("100.64.0.1"),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
User: types.User{Name: "joe"},
|
|
|
|
User: types.User{Name: "joe"},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
types.Machine{
|
|
|
|
ID: 2,
|
|
|
|
ID: 2,
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
netip.MustParseAddr("100.64.0.2"),
|
|
|
|
netip.MustParseAddr("100.64.0.2"),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
User: types.User{Name: "marc"},
|
|
|
|
User: types.User{Name: "marc"},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
types.Machine{
|
|
|
|
ID: 3,
|
|
|
|
ID: 3,
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
netip.MustParseAddr("100.64.0.3"),
|
|
|
|
netip.MustParseAddr("100.64.0.3"),
|
|
|
@ -2369,14 +2371,14 @@ func Test_getFilteredByACLPeers(t *testing.T) {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
want: types.Machines{
|
|
|
|
want: types.Machines{
|
|
|
|
{
|
|
|
|
types.Machine{
|
|
|
|
ID: 1,
|
|
|
|
ID: 1,
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
netip.MustParseAddr("100.64.0.1"),
|
|
|
|
netip.MustParseAddr("100.64.0.1"),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
User: types.User{Name: "joe"},
|
|
|
|
User: types.User{Name: "joe"},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
types.Machine{
|
|
|
|
ID: 3,
|
|
|
|
ID: 3,
|
|
|
|
IPAddresses: types.MachineAddresses{netip.MustParseAddr("100.64.0.3")},
|
|
|
|
IPAddresses: types.MachineAddresses{netip.MustParseAddr("100.64.0.3")},
|
|
|
|
User: types.User{Name: "mickael"},
|
|
|
|
User: types.User{Name: "mickael"},
|
|
|
@ -2387,21 +2389,21 @@ func Test_getFilteredByACLPeers(t *testing.T) {
|
|
|
|
name: "without rule all communications are forbidden",
|
|
|
|
name: "without rule all communications are forbidden",
|
|
|
|
args: args{
|
|
|
|
args: args{
|
|
|
|
machines: types.Machines{ // list of all machines in the database
|
|
|
|
machines: types.Machines{ // list of all machines in the database
|
|
|
|
{
|
|
|
|
types.Machine{
|
|
|
|
ID: 1,
|
|
|
|
ID: 1,
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
netip.MustParseAddr("100.64.0.1"),
|
|
|
|
netip.MustParseAddr("100.64.0.1"),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
User: types.User{Name: "joe"},
|
|
|
|
User: types.User{Name: "joe"},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
types.Machine{
|
|
|
|
ID: 2,
|
|
|
|
ID: 2,
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
netip.MustParseAddr("100.64.0.2"),
|
|
|
|
netip.MustParseAddr("100.64.0.2"),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
User: types.User{Name: "marc"},
|
|
|
|
User: types.User{Name: "marc"},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
types.Machine{
|
|
|
|
ID: 3,
|
|
|
|
ID: 3,
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
netip.MustParseAddr("100.64.0.3"),
|
|
|
|
netip.MustParseAddr("100.64.0.3"),
|
|
|
@ -2427,7 +2429,7 @@ func Test_getFilteredByACLPeers(t *testing.T) {
|
|
|
|
name: "issue-699-broken-star",
|
|
|
|
name: "issue-699-broken-star",
|
|
|
|
args: args{
|
|
|
|
args: args{
|
|
|
|
machines: types.Machines{ //
|
|
|
|
machines: types.Machines{ //
|
|
|
|
{
|
|
|
|
types.Machine{
|
|
|
|
ID: 1,
|
|
|
|
ID: 1,
|
|
|
|
Hostname: "ts-head-upcrmb",
|
|
|
|
Hostname: "ts-head-upcrmb",
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
@ -2436,7 +2438,7 @@ func Test_getFilteredByACLPeers(t *testing.T) {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
User: types.User{Name: "user1"},
|
|
|
|
User: types.User{Name: "user1"},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
types.Machine{
|
|
|
|
ID: 2,
|
|
|
|
ID: 2,
|
|
|
|
Hostname: "ts-unstable-rlwpvr",
|
|
|
|
Hostname: "ts-unstable-rlwpvr",
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
@ -2445,7 +2447,7 @@ func Test_getFilteredByACLPeers(t *testing.T) {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
User: types.User{Name: "user1"},
|
|
|
|
User: types.User{Name: "user1"},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
types.Machine{
|
|
|
|
ID: 3,
|
|
|
|
ID: 3,
|
|
|
|
Hostname: "ts-head-8w6paa",
|
|
|
|
Hostname: "ts-head-8w6paa",
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
@ -2454,7 +2456,7 @@ func Test_getFilteredByACLPeers(t *testing.T) {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
User: types.User{Name: "user2"},
|
|
|
|
User: types.User{Name: "user2"},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
types.Machine{
|
|
|
|
ID: 4,
|
|
|
|
ID: 4,
|
|
|
|
Hostname: "ts-unstable-lys2ib",
|
|
|
|
Hostname: "ts-unstable-lys2ib",
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
@ -2489,7 +2491,7 @@ func Test_getFilteredByACLPeers(t *testing.T) {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
want: types.Machines{
|
|
|
|
want: types.Machines{
|
|
|
|
{
|
|
|
|
types.Machine{
|
|
|
|
ID: 1,
|
|
|
|
ID: 1,
|
|
|
|
Hostname: "ts-head-upcrmb",
|
|
|
|
Hostname: "ts-head-upcrmb",
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
@ -2498,7 +2500,7 @@ func Test_getFilteredByACLPeers(t *testing.T) {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
User: types.User{Name: "user1"},
|
|
|
|
User: types.User{Name: "user1"},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
types.Machine{
|
|
|
|
ID: 2,
|
|
|
|
ID: 2,
|
|
|
|
Hostname: "ts-unstable-rlwpvr",
|
|
|
|
Hostname: "ts-unstable-rlwpvr",
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|
IPAddresses: types.MachineAddresses{
|
|
|
|