linux - 如何配置拇指安全性?

标签 linux ubuntu docker image-processing thumbor

我已经使用 docker 容器在我的 ubuntu 上安装了thumor 6.3.2。

我正在尝试更改安全配置。但我失败了。 下面是我的/etc/thumbor.conf

SECURITY_KEY = "abcde"
ALLOW_UNSAFE_URL = False

我尝试过

thumbor -l INFO -p 8000 -c /etc/thumbor.conf

然后我发送了

/abcde/300x300/image.jpg

但是失败了。

奇怪的是,

/unsafe/300x300/image.jpg

成功了。

如何配置拇指安全?

最佳答案

我可以使用 SECURITY_KEY 设置拇指。

我开始使用拇指或 docker 图像:

docker run -p 8000:8000 -e SECURITY_KEY=test -e ALLOW_UNSAFE_URL=False apsl/thumbor

并从互联网上随机挑选了一张图像 - https://rak-posts.s3.amazonaws.com/images/2943/large_rak_day.png

然后我使用以下 python 代码生成了 base64.urlsafe_b64encode 签名:

>>> message = "1000x1000/https://rak-posts.s3.amazonaws.com/images/2943/large_rak_day.png"
>>> b_message = bytes(message)
>>> b_key = bytes("test")
>>> import hmac
>>> import hashlib
>>> digester = hmac.new(b_key, b_message, hashlib.sha1)
>>> signature = digester.digest()
>>> import base64
>>> url_safe_sign = base64.urlsafe_b64encode(signature)
>>> url_safe_sign
'_gcJOPfrByOrMqDekEool4uKYKE='
>>>

并像这样进行 URL 调用 - http://localhost:8000/_gcJOPfrByOrMqDekEool4uKYKE=/1000x1000/https://rak-posts.s3.amazonaws.com/images/2943/large_rak_day.png - 它按预期工作。

以及不安全的 URL - http://localhost:8000/unsafe/1000x1000/https://rak-posts.s3.amazonaws.com/images/2943/large_rak_day.png - 不再工作了。

请告诉我这是否有帮助。

谢谢, 侯赛因·博拉

关于linux - 如何配置拇指安全性?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50266814/

相关文章:

mysql 或 mariadb - 奇怪的服务器行为

linux - 将 cat 输出作为变量进行比较

linux - 在不创建新目录的情况下解压缩 tar,仅将 tar 中的新文件合并到现有目录结构中

docker - 如何在多阶段docker build中访问克隆的git repo?

java - 在 docker compose 文件中访问 Spring boot 应用程序属性

linux - 如何停止使用点(.)列出文件夹的查找命令

ubuntu - 如何通过 jdbc 从容器连接到主机上的 Informix DB?

performance - 使用 ubuntu 13.10 在 apache2 中安装 awstats

Mysql - 无法更改或添加新密码

docker - 什么是 docker run -it 标志?