Checking access to files on a server

So recently I put some files up on a file server I rent with a couple of mates, mostly ones used in my CV so that prospective employees can check papers etc that I have written. In an attempt to try and figure out who has accessed these files I, with the help of my friend Paul wrote a smal script that uses the access log, grep and whois to figure out the domains that have accessed the file. To be honest its a small script, and if I had more experience with bash I probably could have written it myself. In fact, if Paul had wanted to, I know he could have written it no problems, but it was all experience. In case someone wants to use it, here it is.

#!/bin/bash

FILE=”/tmp/$(basename $0).$RANDOM.$$.txt”;

echo Searching for access to files with $1;

sudo cat /var/log/apache2/access.log | grep -i *PUT YOUR NAME HERE* | grep $1 > $FILE;

if [ -z "$2" ]
then
echo “no exclusions”;
else
echo “excluding files containing $2″;
cat $FILE | grep -v $2 > $FILE;
fi

cat $FILE | cut -d ‘ ‘ -f 1 | sort | uniq -c > $FILE;

for i in $(cat $FILE)
do
echo -ne “$i    -       “; whois $i -H | egrep ‘OrgName|descr’ | head -n 1 | cut -d ‘:’ -f 2;
done

To use it, just copy the script (replacing the part that says *PUT YOUR NAME HERE* with your username) into a file, set it as an executable using  chmod +x, then run it. The first argument is the string you are looking for access to, e.g. pdf will show all pdf’s, and there is a second optional string for if you want to exclude files with names containg a certain string.

Where I’ve been…

So it has been a while since my last post, and while thats nothing really unusual, I actually have things to post about, so I thought I better get round to doing them.

First off, my new job. As I said in my last post I had a pretty quick turn about from the first interview to starting work (phone call on the Tuesday concerning an interview, started work the following Monday). Things are going not too badly here, now that I’m settling into the role. The job is working for a company called TechCertain, who develop, maintain and operate a system which handles the paper work for insurance companies online (issue proposals and policies, automatic quoting/underwriting e.t.c.). My role is the companies Business Analyst. My main job is to work with the clients to determine what it is they need, and then work out how we are going to acheive this. I also do a lot of the companies research and development (more on that later), write the front end for the clients, and manage the development team (read: the other guy who works mostly on the backend haha). The language is VB .net and Microsofts SQL, which is actually pretty funny because the day I started this job I had never worked on or studied either of these, so I pretty much had to learn all of that on top of everything else that comes with a new job.

I mentioned before that the company had some R&D going on. Seems strange for a simple web application company like us to have R&D but it’s true. Currently we are looking into porting our code over to mono, and we are looking into running our service on a cloud rather than the server it is currently on, so at least that is keeping me busy.

In the next few weeks I am also moving into a house up here in Auckland, which will be great because I have been living in my friends parents garage since moving up here (it’s not nearly as bad as it sounds) but it’ll still be nice to have a real room e.t.c.

One last thing. I just wanted to say good work to the team that made Ubuntu Rescue Remix. A friend of mine has an 8 year old Acer Travelmate 240 sitting at home, and recently it started telling him that there was imminent drive failure, and refused to log into windows anymore. Using the rescue remix I was able to create a live cd, boot into the command line, plug in my flash drive, and rescue thousands of files off his laptop for him. Now all he has to do is go through and sort them all manuallly.

What a week…

Last week I received a phone call on Tuesday about a possible position at a software company in Auckland. The next day I travelled up for an interview and by the time I returned that night I had my first job out of university. I moved up yesterday and started my new job today, so it’s been a very hectic week as I’m sure you can imagine. I am now the Client Services Officer and Business Analyst for TechCertain, a very small company who sells ’software as a service’ to a major insurance vendor here in New Zealand. I’m not entirely sure how much I’m allowed to say of what it is we actually do, so to stay on the safe side of things I’ll leave it up to you to search for more information on them if you are intereseted.

In terms of time spent doing my own things it means I am having to dedicate all my free time to trying to find a place to live, as at the moment I am staying with friends while looking. This basically means that I will have no time for anything until I find a place. Even once this is done I am not sure how much time I will be able to spend on personal projects, as I am not sure how much of my time this job will take.  In saying that if anyone is interested in having a look at the MPLS in FreeBSD code let me know, as I would greatly appreciate some help in not only trying to get the ball rolling on this project again, but also someone to help motivate me into finding the time to work on the project.

Just a Quick Update

This is just a quick post to let people know that I have joined LinkedIn. If anyone out there wants to then feel free to add me on there.

Also, the job front is looking good. I have a job lined up in Wellington that I shall hopefully hear back on in the next few weeks. and once everything is sorted I will be able to start working on MPLS again.

Thats all for now.

Statistics overload

So this morning I installed StatPress-Reloaded on my private blog, and within a few hours I was told about Google Analytics. Seeing as I had noticed that this was already installed on my FreeBSD blog, so I have now removed StatPress, and have signed up for GA on both of my blogs. I’m hoping this will give me an idea of who is reading my blog, and checking on my insights into the world.

In other news I shall be posting an update in a few days about where I am at the moment in terms of my life, and why I havent been posting that much since university finished.

Summer of Code

So the announcements have been made, and I am happy to announce that I was accepted as a Google Summer of Code participant for 2008!! This is pretty awesome news for me, seeing as it’s great for my C.V, and its going to push me to develop something actually usable, for the first time. I will be working on implementing MPLS in FreeBSD, and yes, for those of you keeping track, that is the same project I am doing as part of my PostGrad Diploma in Computer Science at Waikato University this year.

There is an upside thou, cause now I have the support of the whole FreeBSD community to help me work on this project, as well as having a few extra dollars in the bank to help pay back some of those bills that we students often get. So, and I know I say this alot, but now I will be working on this project a lot, and that should hopefully result in a few extra posts that I can flood the net with. Good times ahead.

University in all its glory

So this year I am enrolled in what will (hopefully) be my last year of university. I’m doing a postgrad diploma this year in computer science, after graduating with my BSc in computer science last year. As part of my postgrad diploma, I have to undertaken a 6 month dissertation paper. For my dissertation I am attempting to implement the MPLS networking protocol into the FreeBSD operating system. I have to admit, its pretty scary. I havent done anything like this before. The amount that this has taught me so far is pretty incredible though. Through my flat mates I have learnt about setting up and using svn repositories, using virtual machines, and all the stuff I’ve been having to learn about FreeBSD and how to use it and how it works.

So far I have managed to set up my work environment exactly how I want it now, and I have started working on the actual code. That in itself has been another huge learning curve, its been years since I wrote anything in C, and I have never hacked on a kernel before. I haven’t gotten very far in just yet. Right now I’m still working on getting the initialisation of the MPLS type working, then once thats done I’ll start working on the input and output functions, and hopefully get some label switching of packets done in the next couple of months.