Page 1 of 1

WMI Authentication file

Posted: Wed Jul 20, 2016 7:30 am
by het.shah
How to use authentication file in Windows WMI wizard?
where we do have to keep it, what is the format for content of that file?
which permissions are required to give to that file? :?:

Re: WMI Authentication file

Posted: Wed Jul 20, 2016 10:19 am
by mcapra
Using check_wmi_plus.pl, the authentication file is simply used to hold the credentials for the account you're using. It's an alternative to typing in the username/password for the check directly.

Without an authentication file, we might execute a check from the CLI by doing something like this (with username "admin" and password "welcome123$"):

Code: Select all

[root@localhost libexec]# ./check_wmi_plus.pl -H 192.168.3.170 -u admin -p welcome123$ -m checkfileage -a "c:/users/mcapra/documents/test.txt"
OK - Age of File c:/users/mcapra/documents/test.txt is 25 days 18:13:44 (37093min) or 618.23hr(s).|'c:/users/mcapra/documents/test.txt Age'=618.23hr;
Instead of passing the credentials to the command directly, we can instead store them in a file and add a layer of obfuscation for additional security. That file might look something like this (I named mine wmi_auth_file):

Code: Select all

username=admin
password=welcome123$
domain=WORKGROUP
And we can then use this authentication file with the check_wmi_plus.pl plugin as the -A argument like so:

Code: Select all

[root@localhost libexec]# ./check_wmi_plus.pl -H 192.168.3.170 -A wmi_auth_file -m checkfileage -a "c:/users/mcapra/documents/test.txt"
OK - Age of File c:/users/mcapra/documents/test.txt is 25 days 18:16:53 (37096min) or 618.28hr(s).|'c:/users/mcapra/documents/test.txt Age'=618.28hr;
So with the WMI wizard, you would simply create the above file (that I named wmi_auth_file) and tell the wizard where it is located. For permissions, giving the nagios group (or the apache.nagios user) read access to the file should be enough.