awslabs / aws-config-rules

[Node, Python, Java] Repository of sample Custom Rules for AWS Config.
http://aws.amazon.com/config/
Creative Commons Zero v1.0 Universal
1.6k stars 853 forks source link

New rule to check if the Classic Load Balancers serve HTTPS #188

Open santosh-at-github opened 5 years ago

santosh-at-github commented 5 years ago
'''
#####################################
##           Gherkin               ##
#####################################
Rule Name:
  CLASSIC_ELB_SSL_ENFORCE_CHECK

Description:
  Check whether SSL is enforced on the Amazon Classic Load Balancers either using HTTPS/SSL listeners or by redirecting HTTP traffic to HTTPS.

Trigger:
  Configuration change on AWS::ElasticLoadBalancing::LoadBalancer

Reports on:
  AWS::ElasticLoadBalancing::LoadBalancer

Rule Parameters:
  HttpsRedirectionCheck
   Optional
   A boolean parameter to check if HTTP to HTTPS traffic redirection is enabled. Default is True.

Scenarios:
  Scenario: 1
     Given: Parameter HttpsRedirectionCheck is configured
       And: It is not either True or False
      Then: Return an error
  Scenario: 2
     Given: CLB has only TCP listeners(s)
      Then: Return NON_COMPLIANT with Annotation "CLB {CLB_Name} has no HTTPS or SSL listeners configured."
  Scenario: 3
     Given: CLB has no HTTPS or SSL listeners(s)
      Then: Return NON_COMPLIANT with Annotation "CLB {CLB_Name} has no HTTPS or SSL listeners configured."
  Scenario: 4
     Given: CLB has HTTPS/SSL and HTTP listeners
       And: The parameter HttpsRedirectionCheck is False
      Then: Return NON_COMPLAINT with Annotation "CLB {CLB_Name} has HTTP listener(s) configured."
  Scenario: 5
     Given: CLB has HTTPS/SSL and HTTP listeners
       And: The parameter HttpsRedirectionCheck is True
       And: HTTP to HTTPS redirection is not enabled
      Then: Return NON_COMPLAINT with Annotation "CLB {CLB_Name} serves HTTP traffic without redirecting to HTTPS."
  Scenario: 6
     Given: CLB has HTTPS/SSL and HTTP listeners
       And: The parameter HttpsRedirectionCheck is True
       And: HTTP to HTTPS redirection is enabled
      Then: Return COMPLAINT
  Scenario: 7
     Given: CLB has HTTPS/SSL listener(s) only
      Then: Return COMPLAINT
'''
santosh-at-github commented 5 years ago

@jongogogo Please review the gherkin and let me know in case of any changes required.

jongogogo commented 5 years ago

See my comments: https://github.com/awslabs/aws-config-rules/issues/190 I suggest we finish the gherkin on ALB first, then adapt for CLB :)

santosh-at-github commented 5 years ago

Sure @jongogogo, I will do it after ALB Gherkin is complete, but I have some suggestions and questions

jongogogo commented 5 years ago
  1. Yes, SSL to TLS/SSL. SSL is the old protocol (and mainly retired), but it became a synonym to encryption in transit for HTTPS. The security community is naming as TLS/SSL sometimes.
  2. OK for L4 to L7, it is a bit more tricky than ALB indeed.
  3. The SSL policies is because certain policies are allowed by PCI DSS (for example) and others are not. So customers must have the ability to check that.