SSL VPN with LDAP user authentication
This is a sample configuration of SSL VPN for LDAP users. In this example, the LDAP server is a Windows 2012 AD server. A user ldu1 is configured on Windows 2012 AD server.
You must have generated and exported a CA certificate from the AD server and then have imported it as an external CA certificate into the FortiGate.
Sample topology
Sample configuration
WAN interface is the interface connected to ISP. This example shows static mode. You can also use DHCP or PPPoE mode. The SSL VPN connection is established over the WAN interface.
To configure SSL VPN using the GUI:
-
Configure the interface and firewall address. The port1 interface connects to the internal network:
-
Go to Network > Interfaces and edit the wan1 interface.
-
Set IP/Network Mask to 172.20.120.123/255.255.255.0.
-
Edit port1 interface and set IP/Network Mask to 192.168.1.99/255.255.255.0.
-
Click OK.
-
Go to Policy & Objects > Address and create an address for internet subnet 192.168.1.0.
-
-
Import CA certificate into FortiGate:
-
Go to System > Features Visibility and ensure Certificates is enabled.
-
Go to System > Certificates and select Import > CA Certificate.
-
Select Local PC and then select the certificate file.
The CA certificate now appears in the list of External CA Certificates. In this example, it is called CA_Cert_1.
-
If you want, you can use CLI commands to rename the system-generated CA_Cert_1 to be more descriptive:
config vpn certificate ca rename CA_Cert_1 to LDAPS-CA end
-
-
Configure the LDAP user:
-
Go to User & Authentication > LDAP Servers and click Create New.
-
Specify Name and Server IP/Name.
-
Specify Common Name Identifier and Distinguished Name.
-
Set Bind Type to Regular.
-
Specify Username and Password.
-
Enable Secure Connection and set Protocol to LDAPS.
-
For Certificate, select LDAP server CA LDAPS-CA from the list.
-
-
Configure user group:
-
Go to User & Authentication > User Groups to create a user group.
-
Enter a Name.
-
In Remote Groups, click Add to add ldaps-server.
-
-
Configure SSL VPN web portal:
-
Go to VPN > SSL-VPN Portals to edit the full-access portal.
This portal supports both web and tunnel mode.
-
Disable Enable Split Tunneling so that all SSL VPN traffic goes through the FortiGate.
-
-
Configure SSL VPN settings:
-
Go to VPN > SSL-VPN Settings.
-
Select the Listen on Interface(s), in this example, wan1.
-
Set Listen on Port to 10443.
-
Set Server Certificate to the authentication certificate.
-
Under Authentication/Portal Mapping, set default Portal web-access for All Other Users/Groups.
-
Create new Authentication/Portal Mapping for group ldaps-group mapping portal full-access.
-
-
Configure SSL VPN firewall policy:
-
Go to Policy & Objects > Firewall Policy.
-
Fill in the firewall policy name, in this example, sslvpn certificate auth.
-
Incoming interface must be SSL-VPN tunnel interface(ssl.root).
-
Set the Source Address to all and Source User to ldaps-group.
-
Set the Outgoing Interface to the local network interface so that the remote user can access the internal network, in this example, port1.
-
Set Destination Address to the internal protected subnet 192.168.1.0.
-
Set Schedule to always, Service to ALL, and Action to Accept.
-
Enable NAT.
-
Configure any remaining firewall and security options as desired.
-
Click OK.
-
To configure SSL VPN using the CLI:
-
Configure the interface and firewall address:
config system interface edit "wan1" set vdom "root" set ip 172.20.120.123 255.255.255.0 next end
-
Configure internal interface and protected subnet, then connect the port1 interface to the internal network:
config system interface edit "port1" set vdom "root" set ip 192.168.1.99 255.255.255.0 next end
config firewall address edit "192.168.1.0" set subnet 192.168.1.0 255.255.255.0 next end
-
Import CA certificate into FortiGate:
-
Go to System > Features Visibility and ensure Certificates is enabled.
-
Go to System > Certificates and select Import > CA Certificate.
-
Select Local PC and then select the certificate file.
The CA certificate now appears in the list of External CA Certificates. In the example, it is called CA_Cert_1.
-
If you want, you can use CLI commands to rename the system-generated CA_Cert_1 to be more descriptive:
config vpn certificate ca rename CA_Cert_1 to LDAPS-CA end
-
-
Configure the LDAP server:
config user ldap edit "ldaps-server" set server "172.20.120.161" set cnid "cn" set dn "cn=Users,dc=qa,dc=fortinet,dc=com" set type regular set username "CN=Administrator,cn=users,DC=qa,DC=fortinet,DC=com" set password ********** set group-member-check group-object set secure ldaps set ca-cert "LDAPS-CA" set port 636 next end
-
Configure user group:
config user group edit "ldaps-group" set member "ldaps-server" next end
-
Configure SSL VPN web portal:
config vpn ssl web portal edit "full-access" set tunnel-mode enable set web-mode enable set ip-pools "SSLVPN_TUNNEL_ADDR1" set split-tunneling disable next end
-
Configure SSL VPN settings:
config vpn ssl settings set servercert "server_certificate" set tunnel-ip-pools "SSLVPN_TUNNEL_ADDR1" set source-interface "wan1" set source-address "all" set default-portal "web-access" config authentication-rule edit 1 set groups "ldaps-group" set portal "full-access" next end end
-
Configure one SSL VPN firewall policy to allow remote user to access the internal network:
config firewall policy edit 1 set name "sslvpn web mode access" set srcintf "ssl.root" set dstintf "port1" set srcaddr "all" set dstaddr "192.168.1.0" set groups “ldaps-group” set action accept set schedule "always" set service "ALL" set nat enable next end
To see the results of web portal:
-
From a remote device, use a web browser to log into the SSL VPN web portal http://172.20.120.123:10443.
-
Enter the ldu1 user credentials, then click Login.
-
Go to Dashboard > Network and expand the SSL-VPN widget to verify the user’s connection.
To see the results of tunnel connection:
-
Download FortiClient from www.forticlient.com.
-
Open the FortiClient Console and go to Remote Access > Configure VPN.
-
Add a new connection:
-
Set the connection name.
-
Set Remote Gateway to the IP of the listening FortiGate interface, in this example, 172.20.120.123.
-
Select Customize Port and set it to 10443.
-
-
Save your settings.
-
Log in using the ldu1 credentials.
To check the SSL VPN connection using the GUI:
- Go to Dashboard > Network and expand the SSL-VPN widget to verify the user’s connection.
- Go to Log & Report > System Events and select the VPN Events card to view the details of the SSL VPN connection event log.
- Go to Log & Report > Forward Traffic to view the details of the SSL VPN traffic.
To check the web portal login using the CLI:
# get vpn ssl monitor SSL VPN Login Users: Index User Auth Type Timeout From HTTP in/out HTTPS in/out 0 ldu1 1(1) 229 10.1.100.254 0/0 0/0 SSL VPN sessions: Index User Source IP Duration I/O Bytes Tunnel/Dest IP
To check the tunnel login using the CLI:
# get vpn ssl monitor SSL VPN Login Users: Index User Auth Type Timeout From HTTP in/out HTTPS in/out 0 ldu1 1(1) 291 10.1.100.254 0/0 0/0 SSL VPN sessions: Index User Source IP Duration I/O Bytes Tunnel/Dest IP 0 ldu1 10.1.100.254 9 22099/43228 10.212.134.200