WECOM AUTH · 企业微信认证
在 AC、核心交换机、BRAS、路由等设备已配置好 Portal 认证的基础上,通过企业微信自建应用授权即可完成网络准入实名认证,并可获取用户实名手机号码等信息。文中完整给出企业微信后台建应用与可信域名配置、OpenPortal 系统参数填写与扫码认证验证三段步骤,附 6 张配置截图。
STEP BY STEP / 从平台配置到上线
企业ID、AgentId、Secret 与可信 IP 请按企业微信后台的实际配置填写;页末另附企业微信免认证放行列表。
在企业园区网络中,需要结合企业微信实现网络安全准入实名认证,方案中企业网络设备可以是华为(如AC6005、AC6605、三层交换机)或者H3C新华三(WX2510H、WX3540H、WX2560H)或所有支持Portal协议、CMCC协议的任何网络设备。
网络设备结合OpenPortal认证计费系统做好Portal认证及Radius认证计费AAA对接、Mac快速认证、MAC-Trigger快速认证等无感知认证对接的基础上,做一下配置即可实现基于企业微信认证的网络准入实名认证方案。
如下图所示:
在Portal系统后台-【Portal管理】-【钉钉企微设置】中设置企业微信的相关配置
如下图所示:
企业微信认证的接入账户组名称配置如下图:
备注:如果不使用临时放行方案,或者需要用到 App 内部自建应用调取认证功能,需要在设备配置如下放行列表。
认证前必须放行 DNS 与下列域名,否则终端首次关联 SSID 后无法与企业微信服务器交互完成认证。企微认证页要同时走「网页授权(OAuth)+ JS-SDK + 静态资源」三条链路,静态资源分散在 wwcdn.weixin.qq.com / rescdn.qqmail.com / cdn-go.cn 三处,漏放时最常见的是「能跳转,但二维码不出来或按钮点了没反应」。
| 域名 | 用途 |
|---|---|
i.work.weixin.qq.com | 认证跳转 / 登录页 |
open.work.weixin.qq.com | 网页授权(OAuth) |
open.weixin.qq.com | 微信开放授权 |
qyapi.weixin.qq.com | 企业微信 API 接口 |
work.weixin.qq.com | 企业微信官网 / 管理后台 |
wwcdn.weixin.qq.com | 企业微信静态资源 CDN |
rescdn.qqmail.com | 图文 / 素材存储 CDN |
cdn-go.cn | 静态资源加速 |
report.url.cn | 数据上报 |
badjs.weixinbridge.com | 前端异常上报 |
aegis.qq.com | 前端监控 |
| 域名 | 用途 |
|---|---|
qy.weixin.qq.com | 企微管理后台(旧入口) |
js.aq.qq.com | 安全 JS 组件 |
login.work.weixin.qq.com | 登录子域 |
long.open.weixin.qq.com | 微信长连接(部分认证页依赖) |
szextshort.weixin.qq.com | 微信扩展接入(可选) |
企业微信公网 IP 不固定,优先按域名放行。若使用企业微信私有化部署版本,上表域名需整体替换为企业实际定制的私有化域名,照抄公版清单会全部失效。
华为 AC(V200R 系列)通过 free-rule-template 配置免认证规则,模板要绑定到 Portal 服务器模板,再在接口或无线服务模板下引用才生效。
system-view
free-rule-template name wecom_auth
free-rule 1 destination ip 114.114.114.114 mask 255.255.255.255
free-rule 2 destination ip 223.5.5.5 mask 255.255.255.255
free-rule 10 destination domain i.work.weixin.qq.com
free-rule 11 destination domain open.work.weixin.qq.com
free-rule 12 destination domain open.weixin.qq.com
free-rule 13 destination domain qyapi.weixin.qq.com
free-rule 14 destination domain work.weixin.qq.com
free-rule 15 destination domain wwcdn.weixin.qq.com
free-rule 16 destination domain rescdn.qqmail.com
free-rule 17 destination domain cdn-go.cn
free-rule 18 destination domain report.url.cn
free-rule 19 destination domain badjs.weixinbridge.com
free-rule 20 destination domain aegis.qq.com
free-rule 21 destination domain qy.weixin.qq.com
free-rule 22 destination domain js.aq.qq.com
free-rule 23 destination domain login.work.weixin.qq.com
free-rule 24 destination domain long.open.weixin.qq.com
quit
portal-server-template name wecom_portal
free-rule-template wecom_auth
quit
interface Vlan-interface100
portal wecom_portal
quit
work.weixin.qq.com 即可覆盖 i.work.weixin.qq.com / open.work.weixin.qq.com / login.work.weixin.qq.com,主域优先。open.weixin.qq.com、wwcdn.weixin.qq.com、rescdn.qqmail.com、cdn-go.cn 都不在 work.weixin.qq.com 主域内,必须逐条放行——这几条漏掉,最常见的就是「二维码不出来」。passthrough-domain name .work.weixin.qq.com id 1、passthrough-domain name .weixin.qq.com id 2,再在 acl 6000 下放行这两个透传域,最后 free-rule acl 6000;qqmail / cdn-go / qq.com 等域仍按域名逐条配置。portal apply web-server),以设备 ? 提示为准。H3C AC 在系统视图下用 portal free-rule 逐条配置免认证规则,再在接口或无线服务模板下引用 Portal 认证模板。
system-view
portal free-rule 1 destination udp 53
portal free-rule 2 destination tcp 53
portal free-rule 3 destination ip 114.114.114.114 32
portal free-rule 4 destination ip 223.5.5.5 32
portal free-rule 10 destination domain i.work.weixin.qq.com
portal free-rule 11 destination domain open.work.weixin.qq.com
portal free-rule 12 destination domain open.weixin.qq.com
portal free-rule 13 destination domain qyapi.weixin.qq.com
portal free-rule 14 destination domain work.weixin.qq.com
portal free-rule 15 destination domain wwcdn.weixin.qq.com
portal free-rule 16 destination domain rescdn.qqmail.com
portal free-rule 17 destination domain cdn-go.cn
portal free-rule 18 destination domain report.url.cn
portal free-rule 19 destination domain badjs.weixinbridge.com
portal free-rule 20 destination domain aegis.qq.com
portal free-rule 21 destination domain qy.weixin.qq.com
portal free-rule 22 destination domain js.aq.qq.com
portal free-rule 23 destination domain login.work.weixin.qq.com
portal free-rule 24 destination domain long.open.weixin.qq.com
quit
interface Vlan-interface100
portal apply profile wecom_portal
quit
portal free-rule rule-id destination domain domain-name,含义一致。work.weixin.qq.com 能正常解析并打开,说明 free-rule 已生效。wwcdn.weixin.qq.com、rescdn.qqmail.com、cdn-go.cn 未放行。本节依据华为官方文档《用户通过企业微信认证接入网络》整理;企业微信官方域名与 IP 全量列表见企业微信域名与 IP 查询入口,域名会随版本调整,以官方文档为准。
RELATED CASES / 相关对接案例