Running Prowler inside AWS Lambda function
Did anybody try running prowler inside lambda function and dump the output to S3?
it's almost written in shell which wraps the aws cli.
It might be easier to put it into a docker container and run it periodically inside fargate (serverless docker container).
Exactly, thanks @markuman. Even if you use a wrapper like the one I use for Wazuh, due to the lambda timeout it won’t work unless for quick checks. I didn’t think on the Fargate option, I think it is pretty smart. I’d like to see it working and document it sending json findings to s3 or splunk or elasticsearch.
Sent with GitHawk
Thanks @markuman @toniblyx for the reply. Out of curiosity, how much time(average) does prowler need to run all the checks ? Will it be a good idea to use glue python shell for the same? We don't want to go ECS Fargate route for now.
It depends on how many resources you do have in each account you want to check or the number of checks or groups that you want to perform. It can be from few minutes to hours (10 or even more). Any checker that uses AWS API (like prowler using the cli) takes time due to the API request limits. See here https://docs.aws.amazon.com/general/latest/gr/aws_service_limits.html
Try running it manually first and get an idea of how long it takes in your case.
Remember that you can always create your own group to check only what you need.
Sent with GitHawk
That makes sense !! Thanks a lot for your help @toniblyx
We run it now within our gitlab runner ci/cd process - also in a docker container- periodically and publish the result with gitlab pages.
The only thing which needs to be handled is, that I need to catch the prowler exit 1 signal, when there is a FAIL. otherwhise gitlab won't publish the result on gitlab pages.
FROM alpine:3.9
RUN apk --update --no-cache add python3 bash curl
RUN pip3 install --upgrade pip
RUN pip install awscli ansi2html boto3
variables:
DOCKER_DRIVER: overlay
stages:
- deploy
pages:
image: ourimage:prowler
stage: deploy
script:
- ./run.sh
tags:
- docker
artifacts:
paths:
- public
only:
- automatic_calls
#!/bin/bash
mkdir -p public
/bin/bash prowler -r eu-central-1 -f eu-central-1 | ansi2html -la > public/index.html
exit 0
Thanks for sharing this info @markuman it is great. Do you have extended documentation available somewhere? I'd like to include it in the README.
I'm going to close this issue since I'll track this as a new feature/documentation in issue #299
@Sushant20 I think that this is what you are looking for https://aws.amazon.com/blogs/security/use-aws-fargate-prowler-send-security-configuration-findings-about-aws-services-security-hub/