How-To: Add EZSSH Access to Endpoints With Cloud Init
Overview - How to Enable SSH Certificate Authentication With cloud-init
EZSSH uses SSH certificates to authenticate to your endpoints. Since SSH certificates are a native OpenSSH feature, no custom code has to run on your endpoints. Once an endpoint has your EZSSH policy’s CA in its TrustedUserCAKeys, it works with EZSSH.
This guide shows you how to do this with cloud-init, which runs the setup the first time a new VM boots. You might also be interested in:
Prerequisites for Adding EZSSH Access With cloud-init
Step-by-Step Guide - How to Add EZSSH Access to a New VM With cloud-init
Step 1: How to Download the cloud-init File From EZSSH
Every EZSSH policy has its own SSH Certificate Authority (CA). The setup script for a policy adds that CA, and the policy’s Linux principals, to your endpoint.
-
Go to the EZSSH portal.
-
From the left-hand menu, select Hybrid Policies or Azure Policies, depending on the type of policy you want to set up.
-
Expand the policy you want to set up. In this example, we expand “AWS EastUS Policy”.
-
Click Get Script at the top of the policy.
Only Need One Access Policy?The Get Script button at the top of the policy sets up the Linux principals of every access policy in it. To set up the Linux principals of a single access policy, click the Get Script button of that access policy instead.
Once the Setup Script dialog is open, download the cloud-init file:
-
Stay on the Cloud Init tab.
-
Under Select your Linux Distro, select the distribution your endpoints run (CentOS, Debian, RedHat, or Ubuntu).
-
Click Download.
-
Your browser saves the cloud-init file to your downloads folder as
<policy name>.yaml.
Step 2: How to Add the cloud-init File to Your New VM
Every major cloud accepts a cloud-init file when you create a VM. Select your cloud below:
How to Add the EZSSH cloud-init File to an Azure VM
-
Sign in to the Azure Portal.
-
Click Create a resource.
-
Select the resource type. In this example, we create an Ubuntu server.
-
Fill in the Basics, Disks, Networking, and Management tabs with your preferences, clicking Next after each one.
-
In the Advanced tab, paste the contents of the cloud-init file you downloaded from EZSSH into the Custom data field.
-
Click Review + create, and then click Create.
How to Add the EZSSH cloud-init File to an AWS EC2 Instance
-
Sign in to your AWS Console.
-
Select the region where you want to deploy.
-
Navigate to EC2 > Instances.
-
Click Launch instances.
-
Select your operating system and your instance type.
-
Expand Advanced details and scroll down to the bottom.
-
Paste the contents of the cloud-init file you downloaded from EZSSH into the User data field.
-
Continue with your regular EC2 instance deployment.
Done! Once the VM finishes booting, it trusts your EZSSH policy.
Next Steps - How to Connect to Your New Endpoint
If you are using a Hybrid Policy, remember to add the IP address or FQDN of the new VM to the Policy Endpoints of your policy. Azure Policies detect new VMs when you click Refresh Endpoints while editing the policy.
Now that your endpoint trusts your EZSSH policy, you can connect to it with the EZSSH client.
🚀 Set Up the EZSSH Client