LDAP and Active Directory.
With LDAP sign-in, people use the username and password they already have in your directory. Farwing checks the password against the directory and takes their email, name and groups from it. It works with Microsoft Active Directory and with OpenLDAP.
You set up everything on the LDAP / Active Directory page: the domain controllers, the certificate to trust and, if needed, the IP address of a name this server cannot find. You do not edit the Compose file and you do not restart the server.
Before you start: what to ask your IT team
- The full names of the domain controllers, such as
dc01.corp.example.comanddc02.corp.example.com. - Whether to use LDAPS (port 636) or StartTLS (port 389).
- A service account that can read the directory, and its password.
- The search bases: where your people are, and where your groups are.
- The certificate of your company's certificate authority (CA), in a
.cer,.crtor.pemfile. See Your company's certificate authority. - Whether this server can reach the domain controllers on that port through the firewall.
Start from a ready-made set
Open Admin → User management → LDAP / Active Directory. Pick Active Directory or OpenLDAP to fill in the port, filters and attribute names for that kind of directory. You then add your own server address, accounts and search bases. These are the values each set fills in:
| Setting | Active Directory | OpenLDAP |
|---|---|---|
| Port and security | 636, LDAPS | 636, LDAPS |
| User filter | (&(objectClass=user)(sAMAccountName={username})) | (&(objectClass=inetOrgPerson)(uid={username})) |
| Username attribute | sAMAccountName | uid |
| Email attribute | mail | mail |
| Name attribute | displayName | cn |
| Group filter | (objectClass=group) | (objectClass=groupOfNames) |
| Member attribute | member | member |
| Nested groups | On | Off |
Connection settings
| Setting | What to enter |
|---|---|
| Domain controllers, in the order to try | The full name of each domain controller or LDAP server, such as dc01.corp.example.com. Enter the name only, with no ldaps:// and no path. Add :port to use a different port for one server. See Several domain controllers. |
| Port | Usually 636 for LDAPS and 389 for StartTLS. A server with its own :port uses that one. |
| Security | LDAPS or StartTLS. LDAPS is the default. See the warning below. |
| Sign-in button wording | What the sign-in page calls this method. It is company directory until you change it. It may be up to 40 characters. |
Your company's certificate authority
Most companies give their domain controllers certificates from their own certificate authority (CA), often Active Directory Certificate Services (AD CS). Public CAs do not issue certificates for internal names, so Farwing does not know your CA. It must trust your CA to make the encrypted connection. Until it does, Test connection stops at the Certificate step and says that Farwing does not trust the CA that issued the certificate.
Add the CA in the Trusted certificate authority section of the page, in one of two ways:
- Add a certificate. Choose the file from your IT team (
.pem,.crtor.cer, in PEM or DER form), or paste the PEM text. One file may hold several certificates, such as a root CA and an intermediate CA. - Get it from the directory. Farwing connects to a saved domain controller and shows the certificates it sends, from the server's own certificate up. Farwing does not sign in, does not send a password and trusts nothing at this step. The top-most CA is selected for you. Choose Continue, check the fingerprint, then choose Trust this certificate. Farwing runs Test connection again at once.
Many domain controllers do not send the root certificate. The page then says so. Ask your IT team for the root certificate, or trust the issuing CA that the server did send.
The change applies to the next test, sign-in and sync. You do not
restart the server. Farwing refuses a private key, an expired
certificate and a file that is not a certificate, and saves nothing in
that case. The trusted certificates are kept with the other directory
settings, so they are in every backup of /data, and
Forget these settings removes them. They are trusted
only for directory connections. Object storage, email and identity
providers do not use them. The audit log records each certificate added
or removed, with its subject and fingerprint.
Self-signed server certificates
Some small sites have no CA, and the domain controller has a self-signed certificate. Add that certificate in the same way. The page shows it as Trusted server certificate (not a CA). Farwing then accepts exactly that certificate. It still checks the name and the dates. A different certificate, or the same certificate on a server with another name, is refused. There is no option to skip the certificate check.
Getting the CA certificate on Windows
Use one of these three ways.
On the CA server, this command writes the CA's certificate to the file company-ca.cer:
certutil -ca.cert company-ca.cer
On any domain-joined PC, open the computer's certificate store with the command below. Go to Trusted Root Certification Authorities → Certificates. Right-click your company CA and choose All Tasks → Export. Choose Base-64 encoded X.509 (.CER).
certlm.msc
From any machine that can reach the domain controller, this command shows the certificates the server sends. Copy the CA certificate, with its BEGIN and END lines, into a file. The server may not send the root certificate, so this may show only the server certificate and an intermediate CA.
openssl s_client -connect dc01.corp.example.com:636 -showcerts </dev/null
Several domain controllers
Enter each domain controller in the list. Farwing tries them in the order of the list. If one does not answer or takes too long, Farwing tries the next. It remembers the last one that worked for one hour, and tries that one first. Sign-in, the hourly sync and Test connection all use the list. Test connection tests each domain controller and shows a result for each.
Enter names, not IP addresses. Certificates are issued for names, so the certificate check usually fails for an IP address. The page warns you if you type one. It works only if the certificate lists that IP address.
When Farwing cannot find the domain controller's name
Farwing must look up the domain controller's name to connect. A server in a cloud network may not use your company's DNS (Domain Name System), and then the name is unknown. Test connection then stops at the step Find the name. Fix it in one of these ways, in this order:
- Let the server use your company's DNS. This is the best fix, because new domain controllers then work without a change in Farwing.
- Use this IP address for this name. Open Advanced under the domain controller on the page and enter its IP address. Farwing connects to that IP address.
- Advanced: set it in Docker Compose. Use this when you manage name lookup for the whole host. A restart is necessary.
This example tells the container to use your company's DNS servers:
services:
farwing:
dns:
- 192.0.2.10
- 192.0.2.11
This example gives the container a fixed IP address for each name:
services:
farwing:
extra_hosts:
- "dc01.corp.example.com:192.0.2.3"
- "dc02.corp.example.com:192.0.2.4"
The service account
Farwing looks people up with a service account. Make a dedicated account that can only read the directory, and enter its full distinguished name and password:
CN=farwing-service,OU=Service Accounts,DC=example,DC=com
Farwing stores the password encrypted and never shows it again. The screen only tells you that one is saved. Some OpenLDAP servers allow searches without signing in. If yours does, leave the service account empty.
Where to find people and groups
| Setting | What it does |
|---|---|
| User search base | The part of the directory to search for people, such as OU=People,DC=example,DC=com. Required. |
| User filter | Finds one person. It must contain {username}, which Farwing replaces with the name typed at sign-in. |
| Group search base | The part of the directory to search for groups, such as OU=Groups,DC=example,DC=com. If you leave it empty, Farwing uses the user search base. |
| Group filter | Finds groups. If you leave it empty, Farwing does not look up groups. |
Attribute names
| Attribute | What Farwing reads it for |
|---|---|
| Username | The name people type at sign-in. Required. |
| The person's Farwing account. Required. | |
| Name | The name shown in the portal. Optional. |
| Member | The attribute on a group that lists its members. Needed when you look up groups. |
The ready-made sets above already hold the right names for Active Directory and OpenLDAP. Change them only if your directory uses different ones.
Groups
Group mapping turns directory groups into Farwing groups. Add one row for each: the directory group on the left and the Farwing group on the right. Farwing updates a person's groups at every sign-in.
The same table also decides who may sign in. There is no separate allow list: with Who can sign in set to Only people in a mapped group, being in any group on the left lets a person in. To let a group's members sign in without adding them to a Farwing group, choose No Farwing group (can sign in only) on the right of its row.
Next to each row, Farwing shows how many people it lets in, counted at the last sync.
Find a group
Type part of a group's name into Find a group.
Farwing searches the group search base with the service account and
shows up to 20 groups. Pick one and it fills in a row with the group's
full distinguished name (DN), such as
CN=Editors,OU=Studio,DC=corp,DC=example,DC=com, and shows
its friendly name under it.
A DN names exactly one group. A plain name such as Editors
matches every group with that name, wherever it sits in the directory,
so a group someone else creates with the same name would let its
members in too. Rows with plain names keep working. When a plain name
matches more than one group, the row warns: "More than one group is
called Editors. Pick the right one with Find a group."
Who can sign in
Who can sign in sits next to Create accounts on first sign-in and has two choices:
- Only people in a mapped group (recommended, and the default for a new setup). Someone in none of the groups on the left of the group map is refused with "You do not have access to Farwing. Ask your administrator to add you to a group that uses Farwing." No account is created. The audit log records
auth.directory.refusedwith the reason "not in a mapped group". - Anyone your directory accepts. Everyone with a working directory password can sign in, and with Create accounts on first sign-in on, gets an account. A setup from before this choice existed stays on this, so an upgrade locks nobody out, and the page recommends the change.
With Only people in a mapped group, the group map must have at least one row. Farwing will not save an empty one, because nobody could sign in.
When you switch an existing setup to Only people in a mapped group, Farwing first lists the accounts that would lose access. They are disabled only after you confirm. Someone who later leaves every mapped group is disabled at the next sync and refused at their next sign-in. Accounts are disabled, never deleted. Local accounts, which sign in with a Farwing password, and the break-glass administrator are never affected.
Turn on Email me when someone signs in for the first time to have every administrator emailed when a directory sign-in creates a new account. It is off by default.
Nested groups in Active Directory
In Active Directory, groups can sit inside other groups. Turn on Nested groups and Farwing asks Active Directory for every group a person belongs to, including the groups that contain their groups. It uses Active Directory's built-in "member of, including nested groups" search. Only Active Directory understands it, so the OpenLDAP set leaves it off.
Test it
Two buttons check your settings before anyone relies on them.
| Button | What it proves |
|---|---|
| Test connection | Farwing can reach the directory, set up the encrypted connection, sign in with the service account and search. It does not involve any person's password. |
| Test a login | One real person can sign in. Enter that person's username and password. Farwing shows whether the sign-in worked, the email and name it found, and which groups were found, including which Farwing groups they map to. It also says Would be allowed or Would be refused: not in a mapped group. It proves the user filter, the attribute names and the group settings together. |
Run Test a login with an ordinary person and with someone who is in a group you map. If the groups come back wrong, check the group search base, the group filter and, in Active Directory, the nested groups switch.
Test connection results explained
Test connection shows each step for each domain controller, with ✓ or ✗ and what Farwing found. It stops at the first step that fails, and says what to do. Copy details copies all steps, to paste into a support message.
| Step | On success, for example | When it fails |
|---|---|---|
| Find the name | dc01.corp.example.com is 192.0.2.3 | This server cannot look up the name. Check the spelling. If the name only works inside your company network, see When Farwing cannot find the domain controller's name. |
| Reach the port | Port 636 answered | The port did not answer within 10 seconds. A firewall may block it, or the directory does not offer this kind of connection on this port. Ask your network team to let this server reach the domain controller on that port. |
| Encrypted connection | TLS 1.3 | The port answered, but not as expected. A plain LDAP port used for LDAPS says: use StartTLS on port 389, or check the port. An LDAPS port used for StartTLS says: choose LDAPS for this port. |
| Certificate | Issued to dc01.corp.example.com by Corp Issuing CA, valid until 3 May 2027 | The step names the cause. Unknown issuer: Farwing does not trust the CA, and a Trust this certificate authority button opens the helper. See Your company's certificate authority. Name mismatch: the certificate lists the names it is for; enter one of them as the domain controller. Expired or not yet valid: the step gives the dates; ask your IT team to renew the certificate. |
| Service account | Signed in as CN=farwing-svc,… | The directory refused the service account's name or password. |
| Find people | Found 412 people under DC=corp,DC=example,DC=com | The search found nobody. Check the user search base and the user filter. |
| Find groups | Found 37 groups; 3 match your group mapping | Check the group search base and the group filter. |
The hourly sync
When the sync is on, Farwing checks the directory every hour. It disables Farwing users who were removed or disabled in the directory. A disabled user can no longer sign in.
Farwing never deletes these users. Their files and their history stay on the server, so you can still see who sent and received what.
Certificate expiry warnings
Every day Farwing records when each domain controller's certificate expires, and when each trusted certificate expires. From 30 days before a certificate expires, Farwing shows a warning on the LDAP / Active Directory page and in the administrator notices. It also sends the administrator notification email, once a week. When the certificate expires, directory sign-in stops working, so ask your IT team to renew it before then. If a trusted CA is the one that expires, add the new CA certificate on the page before the old one expires.
Advanced: trust for the whole server
If you manage trust for the whole host, you can give the container a
file of CA certificates with SSL_CERT_FILE, or a folder of
them with SSL_CERT_DIR. These add to the built-in list of
public CAs. They do not replace it. Farwing reads them when it starts,
so a restart is necessary after a change. The certificates on the page
do not need a restart. The page shows a line such as
Also trusted: certificates from SSL_CERT_FILE
(/data/ldap/company-ca.pem) under Advanced, so you
can see where the trust comes from.
This example tells Farwing to also trust the certificates in /data/ldap/company-ca.pem:
services:
farwing:
environment:
SSL_CERT_FILE: /data/ldap/company-ca.pem
Searching a whole forest
In a forest with several domains, the Global Catalog finds people in
every domain. Use port 3269 with LDAPS. The Global Catalog holds only
some attributes, so check that mail and
memberOf are included before you use it.
If LDAP sign-in stops working
The local administrator must have a password and an authenticator app. Farwing shows a warning while it has no authenticator. Set one up before you turn LDAP sign-in on.
To get back in:
- Open your Farwing server's normal sign-in page.
- Type the local administrator's email and password into the form, and choose Sign in. Do not use the button for the directory.
- Enter the 6-digit code from the authenticator app. If you no longer have the app, choose Use a recovery code instead and enter a code you saved when you set it up. Or ask another administrator to reset your second factor.
- Open Admin → User management → LDAP / Active Directory. Correct the setting, or turn the directory sign-in off, and save.
- Run Test a login before you close the administrator session.
Admin → Security & audit → Audit log records every directory sign-in, every failure and every change to these settings.