AWS: Boto3 & Documentions
--Hence the security within the cloud infrastructure is customer or client responsibility and outside the cloud infrastructure like servers, data center they AWS's responsible for AWS.
--While enabling various configurations in the custom service customer sometimes makes errors of judgment. Like not enabling deletion protection in ELBv2 - Elastic load balancer v2 is not protected with accidental deletion.
So for that various guidelines are created by the organization or enterprise to follow. Those guidelines were called configuration or the cloud security guidelines. The Cyber cloud security engineer or SecOps engineer reviews and makes it official in the guidelines to follow the procedure while using a particular service like EC2.
DevSecOps is the term used for a person who is using programmatic language for automation or automatic remediation, Legacy reviews, NTI reviews etc.
Case study : Config Rule Service and Boto3
Configuration rule or config rule
Config rule is one the AWS services which are provided for the proper identification for the complaint and non compliant resources. Config rules are of two types: Managed config rule and Custom config rule.
Managed config rule is the rule which is provided by the AWS and the custom one is the one we are scripting it.
For example Managed config rule
— alb-http-to-https-redirection-check
https://docs.aws.amazon.com/config/latest/developerguide/managed-rules-by-aws-config.html
It will check if HTTP to HTTPS redirection is configured on all HTTP listeners of Application Load Balancers. The rule is non compliant if one or more HTTP listeners of Application Load Balancer do not have HTTP to HTTPS redirection configured. The rule is also non-compliant if one or more HTTP listeners have forwarding to an HTTP listener instead of redirection.
For this we just require the name for the implementation and formatting it in json format
{
"Version":"1.0",
"Parameters":{
"Rulename":<<Config Rule name>>,
"SourceRunTime":null,
"CodeKey":null,
"Inputparameters":{}
"OptionParameter":{},
"SourcePeriodic":24,
//We write the config rule name here//
"SourceIdentified": "alb-http-to-https-redirection-check',
"RuleSets"[]
},
"Tags":[]
}
Example Custom config rule
In this case the config rule is not provided by AWS. Instead of the Managed documentation we look at the Boto3 documentations
Boto3 documentations
– Link- https://boto3.amazonaws.com/v1/documentation/api/latest/index.html
AWS provide API reference Id to create our own config rule or auto remediation scripts
For ELBv2 service
import boto3
client = boto3.client('elbv2')
Python script is required to access the resources configurations and other functionalities
Client the object which is used to retrieve the data and invoking the methods present in the ELBv2 class
Will discuss the EC2 case study with require tags example and continue boto3 documentation and how to implement the Python Script auto remediation next week's Blog.
Thank You
Comments
Post a Comment