我想允许来自特定接口(interface)(例如 eth2)的连接只向我的数据库发出 http PUT 请求而不是 GET 请求。使用 iptables 可以吗?
最佳答案
你可以尝试...:
iptables -I INPUT -d 192.168.0.100 -p tcp --dport 5984 -m string --string 'GET /' --algo bm -j DROP
iptables -I INPUT -d 192.168.0.100 -p tcp --dport 5984 -m string --string 'PUT /' --algo bm -j ACCEPT
...但风险自负 - iptables 不是 HTTP 过滤的最佳工具。更好地在 CouchDB 前面设置真正的 HTTP 代理,例如 Nginx,以便对您收到的所有 HTTP 请求进行更灵活和最佳的控制。
关于http - 仅允许使用 iptables 的 http PUT 请求,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19592042/