This is a small guide on how to configure Netgate's pfSense firewall to use the FreeIPA LDAP service.
The first step is to create a user group in FreeIPA to manage which user can access the pfSense admin interface. You will be able to create some others groups later if you need to get different profiles on the pfSense admin interface (full admin, vpn admin, etc...).
- On your FreeIPA admin, go to the user group managment page : Identity >> Groups.
- Click on the + Add button on the to right corner to access the group creation wizard.
- Fill the fields of the wizard :
- Group name : some_name.
- Description : A description of the purpose of the group.
- Groupe type : Non-POSIX (this group will only be used for web apps).
- Click on the Add button to create the user group.
Then, you will need to add one use to the group to perform configuration test later. To add the user , go to the user management page : Identity >> User.
- Select you user by click on its user login.
- Go to the User Groups (x) tab.
- Click the + Add button.
- Select the wanted group and click on the right arrow.
- Click the Add button and done!
The use of LDAPS is highly recommended when dealing with authentication request. Two action are needed to set up this secure connexion between your two system :
- an authenticated resquest to the FreeIPA server
- a secure transport of the request
To prevent anonymous (non authenticated) LDAP request to your FreeIPA server, you need to edit the directory config itself :
- Open your FreeIPA server console with the root account.
- Create a folder to store your config files and create a new file:
$: mkdir /root/freeipa_config $: cd /root/freeipa_config $: nano prevent_anonymous_bind.ldif
- Type the following content in the file and save it:
dc: cn=config changetype: modify replace: nsslapd-allow-anonymous-access nsslapd-allow-anonymous-access: off
- Modify the directory server using the Directory Manager profile and secret :
The "XXXXXX-XX" correspond to your DC name in upper case.
$: ldapmodify -x -D "cn=Directory Manager" -w "<secret_goes_here>" -f prevent_anonymous_bind.ldif $: systemctl restart dirsrv@XXXXXX-XX
Then, you need to extract your main Certification Authority certificate to add your CA to the pfSense firewall.
Access the FreeIPA Certificate manager : Authentication >> Certificate and perform the following tasks :
- Click on the Serial Number of the certificate with the subject " CN=Certificate Authority,O=XXXXX.XX"
- Click on the Action button then on Download
Go to the CA manager dashboard : System >> Certificate Manager >> CAs then :
- Click the + Add green button
- Add a meaningful description to your CA.
- Select the method : Import an existing Certificate Authority.
- Copy / Paste the content of the downloaded .pem fin in the Certificate data text area.
- Click the Save blue button.
Go to the Authentication server dashboard : System >> User Manager >> Authentication Servers then :
- Click the + Add green button
- Fill each field as follow :
- Descriptive name : A description of the server
- Type : LDAP
- Hostname or IP address : ipa_hostname.tld
- Port value : 636
- Transport : SSL - Encrypted
- Peer Certificate Authority : The one you've imported
- Protocol version: 3
- Server Timeout : 25
- Search scope : Entire Subtree (mandatory)
- Base DN : dc=XXXXX,dc=XX => replace with your own domaine info
- Authentication containers : cn=users,cn=accounts
- Extended query : Ticked
- Query : &(memberOf=cn=GGGG,cn=groups,cn=accounts,dc=XXXXXX,dc=XX) => replace GGGG with the group name & XXXXXX XX with your domaine values
- Bind anonymous : Unticked
- Bind credentials :
- Field 1 : uid=UUUU,cn=users,cn=accounts,dc=XXXXXX,dc=XX => test with the admin account, a proper service account shall be setup later
- Field 2 : account's password
- User naming attribute: uid
- Group naming attribute: cn
- Group member attribute: memberOf
- RFC 2307 Groups : Unticked
- Group Object Class : groupofnames
- UTF8 Encode : Ticked
- Username Alterations : Unticked
- Click on the Save blue button.
Go to the Authentication server diagnostic tool : Diagnostics >> Authentication then :
- Select the Authentication Server you've juste created.
- Add known working credentials
- Press the Test blue button
If everythings works properly, a green box with the user's groups should appear. Otherwise, you have a configuration issue which can be :
- improper configuration of the FreeIPA server :
- The LDPS server is not enabled, try to revert to LDAP instead
- There is a Firewall blockage (server side or pfsense side)
- The ports are not the standard ones
- improper configuration of the pfSense authentication server
- wrong base DB / Query
- wrong Group Object Class, set it to posixGroup if you've created a POSIX group on FreeIPA
- wrong bind credentials
- wrong DNS config
- And a lot more
Go to the Groups manager dashboard : System >> User Manager >> Groups then :
- Click the + Add green button
- Fill each field as follow :
- Group name : The same name as the one you've created in FreeIPA
- Scope : Remote
- Description : A description on the purpose of the group + precising the fact that the group is mapped from FreeIPA
- Group membership : Keep the Members field empty
- Assigned Privileges : Add the desiered privileges to the group
- Click on the Save blue button.
Go to the Groups manager dashboard : System >> User Manager >> Groups then :
- Fill each field as follow :
- Session timeout : 30 (set it to 30 mins of inactivity before login out)
- Authentication Server: Your brand new LDAP authentication Server -Auth Refresh Time: Leave it empty
- Click on the Save blue button.
You can now safely disconnect from your pfSense firewall and try your LDAP authentication method.
In case the the remote auth doesn't work, the local accounts will still work.
Thanks for your reply!!!