One of the things that has happened at work, since before I got here, was there was an increasing line between development and configuration management. This was started with good intentions – the CM wouldn’t be around, so a developer was given access to do something, with the understanding only to do it when the CM wasn’t here. As you can imagine, over time this was taken advantage of. So it is being reeled in and the line is getting harder to cross.
This has been met with a little resistance as you can expect, with people being used to have access to certain things, etc. One developer/Business Objects owner has had this sort of access. I’m not clear if it was recently taken away, but I was asked to provide this person with trace and log files, and off the bat this was not a big deal if it’s once or twice, but it looks like this is ongoing. So I decided to automate it.
The easy way to do this (and the route I took) was to use python as a web server with the following command:
python -m SimpleHTTPServer [port]
This will make the current directory into a listing via the port you specify. The problem is that it sorts by name and doesn’t include information like the date, etc. This can be a problem cause the user didn’t know which files were needed. Ok let’s fix that. I wrote the following bash script (I removed the declaration of the variables):
ls -lt > $FILE # get directory listing
sed -i '1i' $FILE # beginning HTML tags echo "" >> $FILE # ending HTML tags
sed -i 's/ /\t/g' $FILE # replace spaces with tabs
sed -i 's/$/
/' $FILE # force new lines
What this does is listed in the comments, but it also makes the file appear at the top of the list for the web server. A little bit of a hack fix, but close enough. But what happens when the files change, as they are bound to do during the course of the day. Well, let’s just add something in crontab.
*/10 7-18 * * 1-5 $DIR/DirListingBobJ.sh >/tmp/dirbobj.out 2>&1
This will run it every 10 minutes, 7 am to 6 pm, M-F and output it to a file for debugging.
Overall, this was a nice break from working security controls.