diff --git a/Makefile b/Makefile index a4b0f7da..62bd6b11 100644 --- a/Makefile +++ b/Makefile @@ -26,7 +26,7 @@ dev: lint test build test: @go test $(TAGS) -short -coverprofile=coverage.out ./... -test_integration: test_integration_cli test_integration_derp test_integration_v2_general +test_integration: test_integration_cli test_integration_v2_general test_integration_cli: docker network rm $$(docker network ls --filter name=headscale --quiet) || true diff --git a/hscontrol/integration_cli_test.go b/integration_cli_test.go similarity index 98% rename from hscontrol/integration_cli_test.go rename to integration_cli_test.go index feac0001..beadd2c0 100644 --- a/hscontrol/integration_cli_test.go +++ b/integration_cli_test.go @@ -1,5 +1,5 @@ // nolint -package hscontrol +package headscale import ( "encoding/json" @@ -64,7 +64,7 @@ func (s *IntegrationCLITestSuite) SetupTest() { headscaleOptions := &dockertest.RunOptions{ Name: "headscale-cli", Mounts: []string{ - fmt.Sprintf("%s/integration_test/etc:/etc/headscale", currentPath), + fmt.Sprintf("%s/integration_legacy/etc:/etc/headscale", currentPath), }, Cmd: []string{"headscale", "serve"}, Networks: []*dockertest.Network{&s.network}, @@ -1558,11 +1558,11 @@ func (s *IntegrationCLITestSuite) TestNodeMoveCommand() { func (s *IntegrationCLITestSuite) TestLoadConfigFromCommand() { // TODO: make sure defaultConfig is not same as altConfig - defaultConfig, err := os.ReadFile("integration_test/etc/config.dump.gold.yaml") + defaultConfig, err := os.ReadFile("integration_legacy/etc/config.dump.gold.yaml") assert.Nil(s.T(), err) - altConfig, err := os.ReadFile("integration_test/etc/alt-config.dump.gold.yaml") + altConfig, err := os.ReadFile("integration_legacy/etc/alt-config.dump.gold.yaml") assert.Nil(s.T(), err) - altEnvConfig, err := os.ReadFile("integration_test/etc/alt-env-config.dump.gold.yaml") + altEnvConfig, err := os.ReadFile("integration_legacy/etc/alt-env-config.dump.gold.yaml") assert.Nil(s.T(), err) _, _, err = ExecuteCommand( @@ -1575,7 +1575,7 @@ func (s *IntegrationCLITestSuite) TestLoadConfigFromCommand() { ) assert.Nil(s.T(), err) - defaultDumpConfig, err := os.ReadFile("integration_test/etc/config.dump.yaml") + defaultDumpConfig, err := os.ReadFile("integration_legacy/etc/config.dump.yaml") assert.Nil(s.T(), err) assert.YAMLEq(s.T(), string(defaultConfig), string(defaultDumpConfig)) @@ -1592,7 +1592,7 @@ func (s *IntegrationCLITestSuite) TestLoadConfigFromCommand() { ) assert.Nil(s.T(), err) - altDumpConfig, err := os.ReadFile("integration_test/etc/config.dump.yaml") + altDumpConfig, err := os.ReadFile("integration_legacy/etc/config.dump.yaml") assert.Nil(s.T(), err) assert.YAMLEq(s.T(), string(altConfig), string(altDumpConfig)) @@ -1609,7 +1609,7 @@ func (s *IntegrationCLITestSuite) TestLoadConfigFromCommand() { ) assert.Nil(s.T(), err) - altEnvDumpConfig, err := os.ReadFile("integration_test/etc/config.dump.yaml") + altEnvDumpConfig, err := os.ReadFile("integration_legacy/etc/config.dump.yaml") assert.Nil(s.T(), err) assert.YAMLEq(s.T(), string(altEnvConfig), string(altEnvDumpConfig)) @@ -1628,7 +1628,7 @@ func (s *IntegrationCLITestSuite) TestLoadConfigFromCommand() { ) assert.Nil(s.T(), err) - altDumpConfig, err = os.ReadFile("integration_test/etc/config.dump.yaml") + altDumpConfig, err = os.ReadFile("integration_legacy/etc/config.dump.yaml") assert.Nil(s.T(), err) assert.YAMLEq(s.T(), string(altConfig), string(altDumpConfig)) diff --git a/hscontrol/integration_common_test.go b/integration_common_test.go similarity index 99% rename from hscontrol/integration_common_test.go rename to integration_common_test.go index 86ba6488..edc0280a 100644 --- a/hscontrol/integration_common_test.go +++ b/integration_common_test.go @@ -1,5 +1,5 @@ // nolint -package hscontrol +package headscale import ( "bytes" diff --git a/integration_test/.gitignore b/integration_legacy/.gitignore similarity index 100% rename from integration_test/.gitignore rename to integration_legacy/.gitignore diff --git a/integration_test/etc/alt-config.dump.gold.yaml b/integration_legacy/etc/alt-config.dump.gold.yaml similarity index 100% rename from integration_test/etc/alt-config.dump.gold.yaml rename to integration_legacy/etc/alt-config.dump.gold.yaml diff --git a/integration_test/etc/alt-config.yaml b/integration_legacy/etc/alt-config.yaml similarity index 100% rename from integration_test/etc/alt-config.yaml rename to integration_legacy/etc/alt-config.yaml diff --git a/integration_test/etc/alt-env-config.dump.gold.yaml b/integration_legacy/etc/alt-env-config.dump.gold.yaml similarity index 100% rename from integration_test/etc/alt-env-config.dump.gold.yaml rename to integration_legacy/etc/alt-env-config.dump.gold.yaml diff --git a/integration_test/etc/alt-env-config.yaml b/integration_legacy/etc/alt-env-config.yaml similarity index 100% rename from integration_test/etc/alt-env-config.yaml rename to integration_legacy/etc/alt-env-config.yaml diff --git a/integration_test/etc/config.dump.gold.yaml b/integration_legacy/etc/config.dump.gold.yaml similarity index 100% rename from integration_test/etc/config.dump.gold.yaml rename to integration_legacy/etc/config.dump.gold.yaml diff --git a/integration_legacy/etc/config.dump.yaml b/integration_legacy/etc/config.dump.yaml new file mode 100644 index 00000000..e19ab23a --- /dev/null +++ b/integration_legacy/etc/config.dump.yaml @@ -0,0 +1,54 @@ +acl_policy_path: "" +cli: + insecure: false + timeout: 5s +db_path: /tmp/integration_test_db.sqlite3 +db_type: sqlite3 +derp: + auto_update_enabled: false + server: + enabled: false + stun: + enabled: true + update_frequency: 1m + urls: + - https://controlplane.tailscale.com/derpmap/default +dns_config: + base_domain: headscale.net + domains: [] + magic_dns: true + nameservers: + - 127.0.0.11 + - 1.1.1.1 + override_local_dns: true +ephemeral_node_inactivity_timeout: 30m +grpc_allow_insecure: false +grpc_listen_addr: :50443 +ip_prefixes: + - fd7a:115c:a1e0::/48 + - 100.64.0.0/10 +listen_addr: 0.0.0.0:18080 +log: + format: text + level: disabled +logtail: + enabled: false +metrics_listen_addr: 127.0.0.1:19090 +node_update_check_interval: 10s +noise: + private_key_path: noise_private.key +oidc: + only_start_if_oidc_is_available: true + scope: + - openid + - profile + - email + strip_email_domain: true +private_key_path: private.key +randomize_client_port: false +server_url: http://headscale:18080 +tls_client_auth_mode: relaxed +tls_letsencrypt_cache_dir: /var/www/.cache +tls_letsencrypt_challenge_type: HTTP-01 +unix_socket: /var/run/headscale.sock +unix_socket_permission: "0o770" diff --git a/integration_test/etc/config.yaml b/integration_test/etc/config.yaml deleted file mode 100644 index efe75fec..00000000 --- a/integration_test/etc/config.yaml +++ /dev/null @@ -1,30 +0,0 @@ -log: - level: trace -acl_policy_path: "" -db_type: sqlite3 -ephemeral_node_inactivity_timeout: 30m -node_update_check_interval: 10s -ip_prefixes: - - fd7a:115c:a1e0::/48 - - 100.64.0.0/10 -dns_config: - override_local_dns: true - base_domain: headscale.net - magic_dns: true - domains: [] - nameservers: - - 127.0.0.11 - - 1.1.1.1 -db_path: /tmp/integration_test_db.sqlite3 -private_key_path: private.key -noise: - private_key_path: noise_private.key -listen_addr: 0.0.0.0:8080 -metrics_listen_addr: 127.0.0.1:9090 -server_url: http://headscale:8080 - -derp: - urls: - - https://controlplane.tailscale.com/derpmap/default - auto_update_enabled: false - update_frequency: 1m diff --git a/integration_test/etc_embedded_derp/config.yaml b/integration_test/etc_embedded_derp/config.yaml deleted file mode 100644 index ed4d51a0..00000000 --- a/integration_test/etc_embedded_derp/config.yaml +++ /dev/null @@ -1,31 +0,0 @@ -log_level: trace -acl_policy_path: "" -db_type: sqlite3 -ephemeral_node_inactivity_timeout: 30m -node_update_check_interval: 10s -ip_prefixes: - - fd7a:115c:a1e0::/48 - - 100.64.0.0/10 -dns_config: - base_domain: headscale.net - magic_dns: true - domains: [] - nameservers: - - 1.1.1.1 -db_path: /tmp/integration_test_db.sqlite3 -private_key_path: private.key -noise: - private_key_path: noise_private.key -listen_addr: 0.0.0.0:443 -server_url: https://headscale:443 -tls_cert_path: "/etc/headscale/tls/server.crt" -tls_key_path: "/etc/headscale/tls/server.key" -tls_client_auth_mode: disabled -derp: - server: - enabled: true - region_id: 999 - region_code: "headscale" - region_name: "Headscale Embedded DERP" - - stun_listen_addr: "0.0.0.0:3478" diff --git a/integration_test/etc_embedded_derp/tls/server.crt b/integration_test/etc_embedded_derp/tls/server.crt deleted file mode 100644 index 95556495..00000000 --- a/integration_test/etc_embedded_derp/tls/server.crt +++ /dev/null @@ -1,22 +0,0 @@ - ------BEGIN CERTIFICATE----- -MIIC8jCCAdqgAwIBAgIULbu+UbSTMG/LtxooLLh7BgSEyqEwDQYJKoZIhvcNAQEL -BQAwFDESMBAGA1UEAwwJaGVhZHNjYWxlMCAXDTIyMDMwNTE2NDgwM1oYDzI1MjEx -MTA0MTY0ODAzWjAUMRIwEAYDVQQDDAloZWFkc2NhbGUwggEiMA0GCSqGSIb3DQEB -AQUAA4IBDwAwggEKAoIBAQDqcfpToLZUF0rlNwXkkt3lbyw4Cl4TJdx36o2PKaOK -U+tze/IjRsCWeMwrcR1o9TNZcxsD+c2J48D1WATuQJlMeg+2UJXGaTGRKkkbPMy3 -5m7AFf/Q16UEOgm2NYjZaQ8faRGIMYURG/6sXmNeETJvBixpBev9yKJuVXgqHNS4 -NpEkNwdOCuAZXrmw0HCbiusawJOay4tFvhH14rav8Uimonl8UTNVXufMzyUOuoaQ -TGflmzYX3hIoswRnTPlIWFoqObvx2Q8H+of3uQJXy0m8I6OrIoXLNxnqYMfFls79 -9SYgVc2jPsCbh5fwyRbx2Hof7sIZ1K/mNgxJRG1E3ZiLAgMBAAGjOjA4MBQGA1Ud -EQQNMAuCCWhlYWRzY2FsZTALBgNVHQ8EBAMCB4AwEwYDVR0lBAwwCgYIKwYBBQUH -AwEwDQYJKoZIhvcNAQELBQADggEBANGlVN7NCsJaKz0k0nhlRGK+tcxn2p1PXN/i -Iy+JX8ahixPC4ocRwOhrXgb390ZXLLwq08HrWYRB/Wi1VUzCp5d8dVxvrR43dJ+v -L2EOBiIKgcu2C3pWW1qRR46/EoXUU9kSH2VNBvIhNufi32kEOidoDzxtQf6qVCoF -guUt1JkAqrynv1UvR/2ZRM/WzM/oJ8qfECwrwDxyYhkqU5Z5jCWg0C6kPIBvNdzt -B0eheWS+ZxVwkePTR4e17kIafwknth3lo+orxVrq/xC+OVM1bGrt2ZyD64ZvEqQl -w6kgbzBdLScAQptWOFThwhnJsg0UbYKimZsnYmjVEuN59TJv92M= ------END CERTIFICATE----- - -(Expires on Nov 4 16:48:03 2521 GMT) - diff --git a/integration_test/etc_embedded_derp/tls/server.key b/integration_test/etc_embedded_derp/tls/server.key deleted file mode 100644 index 8a2df34b..00000000 --- a/integration_test/etc_embedded_derp/tls/server.key +++ /dev/null @@ -1,28 +0,0 @@ ------BEGIN PRIVATE KEY----- -MIIEwAIBADANBgkqhkiG9w0BAQEFAASCBKowggSmAgEAAoIBAQDqcfpToLZUF0rl -NwXkkt3lbyw4Cl4TJdx36o2PKaOKU+tze/IjRsCWeMwrcR1o9TNZcxsD+c2J48D1 -WATuQJlMeg+2UJXGaTGRKkkbPMy35m7AFf/Q16UEOgm2NYjZaQ8faRGIMYURG/6s -XmNeETJvBixpBev9yKJuVXgqHNS4NpEkNwdOCuAZXrmw0HCbiusawJOay4tFvhH1 -4rav8Uimonl8UTNVXufMzyUOuoaQTGflmzYX3hIoswRnTPlIWFoqObvx2Q8H+of3 -uQJXy0m8I6OrIoXLNxnqYMfFls799SYgVc2jPsCbh5fwyRbx2Hof7sIZ1K/mNgxJ -RG1E3ZiLAgMBAAECggEBALu1Ni/u5Qy++YA8ZcN0s6UXNdhItLmv/q0kZuLQ+9et -CT8VZfFInLndTdsaXenDKLHdryunviFA8SV+q7P2lMbek+Xs735EiyMnMBFWxLIZ -FWNGOeQERGL19QCmLEOmEi2b+iWJQHlKaMWpbPXL3w11a+lKjIBNO4ALfoJ5QveZ -cGMKsJdm/mpqBvLeNeh2eAFk3Gp6sT1g80Ge8NkgyzFBNIqnut0eerM15kPTc6Qz -12JLaOXUuV3PrcB4PN4nOwrTDg88GDNOQtc1Pc9r4nOHyLfr8X7QEtj1wXSwmOuK -d6ynMnAmoxVA9wEnupLbil1bzohRzpsTpkmDruYaBEECgYEA/Z09I8D6mt2NVqIE -KyvLjBK39ijSV9r3/lvB2Ple2OOL5YQEd+yTrIFy+3zdUnDgD1zmNnXjmjvHZ9Lc -IFf2o06AF84QLNB5gLPdDQkGNFdDqUxljBrfAfE3oANmPS/B0SijMGOOOiDO2FtO -xl1nfRr78mswuRs9awoUWCdNRKUCgYEA7KaTYKIQW/FEjw9lshp74q5vbn6zoXF5 -7N8VkwI+bBVNvRbM9XZ8qhfgRdu9eXs5oL/N4mSYY54I8fA//pJ0Z2vpmureMm1V -mL5WBUmSD9DIbAchoK+sRiQhVmNMBQC6cHMABA7RfXvBeGvWrm9pKCS6ZLgLjkjp -PsmAcaXQcW8CgYEA2inAxljjOwUK6FNGsrxhxIT1qtNC3kCGxE+6WSNq67gSR8Vg -8qiX//T7LEslOB3RIGYRwxd2St7RkgZZRZllmOWWWuPwFhzf6E7RAL2akLvggGov -kG4tGEagSw2hjVDfsUT73ExHtMk0Jfmlsg33UC8+PDLpHtLH6qQpDAwC8+ECgYEA -o+AqOIWhvHmT11l7O915Ip1WzvZwYADbxLsrDnVEUsZh4epTHjvh0kvcY6PqTqCV -ZIrOANNWb811Nkz/k8NJVoD08PFp0xPBbZeIq/qpachTsfMyRzq/mobUiyUR9Hjv -ooUQYr78NOApNsG+lWbTNBhS9wI4BlzZIECbcJe5g4MCgYEAndRoy8S+S0Hx/S8a -O3hzXeDmivmgWqn8NVD4AKOovpkz4PaIVVQbAQkiNfAx8/DavPvjEKAbDezJ4ECV -j7IsOWtDVI7pd6eF9fTcECwisrda8aUoiOap8AQb48153Vx+g2N4Vy3uH0xJs4cz -TDALZPOBg8VlV+HEFDP43sp9Bf0= ------END PRIVATE KEY----- diff --git a/integration_test/etc_oidc/base_config.yaml b/integration_test/etc_oidc/base_config.yaml deleted file mode 100644 index cbfac529..00000000 --- a/integration_test/etc_oidc/base_config.yaml +++ /dev/null @@ -1,21 +0,0 @@ -log_level: trace -acl_policy_path: "" -db_type: sqlite3 -ephemeral_node_inactivity_timeout: 30m -node_update_check_interval: 10s -ip_prefixes: - - fd7a:115c:a1e0::/48 - - 100.64.0.0/10 -db_path: /tmp/integration_test_db.sqlite3 -private_key_path: private.key -noise: - private_key_path: noise_private.key -listen_addr: 0.0.0.0:8443 -server_url: https://headscale-oidc:8443 -tls_cert_path: "/etc/headscale/tls/server.crt" -tls_key_path: "/etc/headscale/tls/server.key" -derp: - urls: - - https://controlplane.tailscale.com/derpmap/default - auto_update_enabled: true - update_frequency: 1m diff --git a/integration_test/etc_oidc/tls/server.crt b/integration_test/etc_oidc/tls/server.crt deleted file mode 100644 index 95556495..00000000 --- a/integration_test/etc_oidc/tls/server.crt +++ /dev/null @@ -1,22 +0,0 @@ - ------BEGIN CERTIFICATE----- -MIIC8jCCAdqgAwIBAgIULbu+UbSTMG/LtxooLLh7BgSEyqEwDQYJKoZIhvcNAQEL -BQAwFDESMBAGA1UEAwwJaGVhZHNjYWxlMCAXDTIyMDMwNTE2NDgwM1oYDzI1MjEx -MTA0MTY0ODAzWjAUMRIwEAYDVQQDDAloZWFkc2NhbGUwggEiMA0GCSqGSIb3DQEB -AQUAA4IBDwAwggEKAoIBAQDqcfpToLZUF0rlNwXkkt3lbyw4Cl4TJdx36o2PKaOK -U+tze/IjRsCWeMwrcR1o9TNZcxsD+c2J48D1WATuQJlMeg+2UJXGaTGRKkkbPMy3 -5m7AFf/Q16UEOgm2NYjZaQ8faRGIMYURG/6sXmNeETJvBixpBev9yKJuVXgqHNS4 -NpEkNwdOCuAZXrmw0HCbiusawJOay4tFvhH14rav8Uimonl8UTNVXufMzyUOuoaQ -TGflmzYX3hIoswRnTPlIWFoqObvx2Q8H+of3uQJXy0m8I6OrIoXLNxnqYMfFls79 -9SYgVc2jPsCbh5fwyRbx2Hof7sIZ1K/mNgxJRG1E3ZiLAgMBAAGjOjA4MBQGA1Ud -EQQNMAuCCWhlYWRzY2FsZTALBgNVHQ8EBAMCB4AwEwYDVR0lBAwwCgYIKwYBBQUH -AwEwDQYJKoZIhvcNAQELBQADggEBANGlVN7NCsJaKz0k0nhlRGK+tcxn2p1PXN/i -Iy+JX8ahixPC4ocRwOhrXgb390ZXLLwq08HrWYRB/Wi1VUzCp5d8dVxvrR43dJ+v -L2EOBiIKgcu2C3pWW1qRR46/EoXUU9kSH2VNBvIhNufi32kEOidoDzxtQf6qVCoF -guUt1JkAqrynv1UvR/2ZRM/WzM/oJ8qfECwrwDxyYhkqU5Z5jCWg0C6kPIBvNdzt -B0eheWS+ZxVwkePTR4e17kIafwknth3lo+orxVrq/xC+OVM1bGrt2ZyD64ZvEqQl -w6kgbzBdLScAQptWOFThwhnJsg0UbYKimZsnYmjVEuN59TJv92M= ------END CERTIFICATE----- - -(Expires on Nov 4 16:48:03 2521 GMT) - diff --git a/integration_test/etc_oidc/tls/server.key b/integration_test/etc_oidc/tls/server.key deleted file mode 100644 index 8a2df34b..00000000 --- a/integration_test/etc_oidc/tls/server.key +++ /dev/null @@ -1,28 +0,0 @@ ------BEGIN PRIVATE KEY----- -MIIEwAIBADANBgkqhkiG9w0BAQEFAASCBKowggSmAgEAAoIBAQDqcfpToLZUF0rl -NwXkkt3lbyw4Cl4TJdx36o2PKaOKU+tze/IjRsCWeMwrcR1o9TNZcxsD+c2J48D1 -WATuQJlMeg+2UJXGaTGRKkkbPMy35m7AFf/Q16UEOgm2NYjZaQ8faRGIMYURG/6s -XmNeETJvBixpBev9yKJuVXgqHNS4NpEkNwdOCuAZXrmw0HCbiusawJOay4tFvhH1 -4rav8Uimonl8UTNVXufMzyUOuoaQTGflmzYX3hIoswRnTPlIWFoqObvx2Q8H+of3 -uQJXy0m8I6OrIoXLNxnqYMfFls799SYgVc2jPsCbh5fwyRbx2Hof7sIZ1K/mNgxJ -RG1E3ZiLAgMBAAECggEBALu1Ni/u5Qy++YA8ZcN0s6UXNdhItLmv/q0kZuLQ+9et -CT8VZfFInLndTdsaXenDKLHdryunviFA8SV+q7P2lMbek+Xs735EiyMnMBFWxLIZ -FWNGOeQERGL19QCmLEOmEi2b+iWJQHlKaMWpbPXL3w11a+lKjIBNO4ALfoJ5QveZ -cGMKsJdm/mpqBvLeNeh2eAFk3Gp6sT1g80Ge8NkgyzFBNIqnut0eerM15kPTc6Qz -12JLaOXUuV3PrcB4PN4nOwrTDg88GDNOQtc1Pc9r4nOHyLfr8X7QEtj1wXSwmOuK -d6ynMnAmoxVA9wEnupLbil1bzohRzpsTpkmDruYaBEECgYEA/Z09I8D6mt2NVqIE -KyvLjBK39ijSV9r3/lvB2Ple2OOL5YQEd+yTrIFy+3zdUnDgD1zmNnXjmjvHZ9Lc -IFf2o06AF84QLNB5gLPdDQkGNFdDqUxljBrfAfE3oANmPS/B0SijMGOOOiDO2FtO -xl1nfRr78mswuRs9awoUWCdNRKUCgYEA7KaTYKIQW/FEjw9lshp74q5vbn6zoXF5 -7N8VkwI+bBVNvRbM9XZ8qhfgRdu9eXs5oL/N4mSYY54I8fA//pJ0Z2vpmureMm1V -mL5WBUmSD9DIbAchoK+sRiQhVmNMBQC6cHMABA7RfXvBeGvWrm9pKCS6ZLgLjkjp -PsmAcaXQcW8CgYEA2inAxljjOwUK6FNGsrxhxIT1qtNC3kCGxE+6WSNq67gSR8Vg -8qiX//T7LEslOB3RIGYRwxd2St7RkgZZRZllmOWWWuPwFhzf6E7RAL2akLvggGov -kG4tGEagSw2hjVDfsUT73ExHtMk0Jfmlsg33UC8+PDLpHtLH6qQpDAwC8+ECgYEA -o+AqOIWhvHmT11l7O915Ip1WzvZwYADbxLsrDnVEUsZh4epTHjvh0kvcY6PqTqCV -ZIrOANNWb811Nkz/k8NJVoD08PFp0xPBbZeIq/qpachTsfMyRzq/mobUiyUR9Hjv -ooUQYr78NOApNsG+lWbTNBhS9wI4BlzZIECbcJe5g4MCgYEAndRoy8S+S0Hx/S8a -O3hzXeDmivmgWqn8NVD4AKOovpkz4PaIVVQbAQkiNfAx8/DavPvjEKAbDezJ4ECV -j7IsOWtDVI7pd6eF9fTcECwisrda8aUoiOap8AQb48153Vx+g2N4Vy3uH0xJs4cz -TDALZPOBg8VlV+HEFDP43sp9Bf0= ------END PRIVATE KEY-----