• 请不要在回答技术问题时复制粘贴 AI 生成的内容
wordsmatter
V2EX  ›  程序员

如果要支持用户上传头像,有必要装 ClamAV 吗?

  •  
  •   wordsmatter · Jun 13, 2019 · 2579 views
    This topic created in 2705 days ago, the information mentioned may be changed or developed.

    用户只上传图片文件(头像),而 ClamAV 很耗内存。针对这种情况,是否有其他更好的方式呢?

    例如,用 fileinfo 来核验 mime 类型,只允许 jpe/jpeg/png/gif,是否能达到同样的效果,就可以不装 ClamAV ?

    6 replies  •  2019-06-14 16:32:24 +08:00
    KasuganoSoras
    KasuganoSoras
    Jun 13, 2019❤️1
    1
    完全可以啊,上传完了判断下 MIME,fileinfo 判断的很准的,最后别忘了设置一下禁止图片目录的可执行权限,同时在 Web 服务器里面设置图片目录所有文件作为静态处理就行了
    wordsmatter
    wordsmatter
    OP
    Jun 13, 2019
    2
    @KasuganoSoras 多谢!
    mYYnSmiTEQWcCwAr
    mYYnSmiTEQWcCwAr
    Jun 13, 2019 via Android
    3
    前端把图片传到云上呗 根本上杜绝文件上传漏洞
    wordsmatter
    wordsmatter
    OP
    Jun 13, 2019
    4
    @cy97cool 你说的这肯定是更安全的方案。不过因为是个人站,而且就是些头像图片,也就没想着去弄 S3 之类的,想简单些,直接上传到服务器
    mYYnSmiTEQWcCwAr
    mYYnSmiTEQWcCwAr
    Jun 14, 2019 via Android
    5
    试试 seaweedfs?
    wordsmatter
    wordsmatter
    OP
    Jun 14, 2019
    6
    @cy97cool 我去试试,谢谢!
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   753 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 17:33 · PVG 01:33 · LAX 09:33 · JFK 12:33
    ♥ Do have faith in what you're doing.