Deep Dive Into Modeling Tailscale Grants Relationships In Cartography Access Control

by Henrik Larsen 85 views

Hey guys! Today, we're diving deep into modeling Tailscale Grants relationships to enhance access control within your organization. This is super important for security teams, so let's get started!

Summary

Currently, the Tailscale module in Cartography fetches data from the API, but it doesn't parse or model Grants. This is a problem because it prevents us from answering crucial access questions like, "Who can access what" within Tailscale-managed resources. Think of it like having a map (Cartography) that shows the roads (Tailscale network), but not who's allowed to drive on them (Grants). We need to fix that!

This feature aims to parse and model Tailscale Grants, so we can surface those effective access relationships. It's like adding the driver's licenses and car registrations to our map, making it much more useful for security analysis. We'll be doing something similar to what's already implemented for AWS IAM, which is a proven and effective approach.

Motivation

Understanding Access Is Key

Understanding identity-to-resource access relationships is a key capability for security teams using Cartography. Imagine trying to secure a building without knowing who has keys to which rooms – it's a nightmare! By modeling Tailscale Grants, users will be able to:

  • Query effective access paths across overlay networks: This means you can easily see how users and services are connected within your Tailscale network. Think of it as tracing the path someone takes through your digital infrastructure.
  • Detect overly permissive or misconfigured Grants: Spotting these misconfigurations is crucial to prevent security breaches. It's like finding doors that are left unlocked or keys that are given to the wrong people.
  • Build least-privilege analysis, compliance checks, or dynamic policy audits: This allows you to ensure that users only have the access they absolutely need, meeting compliance requirements and reducing your attack surface. It's like making sure everyone has the right key for their specific job, and nothing more.

Why This Matters

Think of it this way: without this feature, you're flying blind. You might have a general idea of your network structure, but you don't know the specifics of who can access what. This can lead to serious security vulnerabilities and compliance issues. With this feature, you gain clear visibility and control over your Tailscale network access.

For example, imagine a scenario where a contractor accidentally gets access to sensitive production servers. Without proper Grant modeling, this might go unnoticed until it's too late. With this feature, you can quickly identify and rectify such misconfigurations, preventing potential disasters.

The Big Picture

This feature isn't just about adding a new data point to Cartography; it's about enabling a whole new level of security analysis and governance. It's about empowering security teams to proactively identify and mitigate risks, ensuring the safety and integrity of their organizations' data and systems. By providing a clear and comprehensive view of access relationships, this feature helps you sleep better at night, knowing your network is secure and well-managed.

Proposed Solution

Parsing and Modeling Grants

Okay, so how are we going to make this happen? First off, let's note that Tailscale ACLs are now deprecated in favor of Tailscale Grants. So, our focus is entirely on Grants.

The plan is to parse Tailscale Grants and resolve them into effective identity-to-resource relationships. This means taking the raw Grant data and turning it into something we can actually use to understand access. We'll then model these relationships using MatchLinks to connect TailscaleUser nodes to the corresponding TailscaleNode or TailscaleService. Think of it like creating a clear map of who has access to what, with labeled connections showing the specific permissions.

Consistent Approach

We'll use directionality and tenant scoping consistent with AWS, ensuring a unified and familiar experience for Cartography users. This means if you're already familiar with how Cartography models AWS IAM, you'll feel right at home with Tailscale Grants.

We'll also follow Cartography’s standard sync pattern (get → transform → load → cleanup), and document the schema. This ensures that the process is reliable, repeatable, and well-understood. It's like following a recipe – you know what to expect at each step, and the end result is consistent.

  • Get: We'll fetch the raw Grant data from the Tailscale API.
  • Transform: We'll parse and process the data, turning it into a structured format.
  • Load: We'll load the transformed data into Cartography's graph database.
  • Cleanup: We'll remove any stale data, ensuring the graph remains accurate and up-to-date.

Technical Details

Let's break down the technical side a bit more. We'll be using MatchLinks to create relationships between TailscaleUser nodes and either TailscaleNode or TailscaleService nodes. This allows us to represent the specific access permissions granted by each Grant. For example, a Grant might allow a specific user to access a particular service on a specific node. We'll model this as a link between the user node and the service node, with attributes describing the specific permissions.

We'll also need to handle the different types of Grants that Tailscale supports. This might include Grants based on user groups, node tags, or service names. Our parsing and modeling logic will need to be flexible enough to handle these different scenarios.

The End Result

Ultimately, this solution will provide a clear and comprehensive view of access relationships within your Tailscale network. You'll be able to easily answer questions like:

  • Which users have access to a specific node?
  • Which services can a particular user access?
  • What are the specific permissions granted by a particular Grant?

This level of visibility is essential for effective security management and compliance.

Additional Context

Existing Infrastructure

The good news is that the Tailscale module and endpoint integration already exist in Cartography. This gives us a solid foundation to build upon. We just need to add the Grant parsing logic.

Related Patterns

We can also leverage existing modeling patterns from the cartography/intel/aws/iam/ module. This module already handles IAM policy parsing and relationship modeling, so we can draw inspiration and reuse code where appropriate. It's like having a blueprint for a similar building – we can adapt the existing design to fit our new needs.

Background Reading

For those interested in the broader context of IAM modeling, the blog post [