MongoDB Security Architecture WP
MongoDB Security Architecture WP
MongoDB Atlas 13
Conclusion 13
We Can Help 13
Resources 14
1
In addition to these initiatives, new regulations are being
developed every year to cope with emerging threats and
new demands for tighter controls governing data use.
Despite differences between different regulations, there A holistic security architecture must cover the following:
are common foundational requirements across all of the
directives, including: User access management to restrict access to sensitive
data, implemented through authentication and
Restricting data access, enforced via predefined authorization controls
privileges and roles
Logging operations against the database in an audit
Measures to protect against the accidental or malicious trail for forensic analysis
disclosure, loss, destruction, or damage of personal data
Data protection via encryption of data in-motion over
The separation of duties when accessing and the network and at-rest in persistent storage
processing data
Environmental and process controls
Recording user, administrative staff, and application
activities with a database These requirements inform The requirements for each of these elements are
the security architecture of MongoDB, with best discussed below.
practices for the implementation of a secure, compliant
data management environment.
User Access Management -
Authentication
Authentication is designed to confirm the identity of
entities accessing the database. In this context, entities are
defined as:
2
Physical and logical nodes that the database runs on. security infrastructure enforces centralized and
Databases can be distributed across multiple nodes standardized control over user access. If, for example, a
both for scaling operations and to ensure continuous users access must be revoked, the update can be made
operation in the event of systems failure or in a single repository and enforced instantly across all
maintenance. systems, including MongoDB.
3
Care should be taken to ensure that only the minimal Encrypt Connections to the Dat Database.
abase. All user or
set of privileges is provided. Credentials of the most application access to the database should be via
privileged accounts could compromise the entire encrypted channels including connections established
database if they are hacked internally or by an external through the drivers, command line or shell, as well as
intruder. remote access sessions to the database servers
themselves. Internal communications between database
Contr
Controlol Access to Sensitive DatData.
a. To prevent the
nodes should also be encrypted, i.e. traffic replicated
emergence of data silos, it should be possible to restrict
between nodes of a database cluster.
permissions to individual fields, based on security
privileges. For example, some fields of a record may be Encrypt Dat
Dataa at Rest. One of most common threats to
accessible to all users of the database, while others security comes from attacks that bypass the database
containing sensitive information, such as PII, should be itself and target the underlying Operating System and
restricted to users with specific security clearance. physical storage of production servers or backup
devices, in order to access raw data. On-disk encryption
of the databases data files and backups mitigates this
Auditing threat.
By creating audit trails, changes to data and database Sign and Rot
Rotate
ate Encryption K Keys.
eys. Encryption keys
configuration can be captured for each entity accessing for network and disk encryption should be periodically
the database, providing a log for compliance and forensic rotated. TLS encryption channels should use signed
analysis. Auditing can also detect attempts to access certificates to ensure that clients can certify the
unauthorized data. credentials they receive from server components.
Trac
rackk Changes to Dat
Database
abase Configuration. Any time Enfor
Enforce
ce Str
Strong
ong Encryption. The database should
a database configuration is changed, the action should support FIPS (Federal Information Processing
be recorded in an audit log which should include the Standard) 140-2 to ensure the implementation of
change action, the identity of the user and a timestamp. secure encryption algorithms.
Trac
rackk Changes to DatData.a. It should be possible to
configure the audit trail to capture every query or write Environmental and Process Control
operation to the database. Care, however, should be
exercised when configuring this rule for applications. The environment in which the database and underlying
For example, if the application is inserting tens of infrastructure is running should be protected with both
thousands of records per second, writing each physical and logical controls. These are enforced in the
operation to the audit log can impose a performance underlying deployment environment, rather than in the
overhead to the database. The project team should database itself, and include:
determine any tradeoffs between performance and
Installation of firewalls
auditing requirements. It should be possible to filter
events that are captured, for example only specific Network configurations
users, IP addresses or operations. Defining file system permissions
Encryption is the encoding of critical data whenever it is in As configuration errors and unpatched systems are one of
transit or at rest, enabling only authorized entities to read it. the largest causes of attackers bypassing security
Data will be protected in the event that eavesdroppers or mechanisms, there are a series of operational processes
hackers gain access to the server, network, filesystem or that should be adopted to further promote and enforce
database. secure operation, including:
4
Figur
Figure
e22: Integrating MongoDB with Centralized User Access Controls
DBA and developer training whitepaper to learn more about the specific security
architecture of the Atlas service.
Database provisioning, monitoring and backup
5
In Database Authentication Users can be authenticated to MongoDB using client
certificates rather than self-maintained passwords.
MongoDB authenticates entities on a per-database level
using the SCRAM IETF RFC 5802 standard. Users are Inter-cluster authentication and communication between
authenticated via the authentication command, while MongoDB nodes can be secured with x.509 member
database nodes can be authenticated to the MongoDB certificates rather than keyfiles, ensuring stricter
cluster via keyfiles. membership controls with less administrative overhead, i.e.
by eliminating the shared password used by keyfiles. x.509
Review the authentication documentation to learn more.
certificates can be used by nodes to verify their
membership of MongoDB replica sets and sharded
LDAP Authentication clusters. A single Certificate Authority (CA) should issue all
the x.509 certificates for the members of a sharded cluster
LDAP is widely used by many organizations to standardize
or a replica set.
and simplify the way large numbers of users are managed
across internal systems and applications. In many cases, Instructions for configuration are described in the
LDAP is also used as the centralized authority for user MongoDB and x.509 certificates tutorial.
access control to ensure that internal security policies are
compliant with corporate and regulatory guidelines. With
MongoDB and Red Hat Identity Management
LDAP integration, MongoDB Enterprise Advanced can
both authenticate and authorize users directly against Red Hat Enterprise Linux (RHEL) is a popular environment
existing LDAP infrastructure to leverage centralised access for MongoDB deployments. Providing ease of use to
control architectures. administrators and security professionals working in these
environments, the MongoDB security features are
Review the LDAP integration documentation to learn more
integrated with the Identity Management (IdM) features of
about LDAP and MongoDB Enterprise Advanced.
RHEL. This integration provides central management of
individual entities and their authentication, authorization
Kerberos Authentication and privileges.
With MongoDB Enterprise Advanced, authentication using Review the Red Hat Linux Identity Management tutorial for
a Kerberos service is supported. Kerberos is an industry instruction on configuration with MongoDB.
standard authentication protocol for large client/server
Red Hat IdM integration is available with MongoDB
systems, allowing both the client and server to verify each
Enterprise Advanced and requires the database to be
others' identity. With Kerberos support, MongoDB can take
configured for Kerberos authentication.
advantage of existing authentication infrastructure and
processes, including Microsoft Windows Active Directory .
MongoDB and Microsoft Active Directory
Before users can authenticate to MongoDB using
Kerberos, they must first be created and granted privileges MongoDB Enterprise Advanced provides support for
within MongoDB. The process for doing this, along with a authentication using Microsoft Active Directory with both
full configuration checklist is described in the MongoDB Kerberos and LDAP. The Active Directory domain controller
and Kerberos tutorial. authenticates the MongoDB users and servers running in a
Windows network, again to leverage centralised access
control.
x.509 Certificate Authentication
With support for x.509 certificates MongoDB can be
integrated with existing information security infrastructure
and certificate authorities, supporting both user and
inter-node authentication.
6
Figur
Figure
e33: MongoDB User Defined Roles Permit Separations of Duty
Over ten predefined roles supporting common user and Processes for monitoring MongoDB clusters can be
administrator database privileges provide MongoDB's Role restricted to run just those commands that retrieve
Based Access Control (RBAC) capabilities. These can be server status, without having full administrative access
further customised through User Defined Roles, enabling to perform database operations
administrators to assign fine-grained privileges to clients, Within a multi-tenant environment, landlord developers
based on their respective data access and processing and administrators can be assigned permissions across
needs. To simplify account provisioning and maintenance, physical databases, while tenant developers and
roles can be delegated across teams, ensuring the administrators can be granted a more limited set of
enforcement of consistent policies across specific data actions across logical databases or individual
processing functions within the organization. MongoDB collections. This functionality enables a clear separation
provides the ability to specify user privileges with both of duties and control, both between and within
database and collection-level granularity. organizations.
Privileges are assigned to roles, and roles are in turn Review the Authorization section of the documentation to
assigned to users. For example: learn more about roles in MongoDB.
Classes of users and applications can be assigned When combined with the auditing capabilities available with
privileges to insert data, but not to update or delete data MongoDB Enterprise Advanced, customers can define
from the database specific administrative actions per role, and then log all of
those actions. As a result, the organization is able to
7
enforce end-to-end operational control and maintain As views are non-materialized, the view data is generated
insight of actions for compliance and reporting. dynamically by reading from the underlying collections
when a user queries the view. This reduces data duplication
in the database, and eliminates inconsistencies between
LDAP Authorization
the base data and view.
In addition to authentication, MongoDB Enterprise
Views are defined using the standard MongoDB Query
Advanced also support authorization via LDAP. This
Language and aggregation pipeline. They allow the
enables existing user privileges stored in the LDAP server
inclusion or exclusion of fields, masking of field values,
to be mapped to MongoDB roles, without users having to
filtering, schema transformation, grouping, sorting, limiting,
be recreated in MongoDB itself. When configured with an
and joining of data using $lookup and $graphLookup to
LDAP server for authorization, MongoDB will allow user
another collection.
authentication via LDAP, Active Directory, Kerberos, or
X.509 without requiring local user documents in the You can learn more about MongoDB read-only views from
$external database. When a user successfully the documentation.
authenticates, MongoDB will perform a query against the
LDAP server to retrieve all groups the LDAP user is a
member of, and will transform those groups into their
Log Redaction
equivalent MongoDB roles. LDAP authentication and MongoDB Enterprise Advanced can also be configured
authorization can be configured either via the command with log redaction to prevent potentially sensitive
line, or for additional administrative convenience, via the information, such as personal identifiers, from being written
Ops Manager GUI. to the databases diagnostic log. Developers and DBAs
who may need to access the logs for database
Field-Level Security with Read-Only Views performance optimization or maintenance tasks still get
visibility to metadata, such as error or operation codes, line
To enforce field-level security, DBAs can define numbers, and source file names, but are unable to see any
non-materialized views that expose only a subset of data personal data associated with database events.
from an underlying MongoDB collection, i.e. a view that
filters out specific fields, such as Personally Identifiable
Information (PII) from sales data or health records. As a MongoDB Auditing
result, risks of data exposure are dramatically reduced.
The MongoDB Enterprise Advanced auditing framework
DBAs can define a view of a collection that's generated
logs all access and actions executed against the database.
from an aggregation over another collection(s) or view.
The auditing framework captures administrative actions
Permissions granted against the view are specified
(DDL) such as schema operations as well as
separately from permissions granted to the underlying
authentication and authorization activities, along with read
collection(s). This capability allows organizations to more
and write (DML) operations to the database.
easily meet compliance standards in regulated industries
Administrators can construct and filter audit trails for any
by restricting access to sensitive data, without creating the
operation against MongoDB, whether DML, DCL or DDL
silos that emerge when data has to be broken apart to
without having to rely on third party tools. For example, it is
reflect different access privileges.
possible to log and audit the identities of users who
Views can also contain computed fields for example accessed specific documents, and any changes they made
summarizing total and average order value per region, to the database during their session.
without exposing underlying customer data. All of this can
be done without impacting the structure or content of the
original source collections. Developers and DBAs can
modify the underlying collections schema without
impacting applications using the view.
8
entity capable of connecting to the MongoDB server,
including:
Applications
9
avoiding the significant performance overhead imposed by
key rotation in other databases. Only the master key is
rotated, and the internal database keystore is re-encrypted.
Integration with a third party key management appliance The intention of a Defense in Depth approach is to layer
via the KMIP protocol (recommended). your environment to ensure there are no exploitable single
points of failure that could allow an intruder or untrusted
Most regulatory requirements mandate that the encryption
party to access the data stored in the MongoDB database.
keys must be rotated and replaced with a new key at least
once annually. MongoDB can achieve key rotation without Secure environments use the following strategies to
incurring downtime by performing rolling restarts of the control access, with more detail available in the Network
replica set. When using a KMIP appliance, the database Exposure and Security section of the documentation.
files themselves do not need to be re-encrypted, thereby
10
Network Filter
Filter.. By using filters such as firewalls and to mix JavaScript and BSON so that user-specified
router ACL rules, connections to MongoDB from values are evaluated as values and not as code.
unknown systems can be blocked.
MongoDB also allows the administrator to configure the
Firewalls should limit both incoming and outgoing traffic MongoDB server to prevent the execution of Javascript
to/from a specific port to trusted and untrusted scripts. This will prevent MapReduce jobs from running,
systems. For best results and to minimize overall but the aggregation pipeline can be used as an
exposure, ensure that only traffic from trusted sources alternative in many use cases.
can reach mongod and mongos instances and that the
Physic
Physical
al Access Contr
Controls.
ols. In addition to the logical
mongod and mongos instances can only connect to
controls discussed above, controlling physical access to
trusted outputs. In addition, unneeded system services
servers, storage and backup media provides critical
should be deactivated.
environmental protection.
Binding IIP
P Addr
Addresses.
esses. The bind_ip setting for mongod
and mongos instances limits the network interfaces on
Database Monitoring & Upgrading
which MongoDB programs will listen for incoming
connections. Proactive monitoring of all components within an IT
environment is always a best practice. System performance
Running in VP VPNs.
Ns. Limit MongoDB programs to
and availability depend on the timely detection and
non-public local networks and virtual private networks.
resolution of potential issues before they present problems
Virtual Private Networks (VPNs) make it possible to link
to users.
two networks over an encrypted and limited-access
trusted network. Typically MongoDB users configure From the perspective of database security, monitoring is
SSL rather than IPSEC protocols for performance critical to identifying potential exploits in real time, thereby
advantages. reducing the impact of any breach. For example, sudden
Dedic
Dedicated
ated OS User Account. A user account peaks in the CPU and memory loads of host systems and
dedicated to MongoDB should be created and used to high operations counters in the database can indicate a
run MongoDB executables. MongoDB should not run as Denial of Service attack. MongoDB ships with a variety of
the root user. tools including mongostat and mongotop that can be used
to monitor your database.
File System P Permissions.
ermissions. The servers running
MongoDB should employ filesystem permissions that The most comprehensive monitoring solution is provided by
prevent users from accessing the data files created by MongoDB Ops Manager, which is the simplest way to run
MongoDB. MongoDB configuration files and the cluster MongoDB on your own infrastructure. Ops Manager makes
keyfile should be protected to disallow access by it easy for operations teams to monitor, secure, back up,
unauthorized users. and scale MongoDB. Ops Manager is available with
MongoDB Enterprise Advanced. MongoDB Cloud Manager
Query Injection. As a client program assembles a
is a hosted management tool for MongoDB providing many
query in MongoDB, it builds a BSON object, not a string.
of the same capabilities as Ops Manager.
Thus traditional SQL injection attacks should not pose a
risk to the system for queries submitted as BSON
objects.
11
infrastructure, user error, malicious activity, or application
bugs. With a backup and recovery strategy in place,
administrators can restore business operations by quickly
recovering their data, enabling the organization to meet
regulatory and compliance obligations.
12
MongoDB Atlas: Database as a Conclusion
Service For MongoDB
With databases storing an organizations most important
information assets, securing them is an essential first step
MongoDB can run the database for you! MongoDB Atlas
in countering new threat classes and actors.
provides all of the features of MongoDB, without the
operational heavy lifting required for any new application. As demonstrated in this white paper, with MongoDB
MongoDB Atlas is available on-demand through a Enterprise Advanced organizations benefit from extensive
pay-as-you-go model and billed on an hourly basis, letting capabilities to defend, detect and control access to
you focus on what you do best. valuable online big data. You can get started by reviewing
the MongoDB Security Documentation, and downloading
Its easy to get started use a simple GUI to select the
MongoDB Enterprise Advanced for evaluation today.
instance size, region, and features you need. MongoDB
Atlas provides:
13
Development Support helps you get up and running quickly.
Resources
It gives you a complete package of software and services
for the early stages of your project.
For more information, please visit mongodb.com or contact
MongoDB Consulting packages get you to production
us at sales@mongodb.com.
faster, help you tune performance in production, help you
scale, and free you up to focus on your next release. Case Studies (mongodb.com/customers)
Presentations (mongodb.com/presentations)
MongoDB Training helps you become a MongoDB expert,
Free Online Training (university.mongodb.com)
from design to operating mission-critical systems at scale.
Webinars and Events (mongodb.com/events)
Whether you're a developer, DBA, or architect, we can
Documentation (docs.mongodb.com)
make you better at MongoDB.
MongoDB Enterprise Download (mongodb.com/download)
MongoDB Atlas database as a service for MongoDB
(mongodb.com/cloud)
MongoDB Stitch backend as a service (mongodb.com/
cloud/stitch)
New York Palo Alto Washington, D.C. London Dublin Barcelona Sydney Tel Aviv
US 866-237-8815 INTL +1-650-440-4474 info@mongodb.com
2017 MongoDB, Inc. All rights reserved.
14
MongoDB Security Checklist
The checklist defines the steps, along with key resources, to creating a secure MongoDB deployment in your own
environment. Alternatively refer to the MongoDB Atlas section of the guide to learn more about using MongoDB as a
service.
Pr
Prepar
epare
e Secur
Secure
e Operating Envir
Environment
onment
Create MongoDB user account & Review platform-specific and filesystem documentation for creating OS logins
permissions and permissions
Monitor and apply latest patches Subscribe to the MongoDB Announcements Google Group for availability of
the latest releases and patches
Monitor patch alerts and updates for infrastructure (server, network and storage
components, OS, middleware, etc.)
15