Monday, June 10, 2013

Fortinet: LDAP and IPSec


LDAP Integration and IPSec Configuration

Today I will be explaining the configuration of a FortiGate firewall so network engineers can integrate an LDAP server to a FortiGate device and authenticate users. In this example I will be using a Windows SBS Server and the FortiGate-40C (v5.0,build0179 (GA Patch 2))

First lets gather some information which will help with our configuration.

  • Server IP: 192.168.1.5
  • Server Name: SBS2011
  • Domain Admin (create admin just for FortiGate use): FGadmin
  • Password: Pass1234!

Make a new organizational unit and add all users that you want to authenticate plus the new admin account you created. We can always use an existing group, but make sure the new admin account is present.

Lets run a DNS Query to grab string need for our next step. On your server type the following command in CMD.

dsquery user -name FGadmin

In the following configuration you will drop the string CN=FGadmin,OU=Employees,DC=MyNet,DC=com 
into the set username setting

Lets start the configuration on the FortiGate-40C...

config user ldap
    edit "SBS2011"
        set server "192.168.1.5"
        set cnid "samAccountName"
        set dn "DC=MyNet,DC=com"
        set type regular
        set username "CN=FGadmin,OU=Employees,DC=MyNet,DC=com"
        set password Pass1234
    next
end

Lets test the user...

diag test auth ldap SBS2011 FGadmin Pass1234
authenticate 'FGadmin' against 'SBS2011' succeeded!
Group membership(s) - CN=VPNUsers,OU=Employees,DC=MyNet,DC=com
                                    CN=Domain Users,OU=Employees,DC=MyNet,DC=com

This shows that the Fortinet and the LDAP server are communicating properly. This also shows the groups that the user belongs to. The users should be in the same group as the administrator account.

When adding mutiple users it is easier to go through the GUI and add them. Login to your FortiGate. Navigate to Users, select black arrow next to Create New and select LDAP Users. Select the server you just configured and navigate through tree to the Organization Unit and select users. If users DO NOT show up then we need to make a minor change just for selecting users.

config user ldap
    edit "SBS2011"
        set server "192.168.1.5"
        set cnid "cn"
        set dn "DC=MyNet,DC=com"
        set type regular
        set username "CN=FGadmin,OU=Employees,DC=MyNet,DC=com"
        set password Pass1234
    next
end

Set cnid to cn instead of samAcountName. This option will show users in the tree. I would change this back after adding users so that users can log in with username instead of full name. Example: dlambert instead of Derek Lambert. After that we can add users to a user group. Lets call this group FortiClients.

To create the FortiClients group lets go to Users and Devices, Users, User Group, and click Create New. Name your group, add the users, and add remote authentication server; in this case you should be able to pick the server we created earlier (SBS2011).

We can also add users through the CLI. This is often used when users have a + sign next to their name. Usually some users will have ExchangeActiveSycnh or similar that prevents adding user through the GUI.

config user local
    edit "Derek Lambert"
        set type ldap
        set ldap-server SBS2011
    next
end

config user group
    edit "FortiClients:
        set member "Derek Lambert" "FGadmin"
    next
end

***When adding group members through CLI you must add them all in one single string or for future occasions you can copy the string to notepad add the new users then paste it back into the CLI***

Example:

set member "FGadmin" "Derek Lambert"

After setting members for your user group, here we are using FortiClients, then we can test user authentication through the FortiClient. If you have not setup the Interface VPN then we will need to do this now. Please see my blog on Fortinet: Interface IPsec VPN for Remote Users.

***Please view kb.fortinet.com or docs.fortinet.com since the blog for IPsec VPN for Remote Users has not been written yet.***

Download: http://www.forticlient.com/

If you want to only use the FortiClient with IPsec or SSL you are out of luck unless you can get your hands on, I believe, version 4.3 of the FortiClient. I was able to pull this version from both the FTP site for Fortinet and from the CD that comes with the FortiGate.

DNS Issues

Whenever I ran into DNS issues such as pinging by host name or connecting to mapped drives which have been mapped by host name the following has worked.

config user ldap
    edit "SBS2011"
        set server "192.168.1.5"
        set cnid "samAccountName"
        set dn "DC=MyNet,DC=com"
        set type regular
        set username "CN=FGadmin,OU=Employees,DC=MyNet,DC=com"
        set password Pass1234
    next
end

Change the server setting from the IP address to the host name of the server. Here we will changed "192.168.1.5" to "SBS2011". This is NOT the name of the user ldap setting but the actual name of the server. Here the user ldap and the server are sharing the same exact name.

OR

Make sure the Domain Administrator account, here it is FGadmin, and the user accounts are in the SAME domain user group on the server. We can test this by running the DNS Query on the server.



No comments:

Post a Comment