Connect a Generic LDAP Server to Sophos Firewall
With the LDAP server server type, Sophos Firewall authenticates users from OpenLDAP, 389 Directory Server, FreeIPA, Google Secure LDAP, and other LDAP directories. The complete process has four parts: create a local group, connect the LDAP server securely, enable the server under Authentication > Services, and verify the login and group assignment with a real user.
For Windows Active Directory with LDAPS, group import, or AD SSO, Connect Active Directory to Sophos Firewall is a better fit. RADIUS through Microsoft NPS or an MFA gateway is covered in Set up a RADIUS server on Sophos Firewall.
If the native eDirectory server type must be replaced before SFOS 23, Migrate eDirectory before SFOS 23 provides the complete process for inventory, target selection, parallel operation and rollback.
Prerequisites
- WebAdmin access to Sophos Firewall
- reachability of the LDAP server from the firewall, usually over port
389for STARTTLS or636for SSL/TLS - a bind account with read access to the required directory scope
- the Bind DN and Base DN, for example
cn=svc-sophos,ou=service,dc=example,dc=netandou=people,dc=example,dc=net - the user attributes actually used, such as
uid,cn,mail, and a group attribute - the correct CA trust chain and working DNS resolution when certificate validation is enabled
⚠️ A bind account should have read access only to the required subtree. It is not used for administrative changes in the directory, but only to authenticate the firewall’s user queries to the LDAP server.
Add the LDAP server
Prepare the local LDAP group
- Open
Authentication > Groupsand selectAdd. - Create a clearly named group, for example
LDAP-Users. - Set access, time quotas, and other group policies to suit the intended use, then save.
This group is later used as the Default group. It does not automatically prevent access: the policies assigned to the group and the rules of the relevant service determine what is allowed.
The general group logic with a restrictive Default Group, user overrides, pilot, and rollback is described in Manage Sophos Firewall user groups safely; the LDAP-specific assignment then follows from the group attribute and directory schema.
Configure the connection and bind
- Open
Authentication > Serversand selectAdd. - Select
LDAP serveras theServer type. - Enter a clear
Server name, for exampleLDAP-Company. - Under
Server IP/domain, enter the LDAP server’s DNS name. When certificate validation is active, it must match a name in the server certificate. - Use
Version 3unless the directory requires another version. Google Secure LDAP supports version 3 only. - For production use, select
SSL/TLSorSTARTTLSand the corresponding port. - Disable
Anonymous loginand enter the read account’sBind DNandPassword. - Enable
Append base DNonly if the LDAP server expects the Base DN to be appended during the bind. - Enable
Validate server certificateonce the name, DNS, and CA trust are configured correctly. AClient certificateis required only if the LDAP service requires mutual certificate authentication.
Enter the search base and attributes
- Under
Base DN, enter the starting point for the user search, for exampleou=people,dc=example,dc=net.Get base DNcan retrieve the search base offered by the server. - Set
Authentication attributeto the login attribute, commonlyuidormail. - Enter
Display name attributeandEmail address attributeto match the user object, for examplecnandmail. - Under
Group name attribute, enter the attribute from which the firewall receives the user’s group information. Sophos recommendsmemberOf, but the correct value depends on the directory schema. - If the directory provides an account expiry date, enter the appropriate
Expiry date attribute. - Run
Test connectionand save withSave.
According to Sophos, Test connection verifies the connection and credentials. Only a real login shows whether the Base DN includes all required users and whether groups are assigned correctly.
Choose the right encryption
Plaintext LDAP transmits credentials without encryption and is suitable only for an isolated test at most. In production, protect the connection with SSL/TLS, usually on port 636, or STARTTLS, usually on port 389.
Two certificate roles must be distinguished:
Validate server certificateverifies the identity of the remote LDAP server.Server IP/domainmust match a valid DNS name in the certificate, either the Common Name or a Subject Alternative Name. If the firewall cannot resolve this name, add a suitable DNS entry underNetwork > DNS > DNS host entry. Configure and test DNS host entries on Sophos Firewall explains TTL, reverse lookup, and resolver testing. The issuing CA must also be trusted.Client certificateidentifies the firewall to an LDAP service that requires mutual certificate authentication. This certificate does not replace validation of the server certificate.
For a TLS error, first correct the server name, DNS resolution, validity, and CA chain. Disabling server certificate validation should not be the default solution.
Enter the Bind DN and Base DN correctly
The most common source of errors with a new LDAP server is incorrectly written or misunderstood DN syntax.
- A DN runs from the specific object to the directory root, for example
cn=svc-sophos,ou=service,dc=example,dc=net. - The Base DN starts where the user search should begin. If users are stored in multiple organizational units, it must be high enough in the tree to include them.
- A Base DN that is too narrow returns no matching users even though the server is reachable. An unnecessarily broad search base can slow searches and include unwanted objects.
Append base DNappends the Base DN to an incomplete Bind DN during the bind. With an already complete DN, the option normally remains disabled; the LDAP server’s behavior is authoritative.
Enable groups and services
Group name attribute is not a universal switch for every LDAP group structure. At login, the firewall reads the configured attribute from the user object and uses the returned group information for assignment. Sophos recommends memberOf, and Google Secure LDAP uses this value. Depending on the schema, overlay, and user object, OpenLDAP, 389-ds, or FreeIPA may require a different value.
Do not infer the user attribute solely from the groupOfNames or posixGroup group type. What matters is what the real user object actually returns and whether the corresponding group is mapped correctly on the firewall. If the firewall finds no matching group assignment, the user is placed in the configured Default group.
Then enable the server:
- Open
Authentication > Services. - Under
Firewall authentication methods, select the LDAP server and move it to the desired position inSelected authentication servers. The firewall queries multiple servers in this order. - Select the previously created
LDAP-Usersgroup as theDefault groupand clickApply. - If users need to sign in to the User Portal, VPN Portal, SSL VPN, another VPN service, or as administrators, also select the LDAP server under the relevant authentication method.
Set up Google Secure LDAP
Before configuring the firewall, create an LDAP client in the Google Admin console. Define its access permissions, download the certificate with its private key, and generate separate credentials. The password is not displayed again after the Google dialog is closed.
Import the Google client certificate with its certificate and private key under Certificates > Certificates > Add. Sophos Firewall may display it as untrusted because it is self-signed by Google, but it still works for client authentication. This status does not concern validation of the server certificate.
Use these values for the LDAP server:
Server IP/domain:ldap.google.comVersion:3Connection security:SSL/TLSPort:636Anonymous login: offBind DNandPassword: the generated Google LDAP credentialsAppend base DN: offClient certificate: the imported Google certificateBase DN: enter it or retrieve it withGet base DNAuthentication attribute:UIDDisplay name attribute:CNEmail address attribute:mailGroup name attribute:memberOfExpiry date attribute:expiry
mail is required when creating Google LDAP groups. After saving, follow the same steps as for a local directory: set the local LDAP group, enable the server under Authentication > Services, and test a real login and its group assignment.
Verify the connection and group assignment
A reliable acceptance test covers several levels:
Test connectionconfirms the connection and bind credentials.- A user signs in to the intended service, such as the VPN Portal or Captive Portal.
- Under
Authentication > Users, verify that the user and group appear as expected. - If multiple LDAP groups are used, test at least one user from each relevant group. A policy or test rule confirms that both the login and the relevant group authorization work.
- An incorrect password is rejected, and the
Log viewershows a comprehensible authentication error.
If the schema is unclear, an administrator can inspect the user object read-only from a Linux administration system or the LDAP server:
ldapsearch -LLL -x -H ldaps://ldap.example.net:636 \
-D 'cn=svc-sophos,ou=service,dc=example,dc=net' -W \
-b 'ou=people,dc=example,dc=net' \
'(uid=max.muster)' '*' '+'
-W prompts for the bind password interactively so it is not stored in the shell history. '*' displays regular attributes and '+' operational attributes; adjust the search filter accordingly when a different login attribute is used. Do not run this command in the Sophos Firewall Advanced Shell. What matters is whether the user object actually returns the expected attributes and group values. The output may contain personal directory data and must be anonymized before it is attached to a ticket or shared.
Common errors
- No connection: Check routing, DNS, port, and
Connection security. Then verify the Bind DN, password, andAnonymous login. - TLS or certificate error: Check DNS names in the server certificate, DNS resolution, validity, and the CA chain. Do not disable server certificate validation as the first measure.
- Test connection works, but the user is not found: The Base DN is often too narrow, or
Authentication attributedoes not match the login name. - Login works, but the user is placed in the Default group: Check
Group name attributeon the real user object, local group mapping, and group order.memberOfis a common example, but it is not guaranteed for every schema. - Google Secure LDAP does not bind: Check version 3, port 636, disabled
Anonymous login, disabledAppend base DN, credentials, and the Google client certificate. - The server is configured but not used: Check the assignment, order, and
Default groupunderAuthentication > Services. - Searches are slow or return unwanted accounts: Narrow the Base DN to the required subtree.
- Another authentication server responds first: Correct the order of the selected servers for the affected service.