mirror of
https://github.com/juanfont/headscale.git
synced 2026-04-25 10:08:41 +02:00
hscontrol: validate machine key and bind src/dst in SSH check handler
SSHActionHandler now verifies that the Noise session's machine key matches the dst node before proceeding. The (src, dst) pair is captured at hold-and-delegate time via a new SSHCheckBinding on AuthRequest so sshActionFollowUp can verify the follow-up URL matches. The OIDC non-registration callback requires the authenticated user to own the src node before approving.
This commit is contained in:
@@ -1214,6 +1214,15 @@ func (s *State) CreateNodeForTest(user *types.User, hostname ...string) *types.N
|
||||
return s.db.CreateNodeForTest(user, hostname...)
|
||||
}
|
||||
|
||||
// PutNodeInStoreForTest writes a test node into the in-memory NodeStore
|
||||
// so handlers backed by NodeStore lookups (e.g. GetNodeByID) can see it.
|
||||
// CreateNodeForTest only saves to the database, which is fine for tests
|
||||
// that exercise the DB layer directly but insufficient for handler tests
|
||||
// that go through State.
|
||||
func (s *State) PutNodeInStoreForTest(node types.Node) types.NodeView {
|
||||
return s.nodeStore.PutNode(node)
|
||||
}
|
||||
|
||||
// CreateRegisteredNodeForTest creates a test node with allocated IPs. This is a convenience wrapper around the database layer.
|
||||
func (s *State) CreateRegisteredNodeForTest(user *types.User, hostname ...string) *types.Node {
|
||||
return s.db.CreateRegisteredNodeForTest(user, hostname...)
|
||||
|
||||
Reference in New Issue
Block a user