CMSI 486: Welcome to Week 13
This Week's Class Agenda
- First Two Presentations
- Finish Database Security
Presentations — None But The Brave!
- Jay & Nguyen & Prochnow
- Derham & Ochsner & Wroblewski
- Any other brave volunteers?
Database Security Issues Wrap-up
Things to do to Make the Database Secure
Now that you have your server machine scanned and hardened, there are a good many things to be done that will
help secure your database at the database level. Some of these are mechanisms, and some are policy-level. In
either case, security of your database in today's environment is not really optional. Skip these activities
at your own peril! Since most organizations are facing nearly exponential growth in the amount of information
and data they must continuously manage and protect to ensure organizational success, it is critical to spend
the resources to ensure that the database is secure. Many cybercriminals are going after the database because
that is where the sensitive information resides. Someone who is looking to steal credit card information or
personal identities will not be interested in a simple DOS attack. With so much at potential risk, the people
who have control over the resources MUST secure the database, and must assume the role of stewards of the data
to ensure that business operations are not threatened.
Towards that end, here are a few things that are considered best practices
that can assist the DBA of
the organization to maintain acceptable levels of database security at the database application level:
- Keep the database on a server that is separate from the web server:
Instead, install the database on a separate server, located behind a firewall. Yes, this is a bit more
complicated to administer and maintain, but the security benefits FAR outweigh the additional resources
that are needed. Having the database and the web server on the same box means that an attacker only needs
to crack ONE administrator-level password to have access to everything.
- Encrypt stored files and backups: any files that have value to you
will have value to an attacker. If these files are stored on the application server or the database server
you should encrypt them. Unencrypted files can provide the keys to the city for all your data to be made
available to an attacker or worse, to the entire Internet. Don't forget that people in the organization
who once were trusted may change their minds and decide to do things with malicious intent. Encryption
is doubly important if your organization is subject to additional rules or constraints, such as HIPAA,
SOX, DoD, or other alphabet-name entities. The lesson is, encrypt any files that have value to the
organization, since anything that YOU value the bad guys will value, too.
- Use a Web Application Firewall (WAF): All web applications are
available to customers/constituents – as well as attackers – 24/7/365. For this reason, the
traditional IT security systems, such as firewalls or IDS/IPS, may be unable to guard against these
attacks or do not offer comprehensive protection. Web Application Firewalls filter, monitor, and block
HTTP traffic for web applications, which is different from a regular firewall because it can filter the
content of specific web applications. By inspecting HTTP traffic, it can prevent attacks from exploiting
most security flaws in a web application.
- Keep Patches Current: Websites that use third-party or COTS
software such as plug-ins are more susceptible to an exploit than those that have been patched with
current software updates. Keep patches current to the most recent releases, when possible. This does
NOT mean you need to turn on all your Windows Updates so that you get the update for the Unicode
currency symbol for the Zloty, which you'll never use. It DOES mean make sure that if a patch comes
down from a vendor, evaluate it and apply it if it makes sense. There is a handy browser add-on called
Qualys that can help.
- Enable Security Controls: Most DBMSs enable security controls by
default, but DBAs should still always check the security settings to make sure the stuff is turned on
and configured properly. Remember that organizations may rely on a web developer to create a secure
system, but the DBA is the captain of the ship for ensuring that security is maintained on an on-going
basis. Be sure to enable security controls on allem> databases and do not assume that this
is properly set up by default.
- Check user/client workstations: If users are allowed to have
restricted data on their workstatins, these workstations must meet minimum security requirements, and
the workstation should be protected by preventative measures such as locked screen savers, individual
account authentication, encrypted data, USB port disabling, encrypted e-mail systems, and a policy
which includes deletion of restricted data that is no longer needed.
- Database Roles, Permissions, and Reporting: The DBA creates one
or more specific
roles
in the system. Each role has a specific set of privileges or accesses
assigned. Users can then be assigned to one or more of these roles to allow access to the data which
they need to do their work [least privilege principle]. Strong passwords are enforced, and are required
to be changed on a periodic basis. Accounts should be locked out after a specific number of authentication
failures, requiring a DBA to unlock them. Only the DBA should have permission to grant or remove any
privileges associated with user accounts; *NO* users should be able to "trickle down" permissions, ehter
to their own account, or to any other user account. Reports should be generated periodically for the
DBA, showing which users accessed the database, what data was accessed, and the date and time of that
access. Also verify that the DBA is someone who is trustworthy, possibly even separating the roles of
DBA and database security administrator to separate people.
- Database Auditing: All accesses to the database should be
logged and tracked, and the logs should be retained for at least a year. The logs should be reviewed
periodically by someone knowledgeable in the database operations and intended usage, and a mechanism
should be in place to highlight anything questionable that is uncovered. Consider restricting access
to the most valuable information that you store on an as-needed basis. Report attempts to access this
information whether successful or not. Set alarms within the database that go off if anyone tries to
access information in the database that is not pertinent to their role or position, so that you can
question their motives.
- Database Backup and Recovery: Procedures and policies should
be in place [and enforced] to ensure that a comprehensive backup process is in place. Step-by-step
instructions should be provided for backing up the database, including responsible parties for all
related activities. Further, it is not enough to simply back up the data; there also needs to be a
procedure for restoring the data, and the restore process should be documented in a step-wise way and
should be tested at least once a year to ensure it is kept current and that related personnel know
how to implement it. Verify that the plan includes enough granularity for restoring the database to
its fully working state, including the hardware, in case there is a catastrophic failure or natural
disaster.
- Maintain One Version of the Truth: Assume that all of the
off-line copies of the data are stale as soon as they are written. Don't let users or DBAs store any
data locally on laptops or other non-secured assets, and ensure that the on-line database is the one
true version of the data at all times.
Some General Links for Further Exploration
Securing SQL Server
Securing MySQL
Checklist: Securing Your Database Server
Ten Most Wanted
What Students Need to Know
McAfee Data Center Security Suite
McAfee Vulnerability Manager for Databases
Securing Mongo
Several interesting things crop up when you look through the section of the Mongo book on Security [See chapter
20]. For one thing, we are told NOT to set up publicly addressable MongoDB servers. In fact, a quick read
through the Mongo manual starting/stopping section [chapter 20] has several interesting paragraphs:
- Data Encryption: As of this writing, MongoDB provides no built-in mechanism fo encrypting
data stored. If you require data to be necrypted, use filesystem encryption. another possibility is
manually encrypting certain fields (although MongoDB has no speial ability to query for encrypted values).
- SSL Connections: By default, connections to MongoDB transfer data unencrypted. However,
SSL connection support is available. Due to licensing issues the default builds do not have SSL, but you
can download a subscriber build at http://www.10gen.com, which supports
SSL. You can also compile MongoDB from source to enable SSL support.
- Logging: By default, mongod sends its logs to stdout. Most init scripts use
the
--logpath option to send logs to a file. MongoDB spits out a lot of log messages, but
please do not run with the --quiet option. Leaving the log level at the default is usually
perfect: there is enough info for basic debugging (why this is slow, why this isn't starting up, etc.),
but the log does not take up too much space.
By default, MongoDB logs information about queries that take longer than 100 ms to run. If 100 ms is
too short or too long for your application, you can change the threshold...
Backing up as single server installation of MongoDB is as easy as making a copy of the /data/db directory where
the data is stored. If there are replicated sets or clusters that need backing up, there are more involved
ways to do those things, but let's keep this part short.
Other than that, there isn't a whole lot of information in the MongDB book. However, on the mongo website,
there is a Security Checklist
which has the following items:
- Enable Access Control and Enforce Authentication:Enable access control and specify the
authentication mechanism. You can use the default MongoDB authentication mechanism or an existing external
framework. Authentication requires that all clients and servers provide valid credentials before they can
connect to the system. In clustered deployments, enable authentication for each MongoDB server.
- Configure Role-Based Access Control: Create a user administrator first, then create
additional users. Create a unique MongoDB user for each person and application that accesses the system.
Create roles that define the exact access a set of users needs. Follow a principle of least privilege.
Then create users and assign them only the roles they need to perform their operations. A user can be
a person or a client application.
- Encrypt Communication: Configure MongoDB to use TLS/SSL for all incoming and outgoing
connections. Use TLS/SSL to encrypt communication between mongod and mongos components of a MongoDB
deployment as well as between all applications and MongoDB.
- Encrypt and Protect Data: Starting with MongoDB Enterprise 3.2, the WiredTiger storage
engine’s native Encryption at Rest can be configured to encrypt data in the storage layer.
If you are not using WiredTiger’s encryption at rest, MongoDB data should be encrypted on each host using
file-system, device, or physical encryption. Protect MongoDB data using file-system permissions. MongoDB
data includes data files, configuration files, auditing logs, and key files.
- Limit Network Exposure: Ensure that MongoDB runs in a trusted network environment and
limit the interfaces on which MongoDB instances listen for incoming connections. Allow only trusted
clients to access the network interfaces and ports on which MongoDB instances are available.
- Audit System Activity: Track access and changes to database configurations and data.
MongoDB Enterprise includes a system auditing facility that can record system events (e.g. user operations,
connection events) on a MongoDB instance. These audit records permit forensic analysis and allow
administrators to verify proper controls.
- Run MongoDB with Secure Configuration Options: MongoDB supports the execution of JavaScript code
for certain server-side operations:
mapReduce, group, and $where.
If you do not use these operations, disable server-side scripting by using the --noscripting
option on the command line.
Use only the MongoDB wire protocol on production deployments. Do not enable the following, all of which
enable the web server interface: net.http.enabled, net.http.JSONPEnabled, and
net.http.RESTInterfaceEnabled. Leave these disabled, unless required for backwards
compatibility.
- MongoDB Configuration Hardening: Ensure that the HTTP status interface, the REST API,
and the JSON API are all disabled in production environments to prevent potential data exposure and
vulnerability to attackers.
More configuration information is available at:
Administration:
Configuration and Maintenance. There is also a great deal of configuration information on the
MongoDB Server Parameters page.
- Run MongoDB with a Dedicated User: Run MongoDB processes with a dedicated operating
system user account. Ensure that the account has permissions to access data but no unnecessary permissions.
Securing Neo4J
There are a couple of things to note about Neo when setting up security. First, think about the actual use
that the database will be filling. If it is a toy or small-scale database on a single box with no outside
users, and no connection directly to the Internet, you may not need anything other than the default. At the
other end of the scale, you might have hundreds or thousands of users who access your data from the Internet.
This latter situation fairly screams for as much security as you can muster. The second scenario also will
require that you set up a high availability cluster
also called an HA-cluster
.
Important things to note [different on windows, but you guys all have macs, right?]; on mac, the conf
directory is under the installation folder/diirectory where neo was installed. On Windows, it's in your
hidden AppData
folder under your user account:
- the server's primary configuration file is found in:
conf/neo4j-server.properties
- the
conf/log4j.properties file contains the default server logging information
- the
conf/neo4j.properties file also contains low-level performance tuning parameters
- the
conf/neo4j-wrapper.properties file contains daemon configuration information
The first thing to do to ensure your data is secure is to set up a backup plan. You've heard me speak at
some length of the different types of backup, full, incremental, disaster, daily, and so on. Regardless of
the type of backup you use, you should have some kind of plan in place. For Neo, you must first set up the
configuration parameter enable_online_backup=true which will make the backup service available
on the default backup port of 6362. You can use any port you wish, as long as you specify which port in the
parameter. For example, you can use port 9876 by specifying enable_online_backup=port=9876. At
that point, backup is done with a simple command:
<running mode>://<host>[:port]{,<host>[:port]*}
the running mode is defined as either single
for non-HA clusters, or ha
for HA
clusters.
Next, here are some standard configuration items that should be decided upon and configured:
- Set the location on disk of the database directory:
org.neo4j.server.database.location=data/graph.db
Note that on Windows systems, absolute locations including drive letters need to read "c:/data/db"
- Specify HTTP server port supporting data, administrative, and UI access:
org.neo4j.server.webserver.port=7474
- Set the location of the round-robin database directory which gathers metrics on the running server
instance
org.neo4j.server.webadmin.rrdb.location=data/graph.db/../rrd
- Set the URI path for the REST data API through which the database is accessed. For non-local access,
consider to put in the external hostname of your server instead of localhost, e.g. http://my.host:7474/db/data
org.neo4j.server.webadmin.data.uri=http://localhost:7474/db/data/
- The management URI for the administration API that the Webadmin tool uses. If you plan to connect to the
Webadmin from other than localhost, put in the external hostname of your server instead of localhost,
e.g. http://my.host:7474/db/manage
org.neo4j.server.webadmin.management.uri=http://localhost:7474/db/manage
- Low-level performance tuning parameters can be explicitly set by referring to the following property:
org.neo4j.server.db.tuning.properties=neo4j.properties
If this property isn’t set, the server will look for a file called neo4j.properties in the same
directory as the neo4j-server.properties file.
If this property isn’t set, and there is no neo4j.properties file in the default configuration directory,
then the server will log a warning. Subsequently at runtime the database engine will attempt tune itself
based on the prevailing conditions.
- The fine-tuning of the low-level Neo4j graph database engine is specified in a separate properties file:
conf/neo4j.properties
The graph database engine has a range of performance tuning options. Note that several factors other
than Neo4j tuning should be considered when performance tuning a server, including general server load,
memory and file contention, and even garbage collection penalties on the JVM
- The logging framework in use by the Neo4j server is java.util.logging and is configured in the normal
conf/logging.properties file. By default it is set up to print INFO level messages both
on the screen and in a rolling file in the data/log directory. Most deployments will
use an individually specified configuration here to meet local standards. During development, a great
deal of useful information can be found in the logs; therefore, some form of logging is well worth
maintaining. To completely silence the console output, set the configuration to:
java.util.logging.ConsoleHandler.level=OFF
Apart from log statements originating from the Neo4j server, other libraries report their messages
through various frameworks.
Neo4J does not enforce security on the data level by default. This is something to be aware of when you install
the application. You should also know this for use in any project demonstrations, since questions of the
security of the database are a hot topic and are ripe for questions. Not only that, but it's just good sense
to ensure that the data is properly secured.
Securing Access
There are several things that should be done for security. Here is a checklist, with links to the relevant
sections of the Neo4J operations manual:
- Deploy Neo4j on safe servers in safe networks:
- Use subnets and firewalls.
- Only open up necessary ports.
For a list of relevant ports see
Section 3.2,
Ports
.
- Run Neo with a proxy, and limit the access to specific IP addresses, URL patterns, and/or
IP address ranges. This method can be used to make different clients from different request
sources respond in different ways.
- RUn Neo as a non-root user on a port less than 1000 [e.g., port 80], especially on a
UNIX/Linux system.
- Protect data-at-rest:
- Use volume encryption (e.g. Bitlocker)
- Manage access to database dumps [(]refer to
Section 10.3] and backups
[(]refer to Section 6.2].
In particular, ensure that there is no external access to the port specified by the setting
dbms.backup.address [(this ]defaults to port 6362]. Failing to protect this port leaves
a security hole open by which an unauthorized user can make a copy of the database onto a different
machine.
- Manage access to data files and transaction logs. Prohibit all operating system access
to Neo4j files except as instructed in
Section 3.1.3,
Permissions
.
- Protect data in transit by only opening up for encrypted HTTPS
- Use SSL certificates issues from a trusted Critificate Authority
- Stay on top of any custom extensions you install, to make sure they are patched and up-to-date
- Ensure the correct file permissions on the Neo4j files. Only the operating system user that Neo4j runs
as should have permissions to those files.
- If
LOAD CSV is enabled, ensure that it does not allow unauthorized users to import data.
- Do not turn off Neo4j authentication.
- Survey your neo4j.conf file for ports relating to deprecated functions [(]such as neo4j-shell, controlled
by the parameter
dbms.shell.port]
- Use the latest patch version of Neo4j.
Notes cribbed from: Section 7 of the
Neo4J on line manual.