Monitor Amazon CloudWatch Security Logs for failed SSH attempts

Beginner

29 students completed the lab in ~54m

Total available time: 1h:30m

Be the first to rate this lab!

Lab Overview

Clearly security is a huge issue for the technical sector, and public cloud is no exception to that. If you Google "top cloud security concerns" one of the top articles is from Information Week titled 9 Worst Cloud Security Threats. The section on Account or Service Traffic Hijacking states:

An intruder with control over a user account can eavesdrop on transactions, manipulate data, provide false and business-damaging responses to customers, and redirect customers to a competitor's site or inappropriate sites.

This Lab is germane to the quote above. In this Lab you will configure an EC2 instance to use the CloudWatch agent so it can deliver the security log file to Amazon CloudWatch. A CloudWatch Log Group and Log Stream will be automatically created for you. By monitoring the security log file for a specific type of potential breach (based on a pattern), CloudWatch will proactively send an email notification to your email. You will also configure Amazon Simple Notification Service (SNS) as the communication channel for the notification.

Although this Lab focuses on failed SSH attempts, there is a broader application that should be recognized, including how CloudWatch can be utilized in many different ways for many different logs or infrastructure metrics. 

Lab Objectives

Upon completion of this lab you will be able to:

  • Configure an EC2 instance to use the CloudWatch log agent
  • Verify the log agent status
  • Locate a few key security related log files and view them on the EC2 instance
  • Create an Simple Notification Service (SNS) topic
  • Subscribe to an SNS topic
  • Use CloudWatch to monitor a log stream for a specific pattern (invalid SSH users) and send a notification via SNS

Lab Prerequisites

You should be familiar with:

  • Basic security, log file and SSH concepts
  • Using the Linux command line is not required by helpful

Lab Environment

Before completing the lab instructions the environment will look as follows:

  • An EC2 instance with the CloudWatch Log Agent configured and running 
  • A custom IAM Role with a Policy that allows the EC2 instance to communicate with Amazon CloudWatch

After completing the lab instructions the environment should look similar to:

Follow these steps to learn by building helpful cloud resources

Logging in to the Amazon Web Services Console

Your first step to start the Lab experience

Confirming CloudWatch Agent Setup, CloudWatch Log Group and Log Stream creation

Make sure your EC2 instance is configured correctly for CloudWatch and the CloudWatch Log Stream receives Messages

Creating an SNS Topic for SSH failures

Create an SNS topic for use as a communication channel

Creating a Subscription and subscribing to the SSH failure Topic

Create a subscription in order to receive push notifications

Creating an Alarm for SSH failures

Create an Alarm that pushes a notification for excessive SSH failures