How-To: Export EZSSH Logs to CloudWatch

Learn how to export EZSSH audit logs to Amazon CloudWatch, then create metric filters to detect SSH key reuse and monitor every SSH and GitHub certificate request.

Prerequisites for Exporting EZSSH Logs to CloudWatch

  1. You have registered the Keytos application in your Entra ID tenant.
  2. You have selected an EZSSH plan.

How To Export Your EZSSH Audit Logs To CloudWatch

To export your EZSSH logs to CloudWatch, you enable audit log export in your EZSSH subscription, get your CloudWatch connection details, and then add them to EZSSH. The following steps walk you through each part.

How To Enable Log Export in EZSSH Portal

  1. Go to the EZSSH portal.

  2. From the left-hand menu, click Settings.

    EZSSH Agentless JIT Access portal dashboard with Settings item highlighted in the left navigation sidebar
  3. Expand your subscription’s Advanced Settings.

    EZSSH Agentless JIT Access subscription settings page showing Advanced Settings section with expand arrow highlighted
  4. Under SIEM Settings, select Send Audit Logs to SIEM.

    EZSSH Agentless JIT Access Advanced Settings panel with Send Audit Logs to SIEM checkbox highlighted

How To Configure the CloudWatch Exporter in the CloudWatch Portal

  1. Open your CloudWatch Portal in a new browser tab.

  2. In the top right corner, locate your AWS Region and make a note of it.

    CloudWatch region selection screenshot
  3. From the left-hand menu, under Setup, click on Settings.

    CloudWatch settings navigation screenshot
  4. Go to the Logs tab. In the API Keys section, click Create.

    CloudWatch Logs tab and API Keys section screenshot
  5. Choose your preferred API key expiration, then click Generate.

    CloudWatch API key generation screenshot
  6. After the key is generated, copy and save it immediately. You will not be able to view it again after leaving this page.

    CloudWatch API key save dialog screenshot
  7. Navigate to Log Management under Logs in the left-hand menu. Select the Log Group where you want to deliver your logs.

    CloudWatch log group selection screenshot
  8. Click the Actions dropdown, then select Edit bearer token authentication.

    CloudWatch bearer token authentication option screenshot
  9. When prompted, enable bearer token authentication by selecting Yes.

    CloudWatch enable bearer token authentication screenshot
  10. Confirm that bearer token authentication is enabled.

    CloudWatch bearer token authentication confirmation screenshot
  11. Identify and note the log stream where you want your logs delivered.

    CloudWatch log stream identification screenshot

How To Configure the CloudWatch SIEM in EZSSH Portal

  1. Go back to the EZSSH portal.

  2. Under SIEM Provider, select CloudWatch.

    EZSSH Agentless JIT Access SIEM Settings with Send Audit Logs to SIEM selected and CloudWatch highlighted in the SIEM Provider dropdown
  3. Enter the AWS Region, Log Group, Log Stream, and Bearer Token that you copied from the CloudWatch portal.

  4. Click Test Connection. This creates a test log in CloudWatch. Please allow a few minutes for the log to show up in the CloudWatch portal.

    EZSSH Agentless JIT Access SIEM Settings showing the CloudWatch AWS Region, Log Group, Log Stream, and Bearer Token fields with Test Connection highlighted

Once you are done, save your settings:

  1. Click Save Changes at the top of the Subscription Settings section. Your changes are not applied until you save them.

    EZSSH Agentless JIT Access Settings page showing the Subscription Settings header with the Save Changes button highlighted

Done! EZSSH now sends your audit logs to CloudWatch. If an error occurs, EZSSH emails your Subscription Administrators.

How To Create Alerts in CloudWatch to Monitor Your SSH Activity

We recommend setting up alerts for abnormal behavior. To set up alerts in CloudWatch, go to Actions > Create metric filter within your log group. Here are some example queries to get you started:

Detect if a User Is Reusing SSH Keys

To detect any user that has reused an SSH key, set an alert if there are repeat instances of the UserPublicKey field:

fields event.UserPublicKey
| filter source = "EZSSH"
| stats count() as usageCount by event.UserPublicKey
| filter usageCount > 1

Get All SSH Requests that Granted an SSH Certificate

To get all the requests that created an SSH certificate, run the following query:

{ $.source = "EZSSH" && $.sourcetype = "EZSSH_SSH" && $.event.ActionPerformed != "Test Connection" && $.event.Certificate != "NA" }

You can correlate the results of this query with the SSH logins on your servers to verify that all logins are done with an EZSSH certificate.

Get the Count of Git Certificates Requested by User

To get the number of GitHub certificates each user has requested, run the following query:

fields event.RequestorFriendlyName
| filter source = "EZSSH" and sourcetype = "EZSSH_GIT"
| stats count() as certRequests by event.RequestorFriendlyName
| sort certRequests desc

This query is useful to find anomalies, such as a user requesting a higher number of certificates than usual.