Introduction
As each department adds its own file servers, nobody can tell any more where a given document is stored. Windows search works only within a single shared folder, so it cannot search across several servers. The full-text search built into a NAS cannot span devices either.
One way to solve this problem is to set up a full-text search server dedicated to your file servers. This page summarizes the points you should check before adopting Fess, an open source full-text search server, to search file servers. The content is based on Fess 15.9.
Target Audience
Those who struggle to search internal file servers and NAS devices
Those considering full-text search who want to know whether it can be done with open source
Those who want to introduce search without breaking existing access permissions
Fess is released under the Apache License 2.0 and can be used without license fees.
Where Files Can Be Searched
File crawling in Fess supports the following protocols. In the admin console, go to [Crawler] > [File System] and enter the location where crawling starts in “Paths”.
The protocols handled by Fess itself are determined by the crawler.file.protocols setting, whose default in 15.9 is file,smb,smb1,ftp. In 15.9, s3 and gcs were moved out of Fess itself into plugins. Both plugins are bundled in the Docker image, but on Fess installed from the ZIP or RPM/DEB packages, install them from [System] > [Plugin] and restart Fess before using them.
To search Windows file shares, use smb. Unless you configure otherwise on the Fess side, smb negotiates the connection version with the server in the range from SMB1 to SMB 3.1.1. smb1 connects through a different implementation (the legacy jcifs) and is not something to choose for a new setup.
Carrying Over Existing Access Permissions
When you add search to file servers, the biggest concern is “documents that should not be visible showing up in search results”. If HR or accounting shared folders appear in every employee’s search results, the search system itself becomes unusable.
Fess solves this by bringing the file server’s access permissions into search. However, a newly created crawl configuration does not filter results by permissions as is. Be sure to check the mechanism below and the next section, “Removing {role}guest from Permissions”.
How It Works
During crawling, Fess reads the ACL (access control list) of each file
It records the accounts and groups allowed to read the file, and the accounts and groups denied, as “roles” of that document in the
rolefieldThe values written in “Permissions” of the crawl configuration are added to the same
rolefieldAt search time, Fess matches these against the roles of the logged-in user and returns only the documents the user is authorized to see
In the role field, users are recorded with 1 and groups with 2 prefixed to the name (for example, 1taro and 2sales). Deny entries are additionally prefixed with D (for example, D2contractors). A value written as {role}guest in “Permissions” is recorded as Rguest. The (allow) and (deny) you see in the admin console are notations for entering values in “Permissions”, not values that get recorded.
Extracting roles from ACLs is enabled by default.
Removing {role}guest from Permissions
When you create a new configuration under [Crawler] > [File System], “Permissions” is prefilled with {role}guest. If you save it as is, every document gets Rguest alongside the roles taken from its ACL. Because users who are not logged in are given the guest role, files restricted by ACLs are all shown in searches by users who are not logged in.
To make ACL-based filtering take effect, delete {role}guest from “Permissions” in the crawl configuration and save it. Documents that have already been crawled are registered again with the new permissions on the next crawl.
Logged-in users are not given the guest role. So even if {role}guest remains, logged-in users get results that follow the ACLs. As shown in “Verifying the Behavior”, always check while not logged in as well.
Matching the Names on the Login Side
For this mechanism to work end to end, the users who search must also have the same roles. The document side records “members of this group can read it”, so the match cannot be made unless the searching user can tell Fess which groups they belong to.
For this reason, permission-aware search requires integration with Active Directory or LDAP. The setup uses the same directory for logging in to Fess that the file servers use for authentication. LDAP is configured under [System] > [General]. The procedure and how to think about roles are explained in Controlling Search Results with Roles and Groups.
Because matching is done on name strings, keep the following in mind.
Names taken from ACLs are recorded as account names without the domain name (
EXAMPLE\tarobecomes1taro)For users who log in through LDAP, group names are taken by default from the CN in
memberOf. If a group’s account name on the file server differs from its CN, they do not matchBuilt-in groups such as Everyone are recorded as roles with those names. Users who log in through LDAP usually do not have those roles, so folders shared only with built-in groups may be shown to nobody. If needed, split the crawl configuration and supply the roles in “Permissions”
Conversely, if you only target shared folders that all employees may see equally, this integration is not required. This is the dividing line when deciding the scope of your deployment.
Notes for Each Protocol
smb/smb1The crawl account needs permission to read not only the file contents but also the file’s access permissions (security information). Files whose access permissions cannot be read are not indexed, and are recorded in [System Info] > [Failure URL].
fileIf the file system does not provide ACLs (as with typical Linux file systems), only two roles are recorded: the owning user and group. Read access granted to “others” does not become a role. If you mount a NAS on the Fess server and crawl it with
file, the owner visible at the mount point is recorded, not the ACLs on the NAS. For file servers where you want ACL-based filtering, crawl them directly withsmbinstead of mounting them.ftpThe owner and group returned by the FTP server are recorded as roles.
Which File Formats Can Be Read
Fess uses Apache Tika to extract text from the contents of files. Because the body text is searchable, not just the file name, you can find “documents whose title you cannot remember”.
The main supported formats are as follows.
MS Office (doc, xls, ppt, docx, xlsx, pptx, etc.)
PDF
Text, HTML, XML
Rich Text (rtf)
Source code (js, c, h, java, etc.)
Archives (gz, tar, zip, etc.)
For the complete list, see Supported File Formats.
Files that contain no text, such as image PDFs and scanned documents, cannot have their body text searched as they are. In Fess 15.9 you can enable OCR with Tesseract, which reads text from image files, images embedded in Office documents, and PDFs that contain no text. OCR is disabled by default. Install tesseract on the host where the crawler runs and set crawler.document.ocr.enabled=true. PDFs in which only some pages are scanned images are not covered. For the procedure, see OCR Configuration. Because OCR lengthens crawl time, we recommend first checking how many scanned documents the target folders contain.
Architecture and Scale
Fess uses OpenSearch to store the search index. At a small scale, Fess and OpenSearch can run together on the same server, and as the number of target files grows you can separate OpenSearch into a cluster.
When estimating the scale, checking the following in addition to the number of files makes the estimate more accurate.
The total size of the target folders, and the proportion of files that contain text
The update frequency (daily, or a few times a month). This affects how you design the crawl interval
The size per file
By default there is an upper limit on the size of files that can be indexed. The defaults in app/WEB-INF/classes/crawler/contentlength.xml are 2.5 MB for HTML and 10 MB for everything else; files that exceed them are not indexed and are recorded in [Failure URL]. Separately, writing something like client.maxContentLength=10485760 in “Config Parameters” of the crawl configuration limits the size of the files that are fetched in the first place (no limit by default). For folders with many large documents, decide before deployment whether to revise these limits. For how to configure them, see the section on file size settings in Crawler Configuration.
The crawl interval also needs attention. Fess deletes documents from the index that have not been updated by a crawl for a certain number of days. This number of days is “Delete old documents” under [System] > [General], and defaults to 3 days. The default job “Default Crawler” runs every day, so this is not a problem, but if you reduce it to, say, once a week, make this number of days longer than the run interval.
What to Look for in a File Server Search Tool
When comparing search tools for file servers, it is easier to choose if you check whether they meet the following points before comparing product names.
Deployment Steps
Get it running — Start Fess following the Quick Start Guide or Running and Searching Fess with Docker
Create a crawl configuration — Under [Crawler] > [File System], register a name and paths. If you filter by ACLs, delete
{role}guestfrom “Permissions” before savingSet up credentials — Register the account used to access the shared folders under [Crawler] > [File Authentication], and select the configuration from step 2 in “File Crawl Config”
Check the crawl account’s permissions — On the file server side, confirm that the account can read both the contents and the access permissions of the target folders
Integrate login — Configure LDAP (Active Directory) under [System] > [General]
Run a crawl and check the results — Under [System] > [Scheduler], open “Default Crawler”, click [Start Now], and check the results as described in “Verifying the Behavior” below
If you need to narrow results by department, also set up labels under [Crawler] > [Label].
The concrete steps for searching multiple file servers and internal websites from a single search box are covered in Searching Websites and File Servers Together, and designing result filtering with roles and groups is covered in Controlling Search Results with Roles and Groups.
Verifying the Behavior
After the crawl finishes, check the following in order. The built-in admin user also has the guest role, so do not use it to check filtering.
Open [System Info] > [Failure URL] and check that no files failed to be indexed because of access errors or size limits
Under [System Info] > [Search], search for a file in a restricted folder. This screen does not filter by role, so all documents are shown
Click [Update] on the result to open the edit screen and check the
rolefield. Confirm that it contains values from the ACL such as1taroor2sales, and that it does not containRguestWhile logged out, search for the same file on the search page and confirm that it is not shown
Log in as a user in a group that can read the folder, search, and confirm that it is shown
Log in as a user not in that group, search, and confirm that it is not shown
If the names in the role field in step 3 differ from the names on the LDAP side, review each item in “Matching the Names on the Login Side”.
Summary
Fess is an open source search server that can make file servers (SMB, FTP, local) searchable in full text. S3 and GCS are supported through plugins
For files crawled over SMB, the access permissions recorded in the ACLs are used to filter search results. Reading ACLs is enabled by default
Unless you remove
{role}guestfrom “Permissions” in the crawl configuration, users who are not logged in see all documentsPermission-aware search requires integration with Active Directory or LDAP, and matching names on both sides
Apache Tika makes the body text of Office documents and PDFs searchable, and enabling OCR makes scanned documents searchable too
You can start small and expand by clustering OpenSearch as the number of targets grows
Further Reading
Steps for searching multiple file servers and internal websites together: Searching Websites and File Servers Together
Designing result filtering with roles and groups: Controlling Search Results with Roles and Groups
Trying Fess locally with Docker: Running and Searching Fess with Docker