From 69c9944f3762740a47ffe2e5d5bf341299bd8abb Mon Sep 17 00:00:00 2001 From: danpopp Date: Fri, 14 Feb 2014 13:43:52 -0600 Subject: [PATCH 1/2] Fixed ordering of ec2_url subdomains to match AWS This fixes the invalid certificate issue caused by incorrect URL subdomain. Since Amazon's SSL/TLS certificate is for https://ec2..amazonaws.com and not https://.ec2.amazonaws.org (error output below). Traceback (most recent call last): File "../../fec2-din.py", line 95, in reservations = ec2_conn.get_all_instances() File "/Library/Python/2.7/site-packages/boto/ec2/connection.py", line 575, in get_all_instances max_results=max_results) File "/Library/Python/2.7/site-packages/boto/ec2/connection.py", line 656, in get_all_reservations [('item', Reservation)], verb='POST') File "/Library/Python/2.7/site-packages/boto/connection.py", line 1127, in get_list response = self.make_request(action, params, path, verb) File "/Library/Python/2.7/site-packages/boto/connection.py", line 1073, in make_request return self._mexe(http_request) File "/Library/Python/2.7/site-packages/boto/connection.py", line 910, in _mexe request.body, request.headers) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 955, in request self._send_request(method, url, body, headers) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 989, in _send_request self.endheaders(body) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 951, in endheaders self._send_output(message_body) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 811, in _send_output self.send(msg) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 773, in send self.connect() File "/Library/Python/2.7/site-packages/boto/https_connection.py", line 124, in connect 'certificate' % hostname) boto.https_connection.InvalidCertificateException: Host us-east-1.ec2.amazonaws.com returned an invalid certificate (remote hostname "us-east-1.ec2.amazonaws.com" does not match certificate): {'notAfter': 'Sep 17 23:59:59 2014 GMT', 'subject': ((('countryName', u'US'),), (('stateOrProvinceName', u'Washington'),), (('localityName', u'Seattle'),), (('organizationN ame', u'Amazon.com Inc.'),), (('commonName', u'ec2.us-east-1.amazonaws.com'),))} --- fec2din | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fec2din b/fec2din index 2ef2a6b..a73b775 100755 --- a/fec2din +++ b/fec2din @@ -27,7 +27,7 @@ ec2_filter = args.ec2_filter # AWS_ACCESS_KEY="aaaaaaaaaaaaaaaaaaaa" # AWS_SECRET_KEY="bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb" -ec2_url="https://us-east-1.ec2.amazonaws.com" +ec2_url="https://ec2.us-east-1.amazonaws.com" try: AWS_ACCESS_KEY @@ -47,7 +47,7 @@ This would look something like: try: - ec2_url = "https://%s.ec2.amazonaws.com" % os.environ['EC2_REGION'] + ec2_url = "https://ec2.%s.amazonaws.com" % os.environ['EC2_REGION'] except KeyError: pass From f49eb9b2c11570e40c9a78a2a0331a7660207509 Mon Sep 17 00:00:00 2001 From: danpopp Date: Fri, 14 Feb 2014 13:45:56 -0600 Subject: [PATCH 2/2] Fixed ordering of ec2_url subdomains to match AWS For detailed description see: commit 69c9944f3762740a47ffe2e5d5bf341299bd8abb --- fec2run | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fec2run b/fec2run index 29b1693..3b5f72a 100755 --- a/fec2run +++ b/fec2run @@ -38,7 +38,7 @@ short_name = name.split('.')[0] # AWS_ACCESS_KEY="aaaaaaaaaaaaaaaaaaaa" # AWS_SECRET_KEY="bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb" -ec2_url="https://us-east-1.ec2.amazonaws.com" +ec2_url="https://ec2.us-east-1.amazonaws.com" try: AWS_ACCESS_KEY