minio 做为比较热门的开源s3 服务,受到好多团队的青睐,使用率还是比较高的,如果我们的服务是部署在内网的还好
一般不用太担忧安全问题(但是也得做好内网的安全防护),但是如果直接将s3 服务暴露到公网问题就比较多了,解决
方法很多,比如使用waf,自己配置一些安全策略,以下是基于nginx limit_except 搞一个minio 快速的安全防护
参考玩法
核心是利用了limit_except 只允许,get,head, 以及options 请求,对于delete 以及put,post 等操作都禁用,好处比较明显
我们只会暴露我们需要提供给用户资源(主要是get),一般就不同利用我们的put 以及delete 操作了
参考玩法
- docker-compose 文件
version: '3'
services:
minio:
image: minio/minio
ports:
- "9000:9000"
- "19001:19001"
environment:
MINIO_ROOT_USER: minio
MINIO_ROOT_PASSWORD: minio123
command: server --console-address :19001 --quiet /data
nginx:
image: openresty/openresty:alpine-fat
volumes:
- ./nginx.conf:/usr/local/openresty/nginx/conf/nginx.conf
ports:
- 80:80
- nginx.conf
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
gzip on;
real_ip_header X-Forwarded-For;
resolver 127.0.0.11;
real_ip_recursive on;
server {
listen 80;
server_name localhost;
charset utf-8;
# 基于nginx 暴露最小的请求路径,同时限制只能使用get head 以及options 请求
location /apps/ {
limit_except GET HEAD OPTIONS{
deny all;
}
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;
proxy_connect_timeout 300;
# Default is HTTP/1, keepalive is only enabled in HTTP/1.1
proxy_http_version 1.1;
proxy_set_header Connection "";
chunked_transfer_encoding off;
proxy_pass http://minio:9000;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
说明
以上是一个简单的玩法,实际上我们基于nginx (openresty) 可以做不少关于minio 的安全防护,减少minio 因为安全问题,造成的数据泄漏以及被人利用
参考资料
https://nginx.org/en/docs/http/ngx_http_core_module.html#satisfy
https://github.com/rongfengliang/using_limit_except_protect_minio
原文地址:http://www.cnblogs.com/rongfengliang/p/16830196.html
1. 本站所有资源来源于用户上传和网络,如有侵权请邮件联系站长!
2. 分享目的仅供大家学习和交流,请务用于商业用途!
3. 如果你也有好源码或者教程,可以到用户中心发布,分享有积分奖励和额外收入!
4. 本站提供的源码、模板、插件等等其他资源,都不包含技术服务请大家谅解!
5. 如有链接无法下载、失效或广告,请联系管理员处理!
6. 本站资源售价只是赞助,收取费用仅维持本站的日常运营所需!
7. 如遇到加密压缩包,默认解压密码为"gltf",如遇到无法解压的请联系管理员!
8. 因为资源和程序源码均为可复制品,所以不支持任何理由的退款兑现,请斟酌后支付下载
声明:如果标题没有注明"已测试"或者"测试可用"等字样的资源源码均未经过站长测试.特别注意没有标注的源码不保证任何可用性