Showing posts with label MongoDB. Show all posts
Showing posts with label MongoDB. Show all posts

Monday, January 9, 2017

'MongoDB with Replication' Security Issue


[UPDATE 2017-01-11]

The steps to restrict access to port 27017 on Google Cloud Platform have been updated

[UPDATE 2017-01-10]

The Bitnami Team has been working on creating new guides to securing the database and recovering the data using MongoDB Oplog. Please find below the "How to enable authentication for securing your installation" and "Restoring your database" sections below.

----

In the past few days, it has been reported that attackers have been scanning for and vandalizing unsecured MongoDB databases accessible over the internet. (See https://www.scmagazine.com/mongodb-databases-under-attack-worldwide/article/629601/)

Our security team follows these reports closely and began a review of our existing images. As a result, we confirmed Bitnami virtual machines and single cloud images are not vulnerable to this attack because they require the administrator to authenticate. However, one Bitnami listing is vulnerable when left in it’s default configuration: Bitnami’s MongoDB with Replication. This template is offered in Google Cloud Launcher and Microsoft Azure.

We are working with Google to remove and replace the template on the Google Cloud Launcher.  If you launch or have launched a “MongoDB with Replication” application prior to version 3.4.1, please take immediate steps to secure your application, instructions below.

For Microsoft Azure users, a replacement template, which implements MongoDB authentication to prevent users from remotely performing CRUD operations on the database, is available now in the Azure Marketplace here. The fixed template version is MongoDB 3.4.1-0 (Debian 8).

While the scale of the attack across the internet was large, only a small number of Bitnami users were affected and not already secured. We are working with the cloud vendors to contact these users and replace the default settings. In the meantime, if you think your installation could be affected, please see below for steps that you can take to safeguard your data.

If you are currently using installations based on the Bitnami MongoDB with Replication template that have not already been secured:

The following steps are recommended immediately


1. Restricting external access to default port 27017
2. Enabling authentication to secure your installation
3. Restoring your database

How to restrict access to port 27017 on Google Cloud Platform

1. Login to Google Cloud Platform.
2. Using the left hand menu, navigate to the “Networking” section.
3. Under the networking section choose “Firewall Rules”.


In this section find the firewall rules that correspond with your MongoDB instance. If you launched through the Google Cloud Launcher the name is likely to be “mongodb-multivm-1-node-0-firewall”.

4. Click on the 'Firewall Rule Details' for each MongoDB instance to show firewall rules details:


5. Remove port 27017 from the list of allowed protocols and ports. Remove the bitnami-mongodb tag if it is set.


6. Click “Save”.

7. Using the left hand menu, navigate to the “Compute Engine” section. In this section find the instances that correspond with your MongoDB deployment. Look for the different nodes of the deployment, if you launched through the Google Cloud Launcher the name is likely to be “mongodb-multivm”.

8. Remove the bitnami-mongodb tag in all the instances if it is set.



9. Click “Save”.

Thursday, March 27, 2014

MongoDB available in Bitnami Cloud Hosting


We are happy to announce that we have recently added support for MongoDB in our Bitnami Cloud Hosting platform. Our latest Ubuntu 12.04 base image includes the MongoDB 2.4.9 version. Other Bitnami base stack components have also been upgraded. The complete changelog is available in our wiki page.

If you want to launch a MongoDB machine in Bitnami Cloud Hosting, you will need to select it in the "Development Options" section as shown at the screenshot below.



You can now launch the machine. Once the machine is up and running, you are able to connect there via SSH and access your MongoDB instance.



For security reasons we do not make the MongoDB service available remotely by default. It is only available for local web apps. You can find more information about MongoDB and remote access in our documentation:


Please note that "installdir", the name often used in our documentation, stands for the Bitnami stack location directory, and it is the '/opt/bitnami' directory in case of Bitnami Cloud Hosting machines. It means that the MongoDB files are located in the /opt/bitnami/mongodb directory.

If you are interested in creating a sample application, you may take a look at one of our previous blog posts in which we introduced the Bitnami MEAN stack: MEAN stack for BitNami: MongoDB, Express, AngularJS & NodeJS.

When you select MongoDB in the development options, we also include the RockMongo web application in your Bitnami Cloud Hosting machines by default. This application is for MongoDB the same what phpMyAdmin is for MySQL, and makes it easy to manage your MongoDB instance using the GUI web console. For security reasons, you need to create an encrypted SSH tunnel to be able to access it remotely, and we explain in detail how to do it in this wiki article.


One interesting use case is how to access your MongoDB database remotely. Sometimes you want to develop your application locally and have access to your remote MongoDB. We do not make MongoDB available remotely by default in Bitnami Cloud Hosting. The MongoDB is running on port 27017 but it is attached to the 127.0.0.1 interface so you can only access it from localhost, inside of the cloud machine. If you want to connect to MongoDB from the external machine, first you will need to change the MongoDB config file /opt/bitnami/mongodb/mongodb.conf
and comment out the bind_ip line as shown below

/opt/bitnami/mongodb/mongodb.conf

# bind_ip = 127.0.0.1
port = 27017

Restart the MongoDB service executing the following command to apply the config changes:

$ sudo /opt/bitnami/ctlscript.sh restart mongodb

Finally, you need to open the port 27017. We highly recommend to limit an access to the port only to your IP address, as it has been shown below. Please also learn more at this page:



Once it is done, you can connect to your MongoDB from your local machine:

$ mongo admin --host bitnami-demo-mongodb.bitnamiapp.com:27017 -u root -p
Enter password:
connecting to: bitnami-demo-mongodb.bitnamiapp.com:27017/admin
>



Thursday, November 14, 2013

MEAN stack for BitNami: MongoDB, Express, AngularJS & NodeJS

http://bitnami.com/stack/mean

We are glad to announce that MEAN stack has been released as part of the BitNami Library! The MEAN acronym was introduced by Valeri Karpov from the MongoDB team in this blog post and stands for MongoDB NoSQL database, Express, AngularJS and NodeJS.


In addition to these components, the stack also ships some useful development tools:
  • - Apache
  • - MongooseJS
  • - Bower
  • - Git
  • - RockMongo, a MongoDB web administration tool (optional, will automatically install PHP as well)
BitNami MEAN stack is available for free from the BitNami app store as a native installer or virtual machine for local development, or as a cloud template for the Amazon and Windows Azure cloud computing platforms.

BitNami MEAN stack installer welcome
BitNami MEAN stack installation

Once the installation process has been completed, you can access the welcome page from your browser at http://localhost on Windows or http://localhost:8080 on OS X or Linux. If you have enabled RockMongo during the installation you can also manage your MongoDB from this web application.


BitNami MEAN stack welcome screen
RockMongo, MongoDB administration tool

Because BitNami MEAN stack is self-contained, it runs independently from the rest of the software or libraries installed on your system, and you will need to load specific environment variables. BitNami stacks ship a script that loads this environment for all platforms we support. Note that this applies mainly to native installers, not for Virtual Machines or cloud images.

For instance, you can create your first Express application running the following command from a Terminal:

$ ./use_meanstack
$ express testapp

Now you can deploy your your first Express application.

$ cd testapp
$ node app

The following sample application uses the MongoDB driver for Node.js. You can clone this project from GitHub repository:

$ git clone https://github.com/vkarpov15/mean-stack-todo

Then edit the "app.js" file to change the default MongoDB connection. This example uses the "admin" database and the "root" user.

var db = Mongoose.createConnection('mongodb://root:PASSWORD@localhost/admin');

Then, check that MongoDB is already running in the graphical manager tool and start the sample application:

$ node app

You can see something similar to this at http://localhost:3000

MEAN sample application

We documented more details and more features of MEAN in our Quick Start Guide. Do you have questions? We will be happy to help you at our community forum!