Django的AWS S3证书无效用桶名称和QUOT时;" [英] Django AWS S3 Invalid certificate when using bucket name "."

查看:247
本文介绍了Django的AWS S3证书无效用桶名称和QUOT时;"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个在该<一中描述的问题href="http://stackoverflow.com/questions/9119194/django-storages-using-boto-cannot-upload-mp3-but-can-upload-an-image-also-s#12752936">ticket.

我不能做 collectstatic 上传使用Django当地对我们的 static.somesite.com ,因为S3添加了S3 .amazon.com的URL,然后无效自己的 *。s3.amazon.com 证书。 我设置了DNS指针static.somesite.com指向S3服务的IP。

我有 AWS_S3_SECURE_URLS =假设置。

不知道如何解决它。这是完整的错误消息。我完全理解为什么它正在发生的事情,必须有一个解决方法吗?在我们的生产服务器这工作得很好。只是无法找到设置。

  boto.https_connection.InvalidCertificateException:
主机static.somesite.com.s3.amazonaws.com返回无效证书

(远程主机名static.somesite.com.s3.amazonaws.com不匹配证书)

{
 notAfter:4月9日23:59:59北京时间2015年,
 的SubjectAltName:(
                    ('的DNS','* .s3.amazonaws.com'),
                    ('的DNS','s3.amazonaws.com')),
 '学科': (
             (('国家名称',u'US'),),
             (('stateOrProvinceName',u'Washington'),),
             (('处所名称',u'Seattle'),),
             (('单位名称',u'Amazon.com公司'),),
             (('通用名称',U'*。s3.amazonaws.com'))
            )
 }
 

解决方案

被挖了code为交通应用程序,我一直在使用。仿佛是从什么地方除了我的Django的项目设置拿起配置设置,并覆盖它们。

几年前,我测试了谷歌云存储的谷歌应用程序引擎的测试项目,这意味着我安装了全球Gsutils包。你猜怎么了? Gsutils使用宝途呢!所以,一旦我发现我可以设置一个博托配置文件,我开始寻找这一点。坐在OSX没有文件〜/ .boto可以在Finder中可以看出,使用 LS -al 列出文件时,我的主目录。唉,当我试图瞧与纳米〜/ .boto创建它!有设置堆已经在那里从我用Gsutils的时间。

在那里我禁用 #https_validate_certificates = TRUE 设定,一切工作就像一个魅力吧。

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.

这篇关于Django的AWS S3证书无效用桶名称和QUOT时;&QUOT;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆