Encryption at Rest
Encryption at rest, when used in conjunction with transport encryptionand good security policies that protect relevant accounts, passwords,and encryption keys, can help ensure compliance with security andprivacy standards, including HIPAA, PCI-DSS, and FERPA.
Encrypted Storage Engine
New in version 3.2.
Enterprise Feature
Available in MongoDB Enterprise only.
Important
Available for the WiredTiger Storage Engine only.
MongoDB Enterprise 3.2 introduces a native encryption option for theWiredTiger storage engine. This feature allows MongoDB to encrypt datafiles such that only parties with the decryption key can decode andread the data.
Encryption Process
Changed in version 4.0
MongoDB Enterprise on Windows no longer supports AES256-GCM
. Thiscipher is now available only on Linux.
If encryption is enabled, the default encryption mode that MongoDBEnterprise uses is the AES256-CBC
(or 256-bit Advanced EncryptionStandard in Cipher Block Chaining mode) via OpenSSL. AES-256 uses asymmetric key; i.e. the same key to encrypt and decrypt text. MongoDBEnterprise for Linux also supports authenticated encryptionAES256-GCM
(or 256-bit Advanced Encryption Standard inGalois/Counter Mode). FIPS mode encryption is also available.
The data encryption process includes:
- Generating a master key.
- Generating keys for each database.
- Encrypting data with the database keys.
- Encrypting the database keys with the master key.
The encryption occurs transparently in the storage layer; i.e. all datafiles are fully encrypted from a filesystem perspective, and data onlyexists in an unencrypted state in memory and during transmission.
To encrypt all of MongoDB’s network traffic, you can use TLS/SSL(Transport Layer Security/Secure Sockets Layer). SeeConfigure mongod and mongos for TLS/SSL andTLS/SSL Configuration for Clients.
Key Management
Important
Secure management of the encryption keys is critical.
The database keys are internal to the server and are only paged to diskin an encrypted format. MongoDB never pages the master key to diskunder any circumstances.
Only the master key is external to the server (i.e. kept separate fromthe data and the database keys), and requires external management. Tomanage the master key, MongoDB’s encrypted storage engine supports twokey management options:
- Integration with a third party key management appliance via the KeyManagement Interoperability Protocol (KMIP). Recommended
- Local key management via a keyfile.
To configure MongoDB for encryption and use one of the two keymanagement options, seeConfigure Encryption.
Encryption and Replication
Encryption is not a part of replication:
- Master keys and database keys are not replicated, and
- Data is not natively encrypted over the wire.
Although you could reuse the same key for the nodes, MongoDB recommendsthe use of individual keys for each node as well as the use oftransport encryption.
For details, see Rotate Encryption Keys.
Logging
New in version 3.4: Available in MongoDB Enterprise only
The log file is not encrypted as a part of MongoDB’s encrypted storage engine.A mongod
running with loggingmay output potentially sensitive information to log files as a part of normaloperations, depending on the configured log verbosity.
MongoDB 3.4 Enterprise provides the security.redactClientLogData
setting to prevent potentially sensitive information from entering themongod
process log. redactClientLogData
reduces detail in the log and may complicate log diagnostics.
See the log redaction manual entry formore information.
Application Level Encryption
Application Level Encryption provides encryption on a per-field orper-document basis within the application layer.
New in version 4.2: MongoDB 4.2-series drivers provides a client-side field levelencryption framework. For more information, seeClient-Side Field Level Encryption.
To encrypt full documents, write custom encryption and decryptionroutines or use a commercial solution.
For a list of MongoDB’s certified partners,refer to the Partners List.To view security partners, select “Security” from theTechnology filter, and “Certified” from theCertified filter.