加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 运营中心 > Nginx > 正文

Nginx Owncloud安全措施?

发布时间:2020-12-13 21:22:08 所属栏目:Nginx 来源:网络整理
导读:OwnCloud给了我: X-XSS-Protection HTTP标头未配置为等于“1; mode = block” .这是潜在的安全或隐私风险,我们 建议调整此设置. X-Content-Type-Options HTTP标头未配置为相等 到nosniff.这是潜在的安全或隐私风险,我们 建议调整此设置. X-Frame-Options HT

OwnCloud给了我:

> X-XSS-Protection HTTP标头未配置为等于“1; mode = block”
.这是潜在的安全或隐私风险,我们
建议调整此设置.
> X-Content-Type-Options HTTP标头未配置为相等
到nosniff.这是潜在的安全或隐私风险,我们
建议调整此设置.
> X-Frame-Options HTTP标头未配置为等于
SAMEORIGIN.这是潜在的安全或隐私风险,我们
建议调整此设置.

我应该如何保护它?

最佳答案
安全测试仅供参考.让我们首先看看这些选项是什么,以了解它们究竟是做什么以及它们有多么必要.

> HTTP X-XSS-Protection XSS Filter默认激活(1),因此您要么通过设置0禁用它,要么OwnCloud建议您设置X-XSS-Protection:1; mode = block,这将导致超过清理:浏览器根本不会呈现页面,而只显示#.

The 07001 response header is a feature of Internet
Explorer,Chrome and Safari that stops pages from loading when they
detect reflected cross-site scripting (XSS) attacks. Although these
protections are largely unnecessary in modern browsers when sites
implement a strong 07002 that disables the use of
inline JavaScript ('unsafe-inline'),they can still provide
protections for users of older web browsers that don’t yet support
CSP.

尽管测试建议,你可能会对默认设置没问题.
如果MIME类型与样式/脚本中请求的类型不匹配,则> IE8 X-Content-Type-Options: nosniff阻止请求.目前所有主流浏览器都支持Safari.

The 07004 response HTTP header is a marker used by
the server to indicate that the 07005 advertised in the
07006 headers should not be changed and be followed. This
allows to opt-out of 07007,or,in other words,it is a
way to say that the webmasters knew what they were doing.

> X-Frame-Options: SAMEORIGIN允许浏览器在< frame>,< iframe>中呈现页面或< object>只有它来自与页面本身相同的原点.

这是针对XSS的一个很好的衡量标准,但这意味着您无法使用这些标记嵌入任何外部内容,即使源是合法的,例如YouTube视频.在这种情况下,设置X-Frame-Options:ALLOW-FROM http://www.youtube.com/可以保证您远离其他来源,但是您仍然会从此测试中收到错误.

当您了解这些标头的用途时,您可以正确设置它们以提高安全性,而不会丢失网站所需的任何功能.所有XSS预防方法都适用于用户或员工创建内容的站点.在静态网站上,您知道自己在做什么,并控制每个页面,有时可能会产生不必要的限制.

有了这些信息,使用add_header在Nginx中设置这些头文件并不困难:

   add_header  X-XSS-Protection        "1; mode=block";
   add_header  X-Content-Type-Options  nosniff;
   add_header  X-Frame-Options         SAMEORIGIN;

这些可以在http上下文中全局设置,也可以特定于服务器,位置或位置.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读