tstest/natlab: add FreeBSD test case for SSH test
Add logic to generateFreeBSDUserData to allow for an SSH connection as root for FreeBSD. Add FreeBSD test cases to ssh_test that exercise the same paths as the existing Ubuntu tests but for BSD. Updates https://github.com/tailscale/corp/issues/44813 Updates https://github.com/tailscale/tailscale/issues/13038 Signed-off-by: Mario Minardi <mario@tailscale.com>
This commit is contained in:
committed by
Mario Minardi
parent
7e609b2581
commit
8bc4c09a46
@@ -157,6 +157,15 @@ func (e *Env) generateFreeBSDUserData(n *Node) string {
|
||||
|
||||
ud.WriteString("runcmd:\n")
|
||||
|
||||
// Enable root SSH login for debugging via the debug NIC.
|
||||
ud.WriteString(" - \"echo 'PermitRootLogin yes' >>/etc/ssh/sshd_config\"\n")
|
||||
ud.WriteString(" - \"echo 'PubkeyAuthentication yes' >>/etc/ssh/sshd_config\"\n")
|
||||
// Also inject the host's SSH key if available.
|
||||
if pubkey, err := os.ReadFile("/tmp/vmtest_key.pub"); err == nil {
|
||||
ud.WriteString(" - \"mkdir -p /root/.ssh && chmod 700 /root/.ssh\"\n")
|
||||
fmt.Fprintf(&ud, " - \"echo '%s' >/root/.ssh/authorized_keys && chmod 600 /root/.ssh/authorized_keys\"\n", strings.TrimSpace(string(pubkey)))
|
||||
}
|
||||
|
||||
// /usr/local/bin may not exist on a fresh FreeBSD cloud image (it's
|
||||
// created when the first package is installed).
|
||||
ud.WriteString(" - \"mkdir -p /usr/local/bin\"\n")
|
||||
|
||||
Reference in New Issue
Block a user