A regional hospital network — one main campus, three satellite clinics — transfers patient records every day. Lab results from the reference lab. Imaging reports from radiology. Discharge summaries from the main campus to the outlying facilities that handle follow-up care. The files are small (a few kilobytes to a few megabytes each), the volume is modest (a few hundred per day), and the stakes are not modest at all. Every one of those files contains protected health information under HIPAA.
This is a composite scenario drawn from the kind of deployment Stylus SFTP Server is built for. The names are invented. The problems are real, and so are the solutions.
What was there before
The hospital’s IT department had a shared network drive. Patient files landed in folders organized by facility. Windows folder-level ACLs controlled who could read what. It worked, until the annual risk assessment asked three questions the team could not answer:
- Is the data encrypted at rest? No. The files sat on an NTFS volume, unencrypted. Anyone with physical access to the server — or a backup tape — could read every record.
- Who accessed which file, and when? Windows Security event logs captured some file-open events, but they were noisy, hard to query, and rotated off the server within weeks. There was no centralized audit trail, and certainly nothing an auditor could pull up in a few minutes.
- What stops a compromised password from becoming a data breach? Nothing. One stolen credential gave full read access to every patient file in the share. No MFA. No lockout. No geographic restriction.
Those three gaps map directly to HIPAA’s technical safeguard requirements: encryption (§164.312(a)(2)(iv) and §164.312(e)(2)(ii)), audit controls (§164.312(b)), and access control (§164.312(a)(1) and §164.312(d)). The compliance team needed a system that addressed all three without bolting on half a dozen separate tools.
Encryption: at rest and in transit, with one config
Stylus SFTP Server encrypts data in transit over SSH — that part is inherent to the protocol. What makes the deployment interesting for healthcare is the at-rest story.
The hospital chose the database storage backend. Instead of writing patient files to a local filesystem, the server stores them in an H2 database configured with CIPHER=AES. The AES cipher password lives inside a PKCS#12 keystore (credentials.p12), which is itself protected by a master key file with restrictive filesystem ACLs. The database file on disk is opaque without the keystore and the master key — a stolen backup tape or a decommissioned hard drive yields nothing readable.
<!-- sftp-server.xml -->
<jdbc>
<url>jdbc:h2:${STYLUS_SFTPSERVER_DATA}/db/sftpdb;AUTO_SERVER=TRUE;CIPHER=AES</url>
<driver>org.h2.Driver</driver>
</jdbc>
<!-- filesystem-config.xml -->
<storage-backend>database</storage-backend>
That is the entire at-rest encryption configuration. No third-party disk encryption agent, no BitLocker policy to manage per server, no key escrow infrastructure. The database engine handles it.
On the wire, the server’s SSH layer is configurable down to specific cipher suites and key-exchange algorithms via SshAlgorithmConfigurer. The hospital’s security team locked the allow-list to aes256-ctr and aes256-gcm@openssh.com and disabled everything weaker. A misconfigured client that tries to negotiate 3des-cbc simply fails to connect.
MFA: password plus TOTP on every login
A password alone does not satisfy HIPAA’s “unique user identification” and “authentication” requirements when the threat model includes credential stuffing and phishing. The hospital enabled mandatory TOTP multi-factor authentication.
Internally, this works through SSH’s keyboard-interactive authentication (RFC 4256). The server runs a multi-round challenge: round one prompts for the password and verifies it against the user manager; round two prompts for a six-digit TOTP code and verifies it using the RFC 6238 algorithm (HMAC-SHA1, 30-second time steps, with a one-step clock-skew window). Users enroll by scanning a QR code in the Web File Portal using any standard authenticator app.
The MFA policy has three modes: DISABLED, OPTIONAL, and REQUIRED. The hospital set it to REQUIRED. A user who has not yet enrolled is rejected at login with an AUTH_FAILURE audit event — they cannot transfer files until they complete enrollment. Recovery codes (eight alphanumeric characters each) are generated during enrollment for account recovery without re-enrollment.
<mfa>
<enabled>true</enabled>
<required>true</required>
<issuer>Regional Health Network</issuer>
</mfa>
Audit: every event, every sink, every time
HIPAA §164.312(b) requires “hardware, software, and/or procedural mechanisms that record and examine activity in information systems that contain or use electronic protected health information.” The hospital’s compliance team translated that into a concrete requirement: every connection, login attempt, file upload, file download, and failed authentication must be recorded, timestamped in UTC, and forwarded to the Splunk SIEM in real time.
The server’s audit subsystem delivers this through CompoundAuditSink, which fans out each event to multiple sinks simultaneously. The hospital runs three: the built-in JDBC sink (writes to the sftp_audit table in batches of up to 100 via an async queue), syslog over TCP in RFC 5424 format (pointed at Splunk), and the server log file as a backstop.
Each audit event is an immutable record with nine fields: timestamp, event type, username, remote IP, filename, bytes transferred, success flag, detail text, and the executedBy field that tracks which administrator performed an action (distinct from the subject user). When an auditor asks “show me every file Dr. Chen downloaded last Tuesday,” it is a SQL query against sftp_audit. When the SIEM team wants real-time alerting on failed logins from unexpected countries, the syslog stream already carries that data.
<audit>
<database>true</database>
<log>true</log>
<syslog>
<enabled>true</enabled>
<host>splunk.hospital.local</host>
<port>514</port>
<protocol>tcp</protocol>
<format>rfc5424</format>
</syslog>
</audit>
The audit retention post covers the math on keeping seven years of records (the practical floor for most healthcare organizations that want to survive an HHS investigation without scrambling).
Access control: least privilege by default
The hospital uses Active Directory. Rather than maintaining a separate user database, the SFTP server authenticates against AD via LDAP and derives access rights from group membership.
Two sets of groups are configured: <access-groups> (read-write) and <read-only-groups> (download only). The server checks the user’s memberOf attribute at every login and applies the most restrictive match — if a user belongs to both an access group and a read-only group, they get read-only. Users who match no configured group fall back to the <default-access> setting in filesystem-config.xml, which the hospital set to read-only.
In practice, this means the lab technicians who upload results are in the SFTP-Upload AD group (read-write), while the satellite clinic staff who download them are in SFTP-Download (read-only). A new employee who gets added to neither group can still authenticate but cannot upload — the safe default applies.
For the three satellite facilities whose staff are not comfortable with SFTP clients, the Web File Portal provides browser-based access over HTTPS. Same MFA requirement, same audit trail, same access-control rules — different transport.
Lockout and geographic filtering
Two more layers close the gaps the risk assessment identified.
Account lockout. After five consecutive failed login attempts, the account is locked for 30 minutes. The lockout tracker (JdbcLockoutTracker) records each failure in the sftp_lockout table with a UTC timestamp. A successful login clears the counter. A locked account generates an AUTH_ACCOUNT_LOCKED audit event that appears in the SIEM immediately.
Geographic IP filtering. The hospital has no reason to accept connections from outside the United States. The server’s GeoIpManager checks every incoming connection against a MaxMind database at session creation — before the SSH handshake even begins. Connections from non-US addresses are refused with SSH disconnect code 11. The filter hot-reloads when the MaxMind database file is updated, so monthly GeoIP refreshes require no downtime.
Upload integrity
Patient files must arrive whole or not at all. The server stages every upload as a temporary file in a centralized staging directory, then commits it to the user’s home directory via ATOMIC_MOVE when the SFTP channel closes cleanly. A file that arrives mid-transfer due to a dropped connection is never visible to downstream systems — the staging file is cleaned up, and an UPLOAD_ABORTED audit event records what happened. Downstream processes that poll the home directory for new files never see partial writes.
What the compliance team got
After deployment, the hospital’s next risk assessment answered every question that the previous one could not:
- Encryption at rest: AES, managed by the database engine, key material in a PKCS#12 keystore.
- Encryption in transit: SSH with a locked-down cipher suite.
- Audit trail: Every access event, in the database for queries and in the SIEM for alerting, retained for seven years.
- Access control: AD group membership, evaluated per session, most-restrictive-wins, safe read-only default.
- Authentication: Mandatory TOTP MFA on every login, with automatic account lockout.
- Perimeter: Geographic IP filtering before the handshake.
- Data integrity: Atomic upload staging, no partial files.
One server, one configuration file, no extra agents or middleware. The compliance team can produce the access report an HHS investigator asks for in the time it takes to run a SQL query.