Add saved Headscale DNS choice for MagicDNS manager addresses
This commit is contained in:
+14
-2
@@ -53,7 +53,7 @@ printf 'MANAGERS=%s\n' "${MANAGERS[*]}"
|
||||
self.assertIn('MANAGERS=133', r.stdout)
|
||||
self.assertNotIn('UNEXPECTED MUTATION', r.stderr)
|
||||
|
||||
def run_worker(self, want_ts, want_wz, ssh=0, installed=False, failure=False):
|
||||
def run_worker(self, want_ts, want_wz, ssh=0, installed=False, failure=False, dns=0):
|
||||
with tempfile.TemporaryDirectory() as td:
|
||||
p = Path(td)
|
||||
(p/'ossec/var/run').mkdir(parents=True)
|
||||
@@ -94,7 +94,7 @@ id() { if [[ $1 == -u ]]; then echo 1000; else return 0; fi; }
|
||||
mocks = 'MOCK_INSTALLED=%d; MOCK_FAILURE=%d\n' % (installed, failure) + mocks
|
||||
r = bash(mocks + worker, td, 'manager.example.com', '4.14.8-1',
|
||||
'https://headscale.example.com', 'fixture', str(want_ts), str(want_wz),
|
||||
str(ssh), 'fixtureuser', '0', '0')
|
||||
str(ssh), 'fixtureuser', '0', '0', str(dns))
|
||||
self.assertNotIn('fixture-secret-not-for-logging', r.stdout+r.stderr)
|
||||
self.assertFalse((p/'headscale.key').exists(), 'secret cleanup did not run')
|
||||
return r
|
||||
@@ -114,6 +114,18 @@ id() { if [[ $1 == -u ]]; then echo 1000; else return 0; fi; }
|
||||
self.assertNotIn('APT ', r.stdout)
|
||||
self.assertNotIn('TAILSCALE up', r.stdout)
|
||||
|
||||
def test_magicdns_enabled_before_manager_connection(self):
|
||||
r = self.run_worker(1, 1, dns=1)
|
||||
self.assertEqual(r.returncode, 0, r.stderr)
|
||||
self.assertIn('--accept-dns=true', r.stdout)
|
||||
self.assertLess(r.stdout.index('--accept-dns=true'), r.stdout.index('CHECK TCP 1514'))
|
||||
|
||||
def test_existing_client_accepts_dns_without_reauthentication(self):
|
||||
r = self.run_worker(0, 0, ssh=1, installed=True, dns=1)
|
||||
self.assertEqual(r.returncode, 0, r.stderr)
|
||||
self.assertIn('TAILSCALE set --accept-dns=true', r.stdout)
|
||||
self.assertNotIn('TAILSCALE up', r.stdout)
|
||||
|
||||
def test_tailscale_ssh_uses_no_openssh_server_or_public_key(self):
|
||||
r = self.run_worker(0, 0, ssh=1, installed=True)
|
||||
self.assertEqual(r.returncode, 0, r.stderr)
|
||||
|
||||
Reference in New Issue
Block a user