钉钉电脑端屏蔽文件上传下载功能的方法

有些时候,为了保证企业内部资料的安全,往往需要屏蔽掉钉钉电脑端文件上传、下载功能。例如,上传功能往往会导致企业内部文件外泄,而下载功能有可能会下载到带毒的文档或者可执行文件。下面就介绍一种通过代理屏蔽的方法。

同时该方法不会影响到图片的上传、下载;文件在线预览、在线编辑也还正常保留

如果你公司的防火墙,或者网关支持屏蔽域名,那么可以很轻松的实现,方法就是在防火墙上将一下几个域名加入黑名单

sh.trans.dingtalk.com 
zjk.trans.dingtalk.com 
lippi-space-sh.oss-accelerate.aliyuncs.com
space.dingtalk.com

这四个域名中可以通过减少或者增加,实现仅禁止上传、仅禁止下载、上传下载都禁止、或者通过加入其他域名,实现禁止在线编辑,在线预览等功能

如果公司的防火墙不支持屏蔽域名,或者没有防火墙,那么我们还可以使用普通服务器搭建一个。

首先,我们知道钉钉PC版是可以配置HTTP或者Socks代理的,这一点在网络管理严格的网站非常实用。如果用户不愿意手动配置代理,那么也可以考虑使用透明代理来屏蔽掉和上传下载。下面以流行的HTTP代理软件privoxy为例来介绍如何通过代理来屏蔽钉钉客户端与服务器之间的通信。

首先我们知道,privoxy这款开源软件本身具备广告过滤功能,可以通过编辑相应的配置文件,书写相应的屏蔽规则来过滤广告,同理,我们把钉钉的OSS服务器,缓存服务器等加入广告规则,那么privoxy就可以轻松帮我们屏蔽掉了。

privoxy服务端的安装这里就不赘述了,网上有很多资料,我们直接介绍安装后的配置

此处参考官方的在线文档https://www.privoxy.org/3.0.28/user-manual/actions-file.html

privoxy的广告过滤规则文件一般分为三个:

  • match-all.action - is used to define which "actions" relating to banner-blocking, images, pop-ups, content modification, cookie handling etc should be applied by default. It should be the first actions file loaded

  • default.action - defines many exceptions (both positive and negative) from the default set of actions that's configured in match-all.action. It is a set of rules that should work reasonably well as-is for most users. This file is only supposed to be edited by the developers. It should be the second actions file loaded.

  • user.action - is intended to be for local site preferences and exceptions. As an example, if your ISP or your bank has specific requirements, and need special handling, this kind of thing should go here. This file will not be upgraded.

我们一般只修改其中的user.action就可以了

我们可以直接修改privoxy安装目录下的 user.action文档,也可以使用privoxy自带的Web页面进行图形化的配置,这里重点介绍图形化配置

官网原文是这样说的

8.2. How to Edit

The easiest way to edit the actions files is with a browser by using our browser-based editor, which can be reached from http://config.privoxy.org/show-status. Note: the config file option enable-edit-actions must be enabled for this to work. The editor allows both fine-grained control over every single feature on a per-URL basis, and easy choosing from wholesale sets of defaults like "Cautious", "Medium" or "Advanced". Warning: the "Advanced" setting is more aggressive, and will be more likely to cause problems for some sites. Experienced users only!

If you prefer plain text editing to GUIs, you can of course also directly edit the the actions files with your favorite text editor. Look at default.action which is richly commented with many good examples.

翻译过来就是, 启动privoxy后,将你的浏览其配置好代理,然后浏览器访问http://config.privoxy.org/show-status,就可以看到你这个privoxy服务器后台的一个配置页面了,以火狐浏览器为例,找到选项-拖到最底,在“网络设定"中点击“设定”按钮,然后就可以看到如下界面

钉钉电脑端屏蔽文件上传下载功能的方法_第1张图片钉钉电脑端屏蔽文件上传下载功能的方法_第2张图片

如果出现了,下面的画面,说明你的浏览器HTTP代理还没有配置好,同时,你要注意你的privoxy的主配置文件中,允许访问这个Web版后台,方法就是添加下面一行配置

钉钉电脑端屏蔽文件上传下载功能的方法_第3张图片

#  4.5. enable-edit-actions
#  =========================
#
#  Specifies:
#
#      Whether or not the web-based actions file editor may be used
#
#  Type of value:
#
#      0 or 1
#
#  Default value:
#
#      0
#
#  Effect if unset:
#
#      The web-based actions file editor is disabled.
#
#  Notes:
#
#      Access to the editor can not be controlled separately by
#      "ACLs" or HTTP authentication, so that everybody who can
#      access Privoxy (see "ACLs" and listen-address above) can
#      modify its configuration for all users.
#
#      This option is not recommended for environments with untrusted
#      users and as a lot of Privoxy users don't read documentation,
#      this feature is disabled by default.
#
#      Note that malicious client side code (e.g Java) is also
#      capable of using the actions editor and you shouldn't enable
#      this options unless you understand the consequences and are
#      sure your browser is configured correctly.
#
#      Note that you must have compiled Privoxy with support for this
#      feature, otherwise this option has no effect.
#
enable-edit-actions 1

然后我们选择user.action配置文件右边的Edit按钮就可以编辑,点View按钮就可以不登陆服务器就能看配置文件原文了

钉钉电脑端屏蔽文件上传下载功能的方法_第4张图片

在如图+block{Nasty ads.}模块中,我们点击Add按钮,分别将钉钉有关文件传输的域名输入,然后形成如上图的规则,这个规则既可以写域名,也可以写具体的URL,精确到某个文件,如gif,jpg,html,js等,功能非常强大

然后,后退至前一页面,点击View按钮,就可以看到这段规则的文本表示了。

 

{ +block{Nasty ads.} }
sh.trans.dingtalk.com
zjk.trans.dingtalk.com
lippi-space-sh.oss-accelerate.aliyuncs.com
www.example.com/nasty-ads/sponsor.gif

之后,在钉钉的代理设置中,我们设置这个代理服务器,就可以实现屏蔽文件传输的功能了。如下图。

钉钉电脑端屏蔽文件上传下载功能的方法_第5张图片

 

你可能感兴趣的:(钉钉电脑端屏蔽文件上传下载功能的方法)