Stupid MongoDB Question



  • Hey all,

    For the life of me I can't find any MongoDB documentation about the database password. All of my searches pull up dozens of articles on resetting user passwords for various popular implementations of MongoDB. I want to beef up security (if this even does that) and clear this warning I get when I start nodebb:

    21/3 20:39 [9041] - info: Initializing NodeBB v1.0.2
    21/3 20:39 [9041] - warn: You have no mongo password setup!

    Is there a simple, DB noob friendly way to put a password on this thing without breaking my forum?

    Thanks in advance..





  • @charles said:

    @Dielan try this https://docs.mongodb.org/manual/tutorial/enable-authentication/

    Before I do that, where do I configure the db user and password for NodeBB? do I add it to config.json ? I remember it was an option in the GUI when I ran npm to install the forum in the first place, but I don't know where to change it now.



  • @Dielan the web installer add info to the config.json so you can modify it to match your db and user



  • @charles said:

    @Dielan the web installer add info to the config.json so you can modify it to match your db and user

    I think i'm confused. This is what config.JSON looks like now:

    root@xxx:/NodeBB/nodebb# cat config.json

    {
        "url": "http://xxx:4567",
        "secret": xxx,
        "database": "mongo",
        "port": 4567,
        "mongo": {
            "host": "127.0.0.1",
            "port": "27017",
            "username": "mongodb",
            "database": "0"
         }
    }
    

    Obviously I x'd out some things in there for privacy. What do I need to add exactly?



  • @Dielan if you create a mongo user called nodebbuser and the database to be nodebbdb then it will look like this

    {
        "url": "http://xxx:4567",
        "secret": "xxx",
        "database": "mongo",
        "port": 4567,
        "mongo": {
            "host": "127.0.0.1",
            "port": "27017",
            "username": "nodebbuser",
            "database": "nodebbdb"
        }
    }
    

  • Plugin & Theme Dev

    @Dielan

    add the password with in "mongo": { }

    so your config.json would look like this

    {
        "url": "http://xxx:4567",
        "secret": xxx,
        "database": "mongo",
        "port": 4567,
        "mongo": {
            "host": "127.0.0.1",
            "port": "27017",
            "username": "mongodb",
            "password": "mymongopwd",
            "database": "0"
        }
    }
    

Log in to reply
 

Looks like your connection to NodeBB was lost, please wait while we try to reconnect.