Amazon CloudFront - 使用 Signed URL 保护视频

Amazon CloudFront - protect video with Signed URL

背景:

使用 S3 存储的 Amazon Cloudfront 视频传输:我使用的是自定义 360 度视频播放器。播放器只需 links 到 MP4 视频。这些视频不是流式传输,而是直接 link 渐进式下载。

待解决的问题 ---> 签名 URL

1) 视频只能从我的网站播放,不能从其他网站播放。不然别人就热link视频文件,我就得付亚马逊流量了。

2) 在何处以及如何插入 CloudFront "Signed URL" 策略??大多数提示建议使用连接到 CloudFront 的 "Signed URL"。但是我不能把这些谜题放在一起,太混乱了,因为我只是一个 semi-advanced self-taught 的人。所以..:[=​​11=]

2A --> 在哪里插入 CloudFront 策略?在 S3 控制台上?或者在哪里?

2B --> 具体写什么,请。提供一个工作示例!

2C --> 如何包含一个特定域

3)我还怀疑保护 S3 存储桶中的文件权限是不够的,CloudFront 可能会忽略该权限规则。对吗?

指导:

如果没有任何效果,我正在寻找付费的 1 小时 Skype 指导 session,我们在其中使用屏幕共享与 CloudFront Signed URL 一起设置了 1 个视频。全部带有 step-by-step 解释,因此我可以自己对其他视频重复该过程。 Skype session 对于预算敏感的 Kickstarter / Indiegogo 项目来说是负担得起的。

非常感谢任何帮助,真的!谢谢!

1) The videos should ONLY play back from my website and not from other websites. Otherwise someone will just hotlink to the videofiles, and I will have to pay for the Amazon traffic.

是的,所以您的网站需要 运行 在可以动态生成 link 视频的 HTML 页面的平台上。

2) Where and how to insert CloudFront "Signed URL" policies?? Most tips suggest to use "Signed URL" that is connected to CloudFront. But I cannot put the puzzles together, too confusing as I am only a semi-advanced self-taught guy. So..:

该策略用于生成签名,它包含在您生成的 link 中,如果您使用 custom policy ...它看起来像 &Policy=...后跟策略的 base64 编码版本。

它在URL?!是的。签名使策略防篡改。这嵌入在您的代码在每次页面加载时生成的签名 URL 中。如果您使用固定政策,那么您就不会 save/send 它在任何地方。您将它用于签名计算,然后将其丢弃,因为 CloudFront 已经知道它包含的内容,因为它与正在发出的请求相匹配(否则,它无效,因此请求正确地失败)。

2A --> where to insert the CloudFront policy? On S3 console?Or where?

没有那样的地方。见上文。

2B --> what exactly to write, pls. provide a working example!

有一个工作示例in the documentation

Stack Overflow 没有免费的代码赠送服务。

2C --> how to include one specific domain

实际情况并非如此。按域保护内容根本不是保护内容,因为它可以被伪造。

您的网站提供已签名的 link。 link 是有效的,因为它们是从您那里获得的。它们只会在几秒钟内有效——足够长的时间来开始下载——然后它们就会过期……所以即使有人对它们很热link,你也不在乎,因为link 已经过时了。但这就是您在每次加载页面时生成它们的原因。

或者,通过 CloudFront 为您的整个站点提供服务,然后使用 CloudFront 签名的 cookie 允许登录到您站点的任何人访问您的受限内容。

3)I also suspect that protecting the file permissions in a S3 bucket is not enough, CloudFront may ignore that permission rule. Is that correct?

不,除非您安排,否则 CloudFront 没有访问您的存储桶的特权。 CloudFront 源访问身份为其提供访问存储桶中对象的必要权限。

阅读Serving Private Content through CloudFront