Adeptus-Mechanicus

Main
Codex
Librarium Whitehat
Advisories
Blog Pics
"Inveniam viam aut faciam" : I will either find a way, or I shall make one


"WHAT-A-LOT-I-GOT" - INVENTORY

I do not think I know of one administrator that enjoys the task of keeping the inventory of who has what on their computer. It is for this very reason that lots of companies have made lots of money selling software solutions that help you to manage this. Now I hate paying money (I can think of so many other things I would rather do with it), so I have always tried to come up with other ways to accomplish this. There are free utilities that do audits, and through some heavy scripting and general messing around, I have always managed to keep track of whats where - but it was never pretty. So always on the look out for something nice to impress management with, I was very happy to find the new OCSInventoryNG (homepage here). A very nice program, free, runs on linux, has multiple agents, scriptable and looks pretty. What more could I ask for?

What is needed?
Big things first, you need a linux box with apache, mysql and perl on it. You then download the OCSNG linux server source code from the projects site. Then there are a couple of perl modules which are required...
perl -MCPAN -e shell
install Apache::DBI
install DBD::mysql
install Compress::Zlib
install Net::IP

Setup the server
This is mind-numbingly simple..
tar -xvzf OCSNG_LINUX_SERVER_1.0RC3-1.tar.gz
cd OCSNG_LINUX_SERVER_1.0RC3-1
./setup.sh

Running the setup.sh script triggers a whole bunch of questions, most of them are fine if you go with the default option, the one thing you must get right is your web servers document root. Anyway once you have finished this process, you need to restart your apache server and point a web browser to http://<server>/ocsreports. Once you go there it will ask you for the mysql server it can use, and then the username and password that can be used to work with the mysql server. You put that in and it then does it's thing. You may get an error about upload sizes and stuff, just edit your php.ini file and change the post_max_size and upload_max_filesize settings, I generally use 28M. Once the web based setup steps are done, going to http://<server>/ocsreports now presents you with your audit result management page. Many of the options are self-explanatory, but I still recommend reading the documentation.

Getting audit results
Like I mentioned earlier there are many different agents, the two official ones are for windows and linux, but there is an unsupported agent for MacOSX. Lets start with the windows agent;
  1. Download it from the homepage
  2. In the archive is the ocslogon.exe file
  3. Copy this to a folder where your logon scripts run from
  4. Rename the file to the IP address of the ocsinventory server, for example - 192.168.0.45.exe
  5. Add the following to your logon scripts - @\\server\netlogon\192.168.0.45.exe /deploy:4026 /np
The linux agent is just as easy;
  1. Download it from the homepage
  2. Unextract it - tar -xzvf OCSNG_LINUX_AGENT_1.0RC3.tar.gz
  3. cd OCSNG_LINUX_AGENT_1.0RC3
  4. chmod 700 ./setup.sh
  5. ./setup.sh
  6. <answer questions>
Thats it. Give it a day or two to get all your clients to logon and update their details, then go to http://<server>/ocsreports and find out just what is out there.

Final Words
All jokes aside, having an inventory of whats on your network and who has what installed is an immensely important resource for an IT administrator, and the OCSNG inventory package makes it a fairly easy thing to accomplish. Like all good open-source projects there is a lot more you can do with it, for example you can deploy packages using it - thats cool. So play around and as always learn and have fun.