The Hacker’s Blog

Your friendly neighborhood hacker!

Tuesday, July 8, 2008

Automatically upgrading Ubuntu Linux!

Ubuntu has quickly became one of my favorite Linux distros to use, however, its slowly falling behind to others such as Gentoo, Debian and Slackware. I still use it on my home file server, though. It seems to work really well for that.

The Problem

The big problem for me is keeping my server up to date. I always like to be running the most current version of all software available, even if it is on a server. I’ve upgraded to Hardy Heron and am looking forward to the release of Intrepid Ibex.

I run on a DSL connection so my bandwidth is pretty limited. I normally don’t like to have to put up with a slow connection because I’m downloading updates to my server. This leaves me with the option to download the updates at night while I’m asleep. However, its kind of hard to start a download at 3:00 A.M. while you’re asleep, isn’t it? No, not really. Here’s how.

The Solution

There are two things that every Ubuntu user should know about. The first is using apt to update your system and install software. The second is cron. Cron is a utility/daemon that is used to run specified scripts at a certain time.

The first step to setting up your computer to auto update itself is figuring out what command you need to update and upgrade while allowing everything to be installed. It looks something like the following:

apt-get -y update && apt-get -y –force-yes upgrade && apt-get -y –force-yes dist-upgrade

If you run that manually, it will fetch the information for all packages to be updated and then begin installing them.

The second and probably most complicated step is setting up cron. Start by creating a file called apt-get.cron. In this file you need to enter the time and command you want to run. Let’s say we want to update our computer every Monday at midnight. The first part of our file should look like this:

0 0 * * Mon

This tells cron to run on the 0th minute of the 0th hour of every Monday of every Month. The next step is to specify the user (which needs to be root for apt to work correctly). Adding in the user and command should leave you with something looking like:

0 0 * * Mon root apt-get -y update && apt-get -y –force-yes upgrade && apt-get -y –force-yes dist-upgrade

Next, add the cron file to cron by running (as root)

crontab apt-get.cron

Keep in mind, that running the previous command will remove all other cron jobs in your crontab.

The Glorious End

Now your computer should be all set up for auto updating. Give it a try. Sit in front of your computer and wait until your script runs. Then check the logs to make sure it ran. Or, if you want, just leave it be and check it some other time.

posted by prime at 6:10 pm  

Tuesday, July 8, 2008

Installing and configuring Snort IDS

Snort is an Intrusion Detection System commonly used on Linux computers and servers. It contains a set of rules that it uses to verify all activity on the computer. I will be using Ubuntu for this installation. (more…)

posted by prime at 6:04 pm  

Tuesday, July 8, 2008

Installing and configuring LDAP

For this paper, I will be using Ubuntu as the host operating system of both the client and server. LDAP (short for Lightweight Directory Access Protocol) is a protocol used on servers to allow for SSO (single sign on) for users. In other words, LDAP allows for users to access their files and account from any computer that has the LDAP server specified as the login server. LDAP is useful in many environments ranging from schools and homes to small and large businesses. (more…)

posted by prime at 6:01 pm  

Tuesday, July 8, 2008

Checking for open doors - Using NMap

Ever try to break into a house but you didn’t know what entrances were open for you? I know its happened to me before (long story - maybe some other time). Trying to break into a computer that you are unsure of which entrances are open can be just as frustrating. Just like breaking into a house, there are two ways we can approach this. The first is brute force which means we try each and every way. This can become very tiresome and time consuming (especially with those second and third story windows…). The second is just to give up and move onto an easier target where everything is laid out for us. But where is the fun in that? Eh?

Just as every house has doors and windows, every computer has ports. Unfortunately, they have a huge range of ports (tens of thousands). Now who wants to sit back and try to get into each and every one of those ports? Definitely not me.

Lucky for us there’s something that can help. Its called NMap and is used to scan a computer for open ports - hence the term ‘port scanner’. When we run NMap, it does its thing and then returns a list of ports and what is using on them. This gives us an idea of what is being ran on the computer and where we can get into it from.

The first step to using NMap (as it is with any software) is installing it. Most Linux distrobutions will have NMap in a repository, so if you’re using Linux, it won’t be that hard to install. However, if you are running Mac OS X, Windows or just feel like being hardcore and compiling from scratch, you can download NMap from its website.

After you get NMap installed (you did install it, right?) let’s try it out by checking out what is running on your current computer. As we all know, we can reference the computer we are using in three different ways. Can anyone name them? I can!

  1. 127.0.0.1
  2. localhost or another network name for your computer
  3. Your network IP

For the sake of ease, I’m going to be calling my computer localhost. Run NMap on yourself using:

nmap localhost

This will return all open ports on your computer and what services are running one each port. For example, mine returns:

PORT STATE SERVICE
22/tcp open ssh
80/tcp open http
443/tcp open https
3306/tcp open mysql

Those are all the ports and services that I have running on my Gentoo server at home. Don’t think you’re going to break into it - none of the ports are accessible from the outside.

You can extend the results returned by adding extra arguments to your NMap command. Normally, to get good results, I run:

nmap -A -T4 localhost

-A means to enable OS (Operating System) and version detection. -T4 is used for faster execution.

When I run NMap -A -T4 it returns the versions of the software I have running and it also makes an educated guess at what OS is running. For example, it tells me that the http server is Apache httpd and that I’m running OpenSSH 4.7 (protocol 2.0). All of this is useful information, especially if you’re trying to find a software exploit for a system.

If NMap has caught your eye and you’d like to work more with it, let me know. I plan on going a bit further into the use of NMap in another article soon. Have fun and remember - if the doors are locked, its probably for a reason.

posted by prime at 5:57 pm  

Saturday, July 5, 2008

A Guide to Linux Partitions and File Systems

Without partitions or filesystems, you wouldn’t be able to do a whole lot with your computer. In fact, you really wouldn’t be able to do anything. Partitions come in many shapes and sizes, just as filesystems do. So what exactly are these mysterious things? (more…)

posted by prime at 12:00 am  

Powered by WordPress