mirror of
https://github.com/juanfont/headscale.git
synced 2026-04-23 09:08:44 +02:00
integration: add SSH check mode tests
Add ReadLog method to headscale integration container for log inspection. Split SSH check mode tests into CLI and OIDC variants and add comprehensive test coverage: - TestSSHOneUserToOneCheckModeCLI: basic check mode with CLI approval - TestSSHOneUserToOneCheckModeOIDC: check mode with OIDC approval - TestSSHCheckModeUnapprovedTimeout: rejection on cache expiry - TestSSHCheckModeCheckPeriodCLI: session expiry and re-auth - TestSSHCheckModeAutoApprove: auto-approval within check period - TestSSHCheckModeNegativeCLI: explicit rejection via CLI Update existing integration tests to use headscale auth register. Updates #1850
This commit is contained in:
@@ -2948,7 +2948,7 @@ func TestPreAuthKeyLogoutAndReloginDifferentUser(t *testing.T) {
|
||||
// Scenario:
|
||||
// 1. Node registers with user1 via pre-auth key
|
||||
// 2. Node logs out (expires)
|
||||
// 3. Admin runs: headscale nodes register --user user2 --key <key>
|
||||
// 3. Admin runs: headscale auth register --auth-id <id> --user user2
|
||||
//
|
||||
// Expected behavior:
|
||||
// - User1's original node should STILL EXIST (expired)
|
||||
@@ -3027,7 +3027,7 @@ func TestWebFlowReauthDifferentUser(t *testing.T) {
|
||||
require.NotEmpty(t, regID, "Should have valid registration ID")
|
||||
|
||||
// Step 4: Admin completes authentication via CLI
|
||||
// This simulates: headscale nodes register --user user2 --key <key>
|
||||
// This simulates: headscale auth register --auth-id <id> --user user2
|
||||
node, _, err := app.state.HandleNodeFromAuthPath(
|
||||
regID,
|
||||
types.UserID(user2.ID), // Register to user2, not user1!
|
||||
@@ -3942,7 +3942,7 @@ func TestTaggedNodeWithoutUserToDifferentUser(t *testing.T) {
|
||||
require.NotNil(t, alice, "Alice user should be created")
|
||||
|
||||
// Step 4: Re-register the node to alice via HandleNodeFromAuthPath
|
||||
// This is what happens when running: headscale nodes register --user alice --key ...
|
||||
// This is what happens when running: headscale auth register --auth-id <id> --user alice
|
||||
nodeKey2 := key.NewNode()
|
||||
registrationID := types.MustAuthID()
|
||||
regEntry := types.NewRegisterAuthRequest(types.Node{
|
||||
|
||||
Reference in New Issue
Block a user