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 维护手册。