Control: ELB application load balancers should redirect HTTP requests to HTTPS
Description
To help protect data in transit, ensure that your Application Load Balancer automatically redirects unencrypted HTTP requests to HTTPS.
Usage
Run the control in your terminal:
powerpipe control run aws_compliance.control.elb_application_lb_redirect_http_request_to_httpsSnapshot and share results via Turbot Pipes:
powerpipe loginpowerpipe control run aws_compliance.control.elb_application_lb_redirect_http_request_to_https --shareSQL
This control uses a named query:
with detailed_listeners as ( select arn, load_balancer_arn, protocol from aws_ec2_load_balancer_listener, jsonb_array_elements(default_actions) as ac where split_part(arn,'/',2) = 'app' and protocol = 'HTTP' and ac ->> 'Type' = 'redirect' and ac -> 'RedirectConfig' ->> 'Protocol' = 'HTTPS')select a.arn as resource, case when b.load_balancer_arn is null then 'alarm' else 'ok' end as status, case when b.load_balancer_arn is not null then a.title || ' associated with HTTP redirection.' else a.title || ' not associated with HTTP redirection.' end as reason , a.region, a.account_idfrom aws_ec2_application_load_balancer a left join detailed_listeners b on a.arn = b.load_balancer_arn;