Technical Tip: LDAP authentication with password containing special characters
Description
This article describes the solutions when users are authenticated via LDAP and where passwords contain special characters.
Scope
FortiGate, SSL VPN, LDAP Authentication.
Solution
Context: Firewall authentication is used to allow access to the Internet and users are authenticated via LDAP. Authentication may be seen to fail where special characters (é, à , è, ...) are used in the password.
The root cause is that the FortiOS authentication daemon (used for LDAP) retrieves the password from the browser request and inserts it in the LDAP query without modification. Consequently, the encoding of the page is important.
Active Directory expects Unicode encoding. The customer's browsers are likely to be configured with ISO encoding which causes the issue.
On older versions of the FortiOS, the Solution would be as follows:
A new parameter to force the UTF-8 encoding for the login page was introduced on the older versions: UTF-8 will be used regardless of language setting of the Replacement message.
Enable the parameter as follows:
config vpn ssl setting
   set force-utf8-login enable
end
The solution is to force Unicode encoding, this can be done on the browser itself as a default setting. However, the best approach is to insert this HTML meta tag in the login page:
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
...
</head>
Inserting this tag in login page ('replacement messages') fixes the issue.
This will apply for the following:
SSL VPN: Replacement for the SSL VPN login message.
Authentication: Replacement for authentication pages.
Additional note: The steps and commands explained in this article are no longer valid for the newer versions of the FortiOS.
The available options under SSL VPN configuration on v7.6.7 are:
config vpn ssl settings
set ?
status Enable/disable Agentless VPN.
reqclientcert Enable/disable to require client certificates for all Agentless VPN users.
ssl-max-proto-ver SSL maximum protocol version.
ssl-min-proto-ver SSL minimum protocol version.
banned-cipher Select one or more cipher technologies that cannot be used in Agentless VPN negotiations. Only applies to TLS 1.2 and below.
ciphersuite Select one or more TLS 1.3 ciphersuites to enable. Does not affect ciphers in TLS 1.2 and below. At least one must be enabled. To disable all, set ssl-max-proto-ver to tls1-2 or below.
ssl-insert-empty-fragment Enable/disable insertion of empty fragment.
https-redirect Enable/disable redirect of port 80 to Agentless VPN port.
x-content-type-options Add HTTP X-Content-Type-Options header.
ssl-client-renegotiation Enable/disable to allow client renegotiation by the server if the tunnel goes down.
force-two-factor-auth Enable/disable only PKI users with two-factor authentication for Agentless VPNs.
servercert Name of the server certificate to be used for Agentless VPNs.
algorithm Force the Agentless VPN security level. High allows only high. Medium allows medium and high. Low allows any.
tls-groups Configure the supported groups for TLS negotiation.
idle-timeout Agentless VPN disconnects if idle for specified time in seconds.
auth-timeout Agentless VPN authentication timeout (1 - 259200 sec (3 days), 0 for no timeout).
login-attempt-limit Agentless VPN maximum login attempt times before block (0 - 10, default = 2, 0 = no limit).
login-block-time Time for which a user is blocked from logging in after too many failed login attempts (0 - 86400 sec, default = 60).
login-timeout Agentless VPN maximum login timeout (10 - 180 sec, default = 30).
dns-suffix DNS suffix used for Agentless VPN clients.
url-obscuration Enable/disable to obscure the host name of the URL of the web browser display.
http-compression Enable/disable to allow HTTP compression over Agentless VPN connections.
http-only-cookie Enable/disable Agentless VPN support for HttpOnly cookies.
port Agentless VPN access port (1 - 65535).
port-precedence Enable/disable, Enable means that if Agentless VPN connections are allowed on an interface admin GUI connections are blocked on that interface.
header-x-forwarded-for Forward the same, add, or remove HTTP header.
source-interface Agentless VPN source interface of incoming traffic.
source-address Source address of incoming traffic.
source-address-negate Enable/disable negated source address match.
source-address6 IPv6 source address of incoming traffic.
source-address6-negate Enable/disable negated source IPv6 address match.
default-portal Default Agentless VPN portal.
browser-language-detection Enable/disable overriding the configured system language based on the preferred language of the browser.
check-referer Enable/disable verification of referer field in HTTP request header.
http-request-header-timeout Agentless VPN session is disconnected if an HTTP request header is not received within this time (1 - 60 sec, default = 20).
http-request-body-timeout Agentless VPN session is disconnected if an HTTP request body is not received within this time (1 - 60 sec, default = 20).
auth-session-check-source-ip Enable/disable checking of source IP for authentication session.
hsts-include-subdomains Add HSTS includeSubDomains response header.
transform-backward-slashes Transform backward slashes to forward slashes in URLs.
encode-2f-sequence Encode \2F sequence to forward slash in URLs.
encrypt-and-store-password Encrypt and store user passwords for Agentless VPN web sessions.
client-sigalgs Set signature algorithms related to client authentication. Affects TLS version <= 1.2 only.
dual-stack-mode Agentless web mode: support IPv4 and IPv6 bookmarks in the portal.
server-hostname Server hostname for HTTPS. When set, will be used for Agentless VPN web proxy host header for any redirection.
remote-https-cert-check Configure how the FortiGate unit checks and responds to the remote HTTPS server's certificate (default = warn-on-error).