Protecting OpenEMR patient documents before they reach the chart
Three controls protect stored patient documents in a self-hosted OpenEMR: blocking direct web access to the documents directory, encrypting items stored on drive, and restricting uploads to an approved file whitelist. Each one closes a different gap. A self-hosted OpenEMR holds scanned referrals, consent forms and lab reports as files on the server's disk, so the team needs to show that those files cannot be fetched by URL, cannot be read from a stolen disk or backup in usable form, and cannot be used to smuggle executable content onto the server. The Securing OpenEMR guide recommends blocking direct web access to the sites/*/documents path, enabling the option to encrypt items stored on drive, and using the upload file white list. The HIPAA Security Rule applies to the electronic protected health information your organization creates, receives, maintains or transmits, so these files fall inside its scope whichever tool stores them.
The directory block is needed on every deployment, because a web server that serves the documents folder as static content exposes every file in it to anyone who can guess or obtain a path. Confirm with a direct request, from outside the network and without a session, that a document URL returns an error rather than the file. The drive encryption option is needed when the disk, its snapshots or its backups could leave your control, such as on a shared hypervisor or in a cloud volume you do not fully administer. Decide before go-live who holds the key material, where it is stored and how it is backed up, because a backup that holds encrypted documents is only recoverable if its key is also recoverable. Confirm the exact key handling behavior in the version you run, since the guide does not describe every step.
The upload whitelist is needed wherever staff or patients can upload files, including the patient portal, and it should be tested with the file types your clinics actually send. Review the allowed extensions against your intake workflows, then upload a disallowed type to confirm it is rejected. Treat these three controls as inputs to your HIPAA risk analysis, not as proof of compliance. No setting makes a deployment compliant on its own, and the evidence an assessor will ask for is a documented configuration, a record of how each control was tested and an owner for each one.
Which document control fits which exposure
This table compares four controls for stored patient documents in OpenEMR: blocking web access to the documents directory, encrypting items stored on drive, the upload file whitelist and backup key handling. Read each row as a single control, and note that the controls address different exposures, so most deployments need more than one.
| Control | What it protects against | Where it is set or enforced | What it does not cover | When to use it |
|---|---|---|---|---|
| Block web access to sites/*/documents | Anyone reaching stored document files by requesting their direct URL from the web server | Web server configuration for the OpenEMR site, per the Securing OpenEMR guide | Access through the application as an authenticated user, or files already copied off the server | Always, on every internet-facing or shared-network OpenEMR host, and re-check after upgrades |
| Encrypt items stored on drive | Exposure of document files if someone obtains the disk, a backup copy or the file store without the application | OpenEMR global settings for storing items on drive (confirm the exact option name in your version) | Users who can open documents in the application, and weak key storage on the same host | When documents are kept on disk and the hosting model could expose the storage layer, such as shared or leased hardware |
| Upload file whitelist | Upload of executable or unexpected file types that could be run or served by the web server | OpenEMR global settings for permitted upload file types, enforced when files are uploaded | Malicious content inside an allowed file type, such as a crafted document, and files added by other paths | When patients or staff can upload files, including through the patient portal or fax and SMS workflows |
| Backup key handling | Loss of readable data if backups are copied off site, and loss of recoverability if the key is lost | Your backup procedure and key store, outside OpenEMR's application settings (confirm how your version stores the encryption key) | The backup process itself, retention rules, and access to the key by administrators | Whenever encryption is on, so that backups are restorable and their key is kept separately from the copies it protects |
How to lock down the documents directory and enable encryption
This sequence blocks direct web access to patient documents, turns on encryption for files stored on drive, restricts uploads to an approved file list, and records how encryption keys are kept and backed up. Each step ends with a check that confirms the control works before the next one starts.
Confirm the install path and documents location
The administrator locates the OpenEMR install directory on the web server and lists the sites/*/documents paths for each site in the deployment, including any multisite instances. Record the absolute paths in the change ticket so the web server rule targets the right folders. Done means each documents path is written down and matched to a site name, with a directory listing from the server confirming that the folders exist and contain the stored files you expect.
Block direct web access at the web server
The web server administrator adds a rule that denies all HTTP requests to the sites/*/documents paths, following the approach in the Securing OpenEMR guide, and then reloads the server configuration. Apply the same rule in any reverse proxy or load balancer in front of OpenEMR, because a rule that exists only on one layer can be bypassed. Done means the configuration test passes and the reload completes without errors on every node that serves OpenEMR.
Confirm direct requests are refused
From a machine outside the admin network, and from inside it, request the URL of a known stored document by its direct path in a browser or with curl. The server should refuse the request, and the refusal should appear in the web server access log with the expected status. Then log in to OpenEMR and open the same patient document through the normal interface to confirm the application still serves it. Done means the direct request is denied and the in-application view loads the file.
Enable drive encryption and the upload whitelist
An OpenEMR administrator opens the global settings for documents and turns on the option to encrypt items stored on drive, then sets the upload file whitelist to the document types the practice actually needs. Record the setting values and the date of change, and confirm with the administrator who owns global settings that the change was saved. Done means the settings page shows encryption enabled and the whitelist lists only the approved extensions. Confirm the exact setting labels against the version you run, since menus differ across releases.
Test allowed and disallowed uploads
Using a test patient in a non-production copy, upload one file of each approved type and confirm it saves and opens. Then attempt uploads of a file type that is not on the whitelist, such as an executable or a script, and confirm OpenEMR rejects it with no copy stored in the documents directory. Check the file system afterward to confirm nothing was written. Done means every allowed type succeeds, every disallowed type is refused, and no rejected file appears on disk.
Verify stored files are encrypted on disk
Open one test document from the documents directory with a text viewer or a hex viewer and confirm its contents are not readable as the original file. Then confirm OpenEMR still displays the document when opened through the interface. If the file is readable on disk, stop and review whether encryption was applied to files uploaded after the setting change, since existing files may need to be handled separately. Confirm the exact behavior with your OpenEMR version before relying on it.
Record the key handling procedure
Document where the encryption key is stored, who can read it, and how it is backed up and restored, and keep the key out of the same backup as the encrypted documents where your design allows it. Assign a named owner for key custody and a rule for rotation, and test a restore of one encrypted document from backup using the recorded procedure. Done means the procedure is written, approved by the security owner, and a test restore has opened a document successfully.
How the setup changes on bare metal, Docker and multisite
On a single server running Apache or a similar web server, the OpenEMR code and its sites directory sit under one document root on the host. The documents path is part of the code tree, so the block on direct web access has to be written into the web server configuration that serves that tree. Confirm which directory your virtual host uses as its document root, then check that requests for the documents path under the default site return a refusal rather than a file.
- Document root: Identify the directory your virtual host serves and confirm the OpenEMR installation sits beneath it.
- Documents path: Block direct web access to
sites/*/documentsin the web server configuration, not only in application code. - Setup scripts: Remove
setup.phpand other admin scripts after installation, since these are the same web-reachable files on this model. - Encryption setting: Enable the option to encrypt items stored on drive in the administration settings, then confirm it applies to new uploads.
- Verification: Request a known document URL from outside the network and confirm the server refuses it.
Before closing the change, record the exact configuration file and the test you ran so the next upgrade does not silently remove the block.
In a Docker deployment, the web server and the OpenEMR code live inside a container, and the documents directory is usually mapped to a host path or a named volume. The block on web access has to hold inside the container image or its web server configuration, and the stored files have to be handled on the volume side. Confirm exactly which path inside the container is the documents directory and which host path or volume backs it, because a backup or restore that ignores the volume can leave documents unprotected.
- Container path: Confirm the path inside the container that holds
sites/*/documentsand whether it is served by the web server. - Volume mapping: Identify the host path or named volume that backs the documents directory and who can read it on the host.
- Web server rule: Confirm the block on direct access is present in the running container, not only in a configuration file on the host.
- Setup scripts: Confirm setup and admin scripts are removed or blocked inside the running container, since a rebuilt image can restore them.
- Backups: Include the documents volume in backup scope and confirm how encryption keys are stored relative to the volume.
Test the block against the running container after every image update, because a new image can reset web server configuration.
A multisite installation keeps a separate documents tree for each site, under its own directory within sites. Every site has its own documents directory and its own setting for encryption and uploads, so a control that is correct for one site can be missing for another. Build an inventory of sites first, then verify each documents directory separately rather than assuming a single rule covers all of them.
- Site inventory: List every site directory under
sitesand record which ones hold documents. - Per-site block: Confirm web access to each site's documents directory is blocked, including sites added later.
- Per-site settings: Check the encryption option and upload whitelist for each site, since these are configured per site.
- Shared resources: Identify any directories or scripts shared across sites, and confirm the block covers them.
- Verification log: Keep a dated record of the test result for each site so auditors can trace the control across the installation.
Add the check to the procedure for creating a new site, so the controls are applied before the site holds patient documents.
Before changing any setting, confirm your layout with a short inventory. The sources describe the documents path as sites/*/documents, so the first task is to map that pattern onto your own host, container or site list. If you cannot confirm a path from your own environment, ask the team that built the deployment rather than assuming a default location.
- Web root: Record the directory the web server serves and where OpenEMR sits relative to it.
- Documents location: Record the actual path of each documents directory, including any container or volume mapping.
- Site count: Record whether the install is single-site or multisite and list each site.
- Access test: Record one blocked request per documents directory, from outside the internal network.
- Owner: Name the person who re-runs these checks after each upgrade or image change.
Keep this inventory with your configuration records, since it is the baseline you will compare against after upgrades and restores.
What drive encryption protects and where the keys must live
Turning on encryption for items stored on drive protects documents at rest, meaning files sitting on the disk or in the storage path when the server is powered off, copied, or read outside the application. It does not stop an authorized, logged-in user from opening a document through OpenEMR, and it does not stop an application administrator who can reach the running system from reading what the application can read. Treat it as one layer beside the web access block, the upload whitelist, and access control, not as a substitute for any of them. The practical consequence is that the key is what matters most: if the key is lost, the encrypted documents cannot be recovered, and a backup of the files without the key is of little use.
Keys should not sit beside the backups they unlock. A backup archive that contains both the encrypted documents and the key that decrypts them is effectively unencrypted for anyone who obtains it. Store key copies separately from the backup media and from the OpenEMR host, and limit who can read them. Keep key access separate from application administrators, so that the people who run OpenEMR day to day cannot silently retrieve the key alone. Write a key rotation and recovery procedure that names the custodians, the steps to re-encrypt or re-key documents, how a key is restored after a host rebuild, and how the restore is tested. Rotation must also account for documents already stored under the old key.
Before relying on any of this, confirm how your OpenEMR version derives and stores its encryption key for drive storage, including where the key material lives, whether it is tied to the site configuration, and what happens to existing files if the key changes. Check this against the Securing OpenEMR guide and the release notes for your version, and confirm the answer with your OpenEMR support provider or in a test restore. Do not assume that a restored backup will decrypt until you have proven it on a separate system.
Security risks that remain after the controls are on
Turning on encryption and the upload whitelist does not close every gap. The risks below sit around the controls: the web server, backups, uploads, staff access, temporary files and logs. Each one maps to a control already in place and a check you can run to confirm it still holds.
Documents path reachable through the web server
A web server alias, a copied virtual host or a rewrite rule can expose the sites/*/documents directory even when the default configuration blocks it. Stored documents can then be fetched by URL without going through OpenEMR's access checks. Control: deny direct web access to the documents path in every virtual host. Check: request a known document URL from outside the application session and confirm the server refuses it.
Backups that copy documents without keys
A backup of the documents directory is only useful if the matching encryption keys can be recovered with it. If keys live only on the application server, or are copied without a documented procedure, restores fail or the backup set is left unprotected. Control: store key material separately from the backup target and document the restore sequence. Check: restore a backup to a clean host and open a sample encrypted document.
Upload types beyond the whitelist
The upload whitelist limits what users can store, but any extension added for convenience, or a file type that browsers render as active content, widens what an attacker can place on the server. Scripts stored in the documents path may run if the web server treats them as code. Control: keep the whitelist to the formats clinical staff actually use. Check: attempt to upload a script or executable with a renamed extension and confirm it is rejected.
Staff access beyond need to know
Encryption at rest does not limit who can open a document once they are logged in. Broad roles, shared accounts or staff who keep access after changing departments can view records outside their care team. Control: map document access to roles and care relationships and remove access on transfer. Check: sample document views from audit records and confirm each viewer had a current care reason.
Temporary files and exports outside the protected path
Generated PDFs, exports and temporary copies made during printing, faxing or portal delivery can land in directories that the documents protections do not cover. These copies may stay on disk after the user session ends. Control: confirm where the application writes temporary and export files and set cleanup. Check: generate each document type, then search the server for leftover copies outside the protected path.
Logs that name documents with patient identifiers
Web server, application and debug logs can record document file names, and file names often include a patient name, record number or date of birth. Anyone with log access then holds patient identifiers outside the record system. Control: review what file names and paths the logs capture and restrict log access to the operations team. Check: search recent logs for a known document name and confirm no identifiers appear.
What buyers ask about OpenEMR document protection and outside help
What makes the effort for OpenEMR document protection go up or down?
The effort depends mostly on how many sites and document directories are in scope, which web server runs OpenEMR, and how backups are produced and stored. A single site on one Apache or Nginx host with one backup job is a small, contained change. Multisite deployments, Docker builds where the documents path lives in a volume, and backup tooling that copies encrypted files to several targets each add configuration, testing and documentation. Turning on encryption of items stored on drive also means deciding how existing documents are handled, which is a larger job on a site that already holds years of scanned records than on a new install. Ask your team to inventory these factors before requesting a quote.
Can our own team protect OpenEMR documents without a partner?
Yes, if your team has administrators who can edit web server configuration, read the OpenEMR documentation on the documents directory and upload whitelist, and test changes on a non-production copy. The Securing OpenEMR guide lists the core steps: block direct web access to sites/*/documents, enable the upload file whitelist and consider encrypting items stored on drive. The harder parts are confirming that every route to the files is blocked, handling the encryption key without losing access to records, and proving the result in a repeatable way. A partner is most useful when the internal team lacks time, has no test environment, or needs an independent check before an assessment.
What does the work need from our organization?
Expect to provide administrative access to the OpenEMR host or container platform, read access to the web server configuration, and a copy of the database and file store for testing. Restoring a copy is safer than changing production first. You also need a named owner for encryption keys and backup keys who can approve changes and who is accountable if a key is lost. Finally, provide a contact who can confirm which document types staff actually upload, because the upload whitelist must allow those types without opening the door to executable files. Confirm these inputs in writing before work starts.
How long does verification take to plan?
Plan verification as its own step, not as a footnote to configuration. It usually includes requesting blocked paths from outside the network and confirming they return denial responses, uploading test files of allowed and disallowed types, checking that stored files are unreadable without the key, and restoring a backup to confirm the key and files work together. The time depends on how many sites, upload types and backup jobs must be tested, and on how quickly test copies and keys can be provided. Ask any provider to show the verification steps as part of the written scope and to name what evidence they will hand over.
Does protecting documents this way satisfy HIPAA on its own?
No. The HIPAA Security Rule covers the whole program for electronic protected health information, including risk analysis, administrative and physical safeguards, workforce training, access management and business associate agreements. Encryption and access controls for stored documents address specific technical safeguards, and the encryption specification in 45 CFR 164.312 is addressable, meaning you must decide and document whether and how to implement it. HHS does not certify organizations as compliant, so no vendor or consultant can issue a HIPAA certificate. Treat document protection as one documented control within your wider risk management record.
What should a fixed-scope quote for this work list?
A fixed-scope quote should name each system in scope, including the OpenEMR version, PHP version, database, web server and whether the deployment is Docker, multisite or a standard install. It should list each deliverable: the directory block, the upload whitelist settings, the encryption configuration, key handling procedure, backup changes and the verification report. It should state what the client provides, what is excluded, such as changes to the wider network or the database connection, and how retesting after fixes is handled. Confirm the timeline is tied to client inputs and acceptance steps, and ask for it in writing before any work starts.
Who pays for what when outside help is used?
In a typical engagement the organization pays for OpenEMR licensing, which is free under the GNU GPL v3.0, plus its own infrastructure, staff time and any compliance program costs. A partner's fee covers the planning, configuration, testing and documentation defined in the written scope. Some costs recur, such as reviewing key access, reapplying settings after upgrades and rerunning verification after OpenEMR security releases. Ask each provider which of these recurring tasks are included, which would need a separate retainer, and how changes to scope after signing are priced.
Blocked direct requests, whitelisted uploads and separate backup keys
The diagram starts with a staff upload, which passes the upload whitelist in the application before it is written to the documents directory with drive encryption turned on. A direct browser request to that directory is denied by the web server, so only authorized application reads return a file. The backup job copies the encrypted files, and the key store sits apart from the backup target. Check each boundary separately: the web server rule, the whitelist and the key location.
Upload, storage, blocked web access, authorized read and encrypted backup, with trust boundaries.
How DeployOpen scopes and delivers document protection for OpenEMR
DeployOpen plans, implements, hardens, documents and supports self-hosted open-source platforms inside the client's own infrastructure, so document protection for OpenEMR is set up where your data already lives. We scope the work in writing first, then build and verify the directory blocking, encryption and upload controls against your own environment and hand over the evidence your compliance and security teams need to review.
How we scope
- We review your OpenEMR version, web server setup, document storage location and backup targets before agreeing on scope.
- The written scope names which document paths, upload types and backup copies are covered, and which are excluded.
- Engagements are fixed-scope, with deliverables and timelines agreed in writing before any work starts.
How we build
- We block direct web access to the documents directory and confirm the rule with requests from outside the network.
- We enable on-drive encryption for stored items, record the key storage location, and test that existing files still open.
- We set the upload file whitelist to the types your workflows need, then test accepted and rejected uploads in staging.
How we hand over
- You receive configuration records, test results and a written description of each control and how to verify it.
- Backup key handling is documented, including who holds copies, where they are kept and how restores are tested.
- We walk your operations and security staff through the runbook so changes after handover follow the same checks.
How we support
- Ongoing support, upgrades and continuous testing are available as retainers, so whitelist and directory checks follow OpenEMR updates.
- We re-verify the controls after each OpenEMR upgrade or security release that touches document handling.
- Retesting after any fix is included in the written scope, so you can confirm that the change closed the gap.

