python - HTTPS on Elastic Beanstalk Flask application -
i have been trying ssl enabled on aws elastic beanstalk(eb) application not luck far.
after following documentation configuring https access on eb, created self-signed certificate believe enough if 1 wants encryption.
i created eb environment used load balancer , after uploading certificate, able use , pick secure listening port (8443).
on ec2 load balancer, created listener
https 8443 http 80 <cert file>
i gave load balancer , eb instance security group had rule:
custom tcp rule tcp 8443 0.0.0.0/0
i included config in .ebextensions pointing documentation told me:
resources: sslsecuritygroupingress: type: aws::ec2::securitygroupingress properties: groupname: {ref : <security_group_name>} ipprotocol: tcp toport: 8443 fromport: 8443 cidrip: 0.0.0.0/8443
then in flask application application had these parameters:
from openssl import ssl flask_sslify import sslify context = ssl.context(ssl.tlsv1_2_method) context.use_privatekey_file('/home/ec2-user/privatekey.pem') context.use_certificate_file('/home/ec2-user/server.crt') basic_auth = basicauth(application) sslify = sslify(application) if __name__ == '__main__': application.run(host='0.0.0.0', port=8443, ssl_context=context)
now when go instance's public ip prefixed https:// this:
google chrome connection info (can't post images current rep ughh)
which makes me think have encryption i'm after flask server connection log still shows clear requests (expected see jumbled, encrypted request info).
when connect *.elasticbeanstalk.com address nothing.
so guess have 2 questions:
1) does mean have encryption?
2) why can't access instance elasticbeanstalk url?
your elb config listen https request on port 8443 , make proxy request ec2 http port. so, ec2 must listen on http port. but, means terminate ssl request on elb.
if want ec2 listen https request on port 8443, elb config should be:
https 8443 https 8443 <cert_file>
Comments
Post a Comment