This repository contains a sample AWS Elasticbeanstalk application to help illustrate how to deploy the Falcon sensor on your Elastic Beanstalk compute resources.
The recommended way is to use use an ebextension to deploy the Falcon sensor, but there are two other methods described at the bottom of this readme you can also utilize.
- ebextensions (Recommended)
- Deploying the Example Application
- Prerequisites
- Deployment Steps
- Step 1: Store Falcon Credentials
- Step 2: Create a Key-Pair
- Step 3: Create an Instance Profile
- Step 4: Create Elastic Beanstalk Environment
- Step 5: Package the Sample Application
- Step 6: Deploy the Sample Application
- Step 7: Verify the Application Deployment
- Step 8: Verify the Falcon Sensor Installation
- Other Deployment Options
-
First, add the Falcon client id and secret to Secrets Manager.
-
Create a
scripts
folder. In the script folder, create the following file.
scripts/install_falcon.sh
#!/bin/bash
export FALCON_CLIENT_ID="$(aws secretsmanager get-secret-value --secret-id "$SECRET_ID" --query SecretString --output text | jq -r .FALCON_CLIENT_ID)"
export FALCON_CLIENT_SECRET="$(aws secretsmanager get-secret-value --secret-id "$SECRET_ID" --query SecretString --output text | jq -r .FALCON_CLIENT_SECRET)"
curl -L https://raw.githubusercontent.com/crowdstrike/falcon-scripts/v1.7.1/bash/install/falcon-linux-install.sh | bash
Note
This script retrieves the Falcon credentials from secrets manager, and installs the sensor using the linux script from the falcon-scripts repository.
- Create a
.ebextensions
directory in the root of the application package. Within this folder, create the following files.
.ebextensions/secrets_manager.config
option_settings:
aws:elasticbeanstalk:application:environment:
SECRET_ID: <secret name>
Tip
Remember to change <secret name> to your actual secret name
Note
This config will ensure the secret name is exported as an environment variable.
.ebextensions/falcon.config
container_commands:
01_falcon:
command: "sh scripts/install_falcon.sh"
Note
This config will execute the falcon install script we previously created at runtime.
- Have a current CrowdStrike Subscription
- Have appropriate AWS permissions to run CloudFormation and create resources
- Generate Falcon API credentials (Client ID and Client Secret)
- Ensure you have the aws-elasticbeanstalk-service-role deployed in your AWS account
-
Open the AWS console ans navigate to Secrets Manager.
-
Click on Store a new secret.
-
Under Secret type Choose Other type of secret
-
Create an entry for FALCON_CLIENT_ID and FALCON_CLIENT_SECRET with their respective values
-
Under Secret Name enter ebs/falcon/credentials
-
Click Next -> Next -> Store
Note
If you already have a key pair you want to use, feel free to skip this step
-
In the AWS Console, navigate to EC2
-
Under Network and security click Key Pairs
-
Click Create key pair
-
Give your key pair a suitable name.
-
Click Create key pair as save your key to a secure location.
-
Navigate to IAM in the AWS console.
-
Click Roles and Create role
-
Under Select trusted entity choose AWS Service
-
Under Use case choose EC2 then click Next
-
Select the AWSElasticBeanstalkWebTier and SecretsManagerReadWrite managed policies. Click Next
-
Give your role a name then click Create role
- Navigate to Elastic Beanstalk in the AWS Console Click on Create environment
- Configure Environment
- Choose the following values
- Environment tier: Web server environment
- Application Name: CSHelloWorld
- Platform: Python
- Platform branch: Python 3.12
- Platform version: 4.3.1(Recommended)
- Click Next
- Choose the following values
- Configure service access
- For Existing service roles choose aws-elasticbeanstalk-service-role
- If you do not have this role, refer to this documentation to get it deployed.
- For EC2 key pair, choose the key pair we created earlier
- For EC2 instance profile choose the instance profile we created earlier
- Click Next until you arrive at Configure instance traffic and scaling
- For Existing service roles choose aws-elasticbeanstalk-service-role
- Configure instance traffic and scaling
- For Root volume type choose General Purpose 3(SSD)
- Leave everything else as default, scroll down, and click Skip to review
- Click Submit
Open up this root directory in your terminal and execute the following commands
zip -r ./hello_world.zip .
-
Navigate back to the environment we created in Elastic Beanstalk.
-
Click Upload and deploy.
-
Select the hello_world.zip file we created.
-
Click Deploy
-
Click the url under Domain
-
You should see a simple webpage with a
Hello World!
message
-
In the logs tab, click Request logs and then Full
-
Download and unzip the contents
-
In the
var/log/
directory, open the cfn-init-cmd.log file. At the bottom of the file, you should see some logs that resemble the following
...
2024-12-03 17:53:01,286 P3644 [INFO] Command 01_falcon
2024-12-03 17:53:14,245 P3644 [INFO] -----------------------Command Output-----------------------
2024-12-03 17:53:14,246 P3644 [INFO] % Total % Received % Xferd Average Speed Time Time Time Current
2024-12-03 17:53:14,247 P3644 [INFO] Dload Upload Total Spent Left Speed
2024-12-03 17:53:14,247 P3644 [INFO]
2024-12-03 17:53:14,247 P3644 [INFO] 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
2024-12-03 17:53:14,247 P3644 [INFO] 100 35817 100 35817 0 0 164k 0 --:--:-- --:--:-- --:--:-- 164k
2024-12-03 17:53:14,247 P3644 [INFO] Check if Falcon Sensor is running ... [ Not present ]
2024-12-03 17:53:14,247 P3644 [INFO] Falcon Sensor Install ...
2024-12-03 17:53:14,247 P3644 [INFO] Installed:
2024-12-03 17:53:14,247 P3644 [INFO] falcon-sensor-7.20.0-17306.amzn2023.x86_64
2024-12-03 17:53:14,247 P3644 [INFO]
2024-12-03 17:53:14,247 P3644 [INFO] [ Ok ]
2024-12-03 17:53:14,247 P3644 [INFO] Falcon Sensor Register ... [ Ok ]
2024-12-03 17:53:14,247 P3644 [INFO] Falcon Sensor Restart ... [ Ok ]
2024-12-03 17:53:14,247 P3644 [INFO] Falcon Sensor installed successfully.
2024-12-03 17:53:14,247 P3644 [INFO] ------------------------------------------------------------
2024-12-03 17:53:14,248 P3644 [INFO] Completed successfully.
Congratulations! The sensor was successfully installed.
Tip
You can further confirm this by querying for your instance in the Falcon console.
This method involves using AWS SSM distributor to deploy the Falcon sensor directly on the machine. An in depth guide can be found in this repository
This method involves creating custom AMIs with the Falcon sensor already installed using EC2 Image Builder, and using that AMI for your Elasticbeanstalk compute resources. An in depth guide can be found here to-do: add documentation reference