I have a requirement to check security-based settings on Linux systems with MongoDB installed, and Bigfix is the tool we’ll use. If unfamiliar with it, Bigfix uses root to access and report on client data such as O.S. settings, existing files and content with them, etc., and it can do that without the need of running commands; in fact, doing so would probably not be green-lighted in our environment.
So I’d like to know if there’s a way to find the version of MongoDB installed without running a command or opening a Mongod shell (obvious I guess) and by just using root. For example, running:
mongod --version
Will show the installed version, but where is that command pulling the information from, and, is there a way to access it without the command?
Thank to all, and please let me know if more details are needed.
You requirement is a conundrum. Because what ever you do to find and inspect an executable you will always be running commands. A requirement that says ‘by only running basic OS commands’ would make more sense.
You probably can find the version of mongod using strings mongod as a starting point, but strings is a command. I assume that if mongod is able to print its own version number, then the version number is somewhere stored as one or multiple strings in the executable. You would then need to use grep, another command, to find the exact string. But that could change from one version to the other.
I’m curious how this information would be gathered without using a command using a process with root access?
All of these are commands: mongod --version would be a primary command to gather this information.|
Using package manager tools to list installed package version. mongosh --host localhost --eval 'db.version()'
Using a driver executing the buildInfo command and return the version field, also uses a ‘command’ node