Often in IT, something that works is something that sticks around, even if it’s not as secure or it doesn’t work as well as another solution. That’s how teams end up with shared database passwords with overly broad permissions, or workflows that rely on individuals to manually create and update credentials and permissions. These aren’t ideal solutions, but the work gets done, and it’s hard to justify fixing something that doesn’t seem broken.
These are two of the problems that Tailscale PAM is designed to solve. Credentials are no longer shared among multiple users or unique to a particular app or database—they’re the same ones you already use for accessing email, Tailscale VPN, and other services. A Tailscale PAM connector sitting on the same network as the database stores any service-specific credentials and forwards them for access.
And because access is tied to those identities, IT admins and auditors can see who exactly was accessing what resources, from what machine, at what time, and from where.
In this PAM webinar, we demonstrate how to configure a Tailscale PAM connector and use it to connect to an Amazon RDS database. Amazon Web Services (AWS) perfectly demonstrates the importance of the principle of least privilege—that database can be sitting in an Amazon VPC cluster right next to an S3 bucket of sensitive customer data, and the people who have access to one of those things shouldn’t always have access to the other.
Set up Tailscale PAM with AWS
This GitHub repo hosts several Tailscale PAM “recipes,” collections of steps you can follow and files you can use to demo Tailscale PAM’s capabilities, or as a springboard to get a new environment up and running. This specific recipe covers Amazon S3 and RDS. While they’re specific to Amazon’s services, most of the concepts map pretty cleanly to Google Cloud Platform (GCP) and Microsoft Azure, as well as self-managed Postgres databases.
To use this recipe, you first enable PAM integration, and then launch an Amazon EC2 instance in a subnet that can reach the RDS instance you’re trying to add to Tailscale PAM.
This EC2 instance will be your Tailscale PAM connector. This connector can also be deployed to a Kubernetes cluster or a container—the most important thing is that it be able to directly access the RDS instance by using its own local network. If you need remote access, Tailscale VPN can get your users remote access to the PAM connector, but the connector itself needs to be able to communicate locally.
To set up the connector, you’ll install the tailzero client on the EC2 instance. The cloud-init user-data.yml file will automate this for you, and includes the one-line command for installing the client:
- [ bash, -c, "sh <(curl -fsSL https://tailscale.border0.com/tailzero/install.sh) --invite TOKEN_HERE" ]
You only need one Tailscale PAM connector to access your service, and one connector can handle many services as long as they’re running on the same network subnet. For redundancy and high availability, multiple Tailscale PAM connectors can also serve the same services—if one connector goes down, the other connectors ensure that the services stay available.
When the connector(s) have been deployed, you’ll first want to configure a database service in the Tailscale admin console, which is used to manage both Tailscale VPN and Tailscale PAM settings.
How you proceed from here will depend on how you handle credentials for your database. In our demo, we show how Tailscale PAM works with existing access tools like AWS Identity and Access Management (IAM), where you give the PAM connector database access by using the hosts role. For databases with static credentials, you can store those in the Tailscale PAM connector. Regardless, the end result for users is the same: they log in to Tailscale with their existing identity provider, and the Tailscale PAM connector applies your policies to determine what those users can and can’t access.
Next, the recipe will walk you through creating an Amazon S3 service on the Tailscale PAM connector. And the policy.hujson config file applies a sample set of grants that will govern who can access what.
Once you’ve configured those grants, the Tailscale PAM connector applies those policies in real time as users access the services you’ve configured. Users who should be able to access the S3 service but not the database can do so; others who need to be able to read the database but not write to it can be given those permissions, too. And Tailscale PAM can consider other things beyond user identity, too, including the machine a person is using (when you want people to use their managed work-issued devices, rather than personal ones) and the network they’re connecting from.
Other possibilities
Our webinar and the AWS recipe only scratch the surface of what’s possible with Tailscale PAM. If you’re eager to explore more, we also provide recipes for accessing web apps via PAM over HTTP, and for granting fine-grained SSH access.
The latter is a particularly good way to test our Tailscale PAM’s session recording feature, which adds “exactly what happened during a session” to the list of questions Tailscale PAM can answer when you’re trying to troubleshoot a problem or retrace somebody’s steps.
For more on Tailscale PAM, start with our documentation, or this blog post about how Tailscale PAM extends and complements the capabilities of Tailscale VPN. Existing Tailscale users can join the PAM beta waitlist, and our sales team is available to handle any and all questions you have.
Andrew Cunningham