简体   繁体   中英

Django AWS S3 Invalid certificate when using bucket name “.”

I have an issue that is described in this ticket .

I can´t do collectstatic uploads with django locally to our static.somesite.com since S3 adds s3.amazon.com to the url and then invalidates their own *.s3.amazon.com certificate. I have set a dns pointer for static.somesite.com that points to the ip of the s3 service.

I have the AWS_S3_SECURE_URLS = False set.

Not sure how to solve it yet. This is the full error message. I understand completely why it is happening, there has to be a workaround? On our production server this works just fine. Just cant find the settings.

boto.https_connection.InvalidCertificateException: 
Host static.somesite.com.s3.amazonaws.com returned an invalid certificate 

(remote hostname "static.somesite.com.s3.amazonaws.com" does not match certificate)     

{
 'notAfter': 'Apr  9 23:59:59 2015 GMT', 
 'subjectAltName': (
                    ('DNS', '*.s3.amazonaws.com'),
                    ('DNS', 's3.amazonaws.com')), 
 'subject': (
             (('countryName', u'US'),), 
             (('stateOrProvinceName', u'Washington'),), 
             (('localityName', u'Seattle'),), 
             (('organizationName', u'Amazon.com Inc.'),), 
             (('commonName', u'*.s3.amazonaws.com'),)
            )
 }

Been digging in the code for the transport app that I have been using. Seemed that it was picking up config settings from somewhere besides my django project settings and was overriding them.

A few years ago I was testing out google cloud storage for a google app engine test project which meant I installed "Gsutils" package globally. Guess what? Gsutils uses Boto too! So once I found out that I could set a boto config file I started looking for that. Sitting on OSX no file ~/.boto could be seen in the Finder or when listing the files in my home directory with ls -al . Alas, when I tried to create it with nano ~/.boto voilá! There was heaps of settings already there from the time I used Gsutils.

Once in there I disabled the #https_validate_certificates = True setting and everything works like a charm now.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM