Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-11226

Mongod cannot use relative file paths for keyFile if --fork is enabled

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.5.4
    • Affects Version/s: 2.4.6
    • Component/s: Security
    • Labels:
      None
    • Environment:
      OSX 64, Linux 64
    • Linux
    • Hide

      1.) set up a keyfile and all other necessary directories to run mongod

      2.) Run

      mongod --dbpath /data/db --logpath /tmp/log --keyFile  myKeyFile 

      from the directory that contains your keyfile and assure that it is starting up properly

      3.) Now run

      mongod --dbpath /data/db --logpath /tmp/log --keyFile  myKeyFile --fork 

      in the same directory and watch it fail

      4.) Note that changing the myKeyFile path to be absolute allows mongod to start

      Show
      1.) set up a keyfile and all other necessary directories to run mongod 2.) Run mongod --dbpath /data/db --logpath /tmp/log --keyFile myKeyFile from the directory that contains your keyfile and assure that it is starting up properly 3.) Now run mongod --dbpath /data/db --logpath /tmp/log --keyFile myKeyFile --fork in the same directory and watch it fail 4.) Note that changing the myKeyFile path to be absolute allows mongod to start

      When running a mongod with a keyfile given on the command line, both full file paths and file paths relative to the working directory are acceptable input for the keyFile argument. That is, both keyFile /home/usr/keys/myKeyFile and keyFile myKeyFile should both work, assuming myKeyFile exists in the working directory.

      However, if one enables fork along with keyFile only the full directory path starting from root is acceptable. Using a local filepath from the working directory will result in

      error getting file myKeyFile: No such file or directory

      and cause mongo to fail on startup.

            Assignee:
            matt.dannenberg Matt Dannenberg
            Reporter:
            kyle.erf Kyle Erf
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: