V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
wordsmatter
V2EX  ›  程序员

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

  •  
  •   wordsmatter · 2019-06-13 09:20:04 +08:00 · 1697 次点击
    这是一个创建于 1750 天前的主题,其中的信息可能已经有所发展或是发生改变。

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

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

    6 条回复    2019-06-14 16:32:24 +08:00
    KasuganoSoras
        1
    KasuganoSoras  
       2019-06-13 09:48:42 +08:00   ❤️ 1
    完全可以啊,上传完了判断下 MIME,fileinfo 判断的很准的,最后别忘了设置一下禁止图片目录的可执行权限,同时在 Web 服务器里面设置图片目录所有文件作为静态处理就行了
    wordsmatter
        2
    wordsmatter  
    OP
       2019-06-13 10:02:15 +08:00
    @KasuganoSoras 多谢!
    cy97cool
        3
    cy97cool  
       2019-06-13 13:46:44 +08:00 via Android
    前端把图片传到云上呗 根本上杜绝文件上传漏洞
    wordsmatter
        4
    wordsmatter  
    OP
       2019-06-13 14:49:14 +08:00
    @cy97cool 你说的这肯定是更安全的方案。不过因为是个人站,而且就是些头像图片,也就没想着去弄 S3 之类的,想简单些,直接上传到服务器
    cy97cool
        5
    cy97cool  
       2019-06-14 12:15:18 +08:00 via Android
    试试 seaweedfs?
    wordsmatter
        6
    wordsmatter  
    OP
       2019-06-14 16:32:24 +08:00
    @cy97cool 我去试试,谢谢!
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5527 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 37ms · UTC 08:59 · PVG 16:59 · LAX 01:59 · JFK 04:59
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.