FortiClient 连接问题
FortiClient 连接问题
本文介绍 SSL VPN 以特定百分比停止协商的常见错误原因与解决办法。
10% 断开连接
这种情况下 FortiClient 通常会弹出“Unable to establish the VPN connection. The VPN server may be unreachable.”的提示信息,通常是由于网络连接问题引起的。
请检查 FortiClient 到 FortiGate 的 SSL VPN 端口的网络联通性(不只是使用 Ping 测试,而是需要确保 FortiClient 和 FortiGate 之间 TCP 的 SSL VPN 端口是否正常连通,可以尝试使用客户端 telnet SSL VPN 服务器的 IP 和端口,或通过浏览器访问 SSL VPN 的 HTTPS 地址以确认联通性)。
检查 FortiClient 是否配置了正确的 SSL VPN IP 和端口号,并启用了 SSL VPN 功能。

检查 FortiGate 是否配置了服务器证书。
检查 FortiGate 是否配置了以
ssl.<vdom_name>为入接口的防火墙策略。检查 FortiGate 的 VIP 是否使用了 SSL VPN 的 IP/端口。
检查基于地理位置/源 IP 的限制设置,这些设置可能位于 SSL VPN 配置(参考“VPN 技术 → SSL VPN → SSL VPN 源地址连接控制”章节)或 local-in 策略配置(参考“策略与对象 → 本地流量策略 → Local-in 策略”章节)中。
如果在 FortiGate 之前还有其他路由/NAT 设备,请检查路由器的端口转发是否正确映射了 SSL VPN 的 IP/端口。
检查
ssl.<vdom_name>(如 ssl.root)接口是否为 down 状态,如果被认为关闭,请重新启用。config system interface edit "ssl.root" set vdom "root" set status up next end抓取 FortiClient 与 FortiGate 之间的 SSL VPN 报文
diagnose sniffer packet any ' host <source public IP address> and port <SSL VPN port> ' 4 0 l如果 FortiGate 响应了客户端请求,当 TCP 三次握手未完成或客户端在 TCP 三次握手完成后 reset 连接时,连接将终止,FortiClient 将显示连接在 10% 停止。
如果流量到达 FortiGate,但 FortiGate 未做出响应,可以使用 debug flow 来判断是否匹配了拒绝策略,或因未匹配任何允许策略而被隐式拒绝。
diagnose debug disable diagnose debug reset diagnose debug flow show iprope en diagnose debug flow show func en diagnose debug flow filter addr <source public ip addr> diagnose debug flow filter port <SSL VPN port> diagnose debug flow trace start 300 diagnose debug enable
31% 断开连接
通常 FortiClient 会弹出“Unable to establish the VPN connection. The VPN server may be unreachable or your identity certificate is not trusted. (-5029)”的提示信息。这是由于 TLS 版本协商失败导致,请检查 FortiGate 配置的 SSL VPN TLS 版本是否被 FortiClient 所在的 PC 使用。
检查 FortiGate 配置的 SSL VPN TLS 版本,如下所示,SSL VPN 使用的 TLS 版本最大为 1.3(ssl-max-proto-ver),最小为 1.2(ssl-min-proto-ver),也就是只接受 TLS 1.2 ~ 1.3 的版本(如果开启了 DTLS,需要参考 dtls-max-proto-ver 和 dtls-min-proto-ver):
FortiGate # config vpn ssl settings FortiGate (settings) # show full-configuration | grep proto set ssl-max-proto-ver tls1-3 set ssl-min-proto-ver tls1-2 set dtls-max-proto-ver dtls1-2 set dtls-min-proto-ver dtls1-0可以根据实际情况修改 FortiGate 的 TLS 设置:
FortiGate # config vpn ssl setting FortiGate (settings) # set ssl-max-proto-ver ? tls1-0 TLS version 1.0. tls1-1 TLS version 1.1. tls1-2 TLS version 1.2. tls1-3 TLS version 1.3. FortiGate (settings) # set ssl-min-proto-ver ? tls1-0 TLS version 1.0. tls1-1 TLS version 1.1. tls1-2 TLS version 1.2. tls1-3 TLS version 1.3.检查 FortiClient 所在 PC 的 TLS 版本设置,这里以 Windows 为例,打开“Internet 选项”,进入高级选项卡,在“安全”部分中找到 TLS 版本相关选项,如下图所示,选取的 TLS 版本为 1.2 和 1.3,可根据 FortiGate 端的配置进行修改。

40% 断开连接
可能是由于 FortiClient 在连接时弹出了是否希望继续使用非受信任的 TLS/SSL 证书的弹窗,但用户未选择或选择了取消(有时候这个弹窗没有弹出,需要在任务栏点开)。

与 31% 中断类似,FortiClient 会弹出“Unable to establish the VPN connection. The VPN server may be unreachable or your identity certificate is not trusted. (-5029)”的提示信息,这由 TLS 版本协商失败导致。可参考 31% 中断的解决方法。
可能是因为 SSL VPN 使用的服务器证书已过期。请更换服务器证书,或选择“Fortinet_Factory”证书作为 Workaround。
如果使用 SAML 认证,请确保从 IDP 下载了正确的证书,并将其导入到 SP(FortiGate)中。
如果出现“The VPN server may be unreachable. (-5)' errors”错误,可能是由于 FortiClient 所在 PC 安装的某些安全应用阻断了 FortiClient 与 FortiGate 的 SSL 协商,或是外部安全设备进行了阻断。
42% 或 43% 断开连接
通常是用户权限问题(sslvpn_login_permission_denied)。
对于本地用户,可能是用户名/密码输入错误。
对于远程用户,在
diagnose debug application sslvpn -1和diagnose debug application fnbamd -1调试中可能有以下错误:“find_matched_usr_grps - Failed group matching”。以下 debug 信息可用于验证用户是否属于正确的 LDAP 用户组,将用户添加到正确的组中可解决此问题。diagnose debug application sslvpn -1 diagnose debug application fnbamd -1 diagnose debug enable
45% 断开连接
对于本地用户,可能是用户名/密码输入错误。
对于远程认证(如 LDAP)用户,可能的原因包括:FortiGate 无法连接到远程服务器、远程服务器返回身份验证失败,或 LDAPS 的加密连接失败。举例:如果连接在 45% 停止并显示错误“ldap connection timeout”,可以尝试调整 LDAP 认证超时设置。
config system global set ldapconntimeout 3000 end远程认证也可以参考“48% 断开连接”中 SAML 认证相关的解决方法。
48% 断开连接
可能是由于
ssl.root(ssl.<vdom>)接口被手动禁用(admin down),但在config vpn ssl settings配置中set status enable,请检查 SSL VPN 接口和 SSL VPN 功能都处于开启状态。可能是由于双因子(two-factor)认证失败导致断开,检查双因子认证的配置与 Token 信息输入是否正确。
如果 FortiClient 弹出提示“Credential or SSL VPN configuration is wrong (-7200)”,在 FortiClient 连接过程中通过 Debug 信息来判断问题原因:
如果 Debug 信息中提示
error:0A000126:SSL routines::unexpected eof while reading。diagnose debug application sslvpn -1 diagnose debug application fnbamd -1 diagnose debug enable [2612:root:1b]deconstruct_session_id:716 decode session id ok, user=[guest], group=[],authserver=[],portal=[full-access],host[10.200.20.10],realm=[],csrf_token=[D3D4129C5AB9CB25CDCE01CCF8E40],idx=0,auth=1,sid=2d772154,login=1686904099,access=1686904099,saml_logout_url=no,pip=no,grp_info=[4xAcoJ],rmt_grp_info=[] [2612:root:1b]rmt_web_auth_info_parser_common:557 authentication required [2612:root:1b]rmt_web_access_check:776 access failed, uri=[/remote/logout],ret=4103, [2612:root:1b]SSL state:fatal decode error (10.200.20.10) [2612:root:0]ap_read,105, error=1, errno=0 ssl 0x7f3bb1bb6000 Success. error:0A000126:SSL routines::unexpected eof while reading //[2612:root:1b]sslvpn_read_request_common,684, ret=-1 error=-1, sconn=0x7f3bb2854800.// [2612:root:1b]Destroy sconn 0x7f3bb2854800, connSize=0. (root)首先确认 FortiClient 使用的用户名和密码完全正确。
也可能是由于 PC 的 Internet 选项中的安全等级设置为“高”导致,通过调整 Internet 选项中的安全等级为“中 - 高”或“中”可以修复此问题。

如果 Debug 信息中提示
failed [sslvpn_login_cert_checked_error]。diagnose debug application sslvpn -1 diagnose debug enable 2023-11-02 14:15:59 [11178:root:34]req: /remote/logincheck 2023-11-02 14:15:59 [11178:root:34]rmt_web_auth_info_parser_common:470 no session id in auth info 2023-11-02 14:15:59 [11178:root:34]rmt_web_access_check:723 access failed, uri=[/remote/logincheck],ret=4103, 2023-11-02 14:15:59 [11178:root:34]User Agent: FortiSSLVPN (Windows NT; SV1 [SV{v=02.01; f=07;}]) 2023-11-02 14:15:59 [11178:root:34]rmt_logincheck_cb_handler:1189 user 'test15' has a matched local entry. //2023-11-02 14:15:59 [11178:root:34]login_failed:384 user[test15],auth_type=32768 failed [sslvpn_login_cert_checked_error]// 2023-11-02 14:15:59 [11178:root:0]dump_one_blocklist:84 status=1;host=15.15.15.15;fails=1;logintime=1698730139这可能是由于误开启了 FortiGate SSL VPN 的“需要客户端证书”功能,而实际不需要证书认证客户端证书。需要手动关闭该功能。

config vpn ssl settings set reqclientcert disable end
如果 FortiGate 使用了 LDAP 作为 SSL VPN 认证,请参考用户与认证 → LDAP 认证 → LDAP 常见错误代码章节排查。
如果出现“Permission denied. (-455)”错误,检查用户是否包含在“SSL VPN 认证/门户配置”中的用户组中。
使用 SAML 认证时,FortiClient 会弹出登录窗口,此登录窗口存在远程认证超时时间。如果在此时间内没有完成认证(例如 SAML 认证同时开启了双因子认证,默认的计时器时间可能不够),FortiClient 将在 48% 时断开连接。
remoteauthtimeout默认为 5s,可通过以下 CLI 命令将其适当增加。config system global set remoteauthtimeout 120 <----FortiGate等待远程身份验证服务器响应的秒数,1~480s,默认5s end请注意
remoteauthtimeout的设置时间并非 SSL VPN 在关闭连接前实际等待的时间,实际等待时间 = 10 * remoteauthtimeout + 30s。如果同时开启了双因子认证,双因子认证也有一个认证超时时间
two-factor-email-expiry。config system global set two-factor-email-expiry 60 <----FortiGate等待双因子认证的超时秒数,30~300s,默认60s end在 SSL VPN 同时使用 SAML + 双因子认证时,SSL VPN 在关闭连接前实际等待的时间以 10 × remoteauthtimeout + 30s 为准。即使
two-factor-email-expiry更长。示例:如果将
two-factor-email-expiry设置为 240s,则remoteauthtimeout必须大于或等于 21s。 240 = 10 × remoteauthtimeout (21) + 30。对于使用 Azure SAML 的 SSL VPN 身份验证,
remoteauthtimeout时间将翻倍。例如,当设置为 30s 时,实际的等待时间将变为 30 × 2 × 10 + 30 = 630s 。
如果出现“Host check requirement error (-455)”错误。如果 SSL VPN 没有开启主机检查(host check),请检查防火墙是否发生了“sslvpnd”进程崩溃。
diagnose debug crashlog read检查 SSL VPN 是否开启了 MAC 地址检查,如果开启了 MAC 地址检查,请检查连接的 FortiClient 所在的 PC 的 MAC 地址是否在 FortiGate 配置的允许列表中。
config vpn ssl web portal edit <portal_name> set mac-addr-check enable config mac-addr-check-rule edit <rule_name> set mac-addr-list <address> [address] set mac-addr-mask <mask between 1-48> next end set mac-addr-action {allow | deny} next end
80% 断开连接
检查 FortiGate 的 SSL VPN 中用于匹配用户的门户(portal,如 full-aacess)是否开启了隧道模式(tunnel mode)。
如果弹出提示“Unable to log on to the server. Your username or password may not be configured properly for this connection. (-14)”,检查 FortiClient 输入的用户名和密码是否与 FortiGate 上配置的一致。
在 FortiGate 检查用户和用户组的关系,可能是用户未加入正确的用户组。
检查是否配置了对应用户/用户组的防火墙策略。
检查 FortiGate 中 SSL VPN 设置的“认证/门户配置(Authentication/Portal Mapping)”配置中的用户/用户组是否与防火墙策略中 SSL VPN 相关策略中引用的用户/用户组完全一致,如果不一致,FortiClient 会出现以下提示(英文系统下会提示“Unable to log on to the server. Your username or password may not be configured properly for this connection. (-14)”):

重要
- 如果 SSL VPN 设置的“认证/门户配置”选择了用户组,那么防火墙策略中也要引用用户组,不要引用该用户组中的用户成员。
- 如果 SSL VPN 设置的“认证/门户配置”选择了用户,那么防火墙策略中也要引用用户,不要引用该用户所属的用户组。
- 如果有多条 SSL VPN 相关的防火墙策略,无论策略的顺序如何,只要有策略中配置了“认证/门户配置”中不一致的用户/用户组,都可能导致这个问题的出现。
- 如果不按照上述规则配置,会出现 FortiClient 连接 SSL VPN 时,无法匹配自定义配置的“认证/门户配置(Authentication/Portal Mapping)”,而匹配到默认的 Portal Mapping 时:
- 如果默认的 Portal Mapping 为“web-access”(只开启了 Web 模式的访问,没有开启 Tunnel 模式的访问),那么就会连接失败。
- 即使默认的 Portal Mapping 选择了开启 Tunnel 模式的 Portal,FortiClient 可以成功连接 SSL VPN,但也有可能匹配到非用户预期的 Portal,所以还是要按照上述规则进行配置。

检查用户/用户组是否匹配了正确的门户(Portal)。
如果在 SSL VPN 设置中为用户/用户组配置了域(Realm),请检查 FortiClient 是否连接了正确的域(Realm)。
如果 FortiGate 上用户/用户组所属的门户(Portal)开启了 OS 版本检查,请确认客户端的 OS 类型与版本是否满足 FortiGate 上配置。

config vpn ssl web portal edit "full-access" set os-check enable config os-check-list "windows-7" set action deny end config os-check-list "windows-8.1" set action deny end config os-check-list "windows-10" end config os-check-list "windows-11" end config os-check-list "macos-mojave-10.14" end config os-check-list "macos-catalina-10.15" end config os-check-list "macos-bigsur-11" end config os-check-list "macos-monterey-12" end config os-check-list "macos-ventura-13" end next end如果 FortiGate 上用户/用户组所属的门户(Portal)开启了主机检查,请确认客户端的主机是否通过了 AV/防火墙/MAC 地址检查。

config vpn ssl web portal edit "full-access" set host-check av set mac-addr-check enable config mac-addr-check-rule edit "BingBai" set mac-addr-list 0c:37:96:06:d7:5d next end next endFortiGate 固件降级可能会导致 SSL - VPN 门户(portal)设置初始化,因此请尽量避免版本降级,或确认降级后 portal 配置是否保留。
89% 断开连接
在此阶段,FortiTray.exe 将尝试向位于
%localappdata%\FortiClient目录下的fortisslvpn_xml.txt文件写入数据。如果无法访问
%localappdata%\FortiClient,将显示错误代码-5052。如果
%localappdata%\FortiClient目录可访问,但无法修改fortisslvpn_xml.txt文件,会出现错误代码-5053。在 CMD 中运行如下命令可以显示为何
fortitray.exe无法写入fortisslvpn_xml.txt文件。notepad %localappdata%\FortiClient\fortisslvpn_xml.txt
98% 断开连接
此阶段断开连接标识身份验证已完成,但无法建立隧道。这种情况下通常是由于 FortiClient 所在主机的 OS 问题导致。
- 尝试在主机上重装 FortiClient 程序(先卸载现有 FortiClient 程序,根据提示信息重启后再重装)。
- 检查 FortiClient、FortiGate、EMS Server 之间的版本兼容性。请参考“VPN 技术 → FortiClient VPN → 系统兼容性列表”章节。
- 可能由网络问题引起,例如 IPv6 到 IPv4 的连接(不支持)、高网络延迟、被阻塞的流量。
其他百分比断开连接
请参考 FortiClient 维护手册。