Oct 30

Help us get a free dinner at Jensens Bøfhus

Tag: StuffMichael Lind Mortensen @ 9:57 pm

Hello everyone!

Dear friend, visitor or whatever your role might be. Please take the time to help me and my fellow computer science students get a free dinner at the Danish restaurant Jensens Bøfhus.

They basically have a small competition running right now, where you can upload a picture and get voted for - if your picture has the most votes = you win! So please help us and vote for our picture - you would make a bunch of poor students happy ;-)

So, if you would be so kind to click on this link (no viruses - promise!):
http://jensensb.ziteman.com/mms_sider/mms_nyestebilleder.asp?vote=1C4936BC-3DF0-48DA-B464-C11E0AD6D092

It will simply cast a vote for us in the competition. And remeber, you can vote two times! ;-)

Anyways, thanks for the support!! Peace!




Oct 30

Removing X-Powered-By header for mod_rails

Tag: Security, UnixMichael Lind Mortensen @ 4:44 pm

I recently had a bit of a problem with a server running a Ruby on Rails application. I wanted to make sure the server didn’t give out any information about service versions, however mod_rails didn’t give any easy way of doing this within the module itself. I therefore began searching for another way of doing this, and found that an easy solution was to make Apache remove the headers via. the mod_headers module.

So how is it done? Very simple, just enable the module mod_headers and add the snippet below to httpd.conf or another included configuration file in Apache. Both actions have to be done as root of course.

Enable the mod_headers module (This example is Linux Debian - it might be different for your system)

# cd /etc/apache2/mods-available/
# a2enmod headers

Add these lines to httpd.conf

Header always unset "X-Powered-By"
Header always unset "X-Runtime"

Restart the Apache server (Again - this is Debian! It might be different for you)

# apache2ctl restart

And there you go. Try making e.g. a Nikto scan on the server and see if the headers aren’t there anymore.




Oct 19

The Status of the World - Audio version

Tag: PoliticsMichael Lind Mortensen @ 12:54 am

Hello everyone,

I thought I would try something new today. I just bought a microphone a few months ago and haven’t really attempted to get it tested yet, so I guess it was about time. For this reason I’ve recorded a small message to the world, summing up the status of the world.. Enjoy!

The Status of the World




Sep 28

Simple backup script with notification

Tag: UnixMichael Lind Mortensen @ 2:07 am

So I recently had to come up with a simple backup solution that didn’t involve any fancy system and basically just gave one the opportunity to choose what directories to backup, where to back them up and notify if something goes wrong.

So I came up with a solution which, in my own view, could be better and more “clean”, however this is how it is right now. You’re welcome to take the script, change and redistribute it - it’s released under the BSD license.

You might notice it’s refering to a bunch of files - these files are the error messages sent in e-mails and need to be placed somewhere, with corresponding changes in the script. If they don’t, e-mail notification won’t work.

Right now it’s sending e-mails when it’s succesful in making a backup. Depending on how often you want your cron job to do a backup, it might be irritating to get that many e-mails, so all you need to do is basically just remove the last part so that it only notifies you if something goes wrong.. That will however create the possibility that the e-mail functionality of the server will stop working and you won’t notice.

But yeah.. Here’s the script + all the error-messages zipped for download: backup_script

I’ll be the first to admit it’s not optimal in any way.. it’s a quick solution and has a bunch of DRY (Don’t Repeat Yourself) violations… but hey.. it works and given it’s low complexity I don’t wanna prioritize cleaning it up that much - but you are more than welcome to do so!

Here’s the code copied into the post:

#!/bin/bash
# Copyright (c) 2008, Michael Lind Mortensen
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#     * Redistributions of source code must retain the above copyright
#       notice, this list of conditions and the following disclaimer.
#     * Redistributions in binary form must reproduce the above copyright
#       notice, this list of conditions and the following disclaimer in the
#       documentation and/or other materials provided with the distribution.
#     * Neither the name of Michael Lind Mortensen nor the
#       names of his contributors may be used to endorse or promote products
#       derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY MICHAEL LIND MORTENSEN ''AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL MICHAEL LIND MORTENSEN BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
# Define settings
DATA="/home/user1 /home/user2 /etc /var/www/virtual /var/log" #Location of backup files.
DISC="/mnt/backup" # Mount location of backup disc
DEVICE="/dev/sdb1" # Backup devicename
MAILREC="info@example.com" # Define message recipients. Comma-separate for more recipients.
SENDER="noreply@example.com" # Define sender e-mail for error-messaging.
LOG="logfile.txt" # Location of the error logfile
DBPASS="databasepassword" # The root password to the mysql server
 
set $(date)
 
#####################################################
#  Define email functionality for error messaging   #
#                                                   #
# Parameters: MESSAGE - E-mail content from file    #
#                                                   #
#####################################################
function error_mailer {
        MESSAGE=$1
        SUBJECT="Backup process encountered errors!"
        # Send the email using mail
    if mail -s "$SUBJECT" -r "$SENDER"  "$MAILREC" < $MESSAGE
    then
        :
    else
        echo "$3-$2-$6-$4 - ERROR: Mail functionality not working!" >> $LOG
    fi
}
 
#####################################################
#  Define email functionality for success messaging #
#                                                   #
# Parameters: MESSAGE - E-mail content from file    #
#                                                   #
#####################################################
function success_mailer {
        MESSAGE=$1
        SUBJECT="Backup created succesfully!"
        # Send the email using mail
        if mail -s "$SUBJECT" -r "$SENDER" "$MAILREC" < $MESSAGE
        then
                :
        else
                echo "$3-$2-$6-$4 - ERROR: Mail functionality not working!" >> $LOG
        fi
} 
 
# Mount backup disc
if mount $DEVICE $DISC
then
        :
else
        echo "$3-$2-$6-$4 - ERROR: error while mounting disc!" >> $LOG
    error_mailer "/etc/backup_inc/errors/mount_error.txt"
fi
 
# Perform daily full backup
if tar cfz "$DISC/data/data_$3-$2-$6.tgz" $DATA
then
        echo "Data saved successfully!"
else
        echo "$3-$2-$6-$4 - ERROR: error while saving data!" >> $LOG
    error_mailer "/etc/backup_inc/errors/data_error.txt"
fi
 
# Create SQL dumps of databases
if mysqldump -u root --password=$DBPASS --all-databases > "$DISC/database/db_$3-$2-$6.sql"
then
        :
else
        echo "$3-$2-$6-$4 - ERROR: error while making mysqldump!" >> $LOG
    error_mailer "/etc/backup_inc/errors/mysqldump_error.txt"
fi
 
if gzip "$DISC/database/db_$3-$2-$6.sql"
then
        echo "MySQL databases saved and compressed succesfully!"
else
        echo "$3-$2-$6-$4 - ERROR: error while saving mysql databases!" >> $LOG
    error_mailer "/etc/backup_inc/errors/db_error.txt"
fi
 
# Unmount backup disc
if umount $DISC
then
        success_mailer "/etc/backup_inc/success.txt"
else
        echo "$3-$2-$6-$4 - ERROR: error while unmounting disc!" >> $LOG
        error_mailer "/etc/backup_inc/error/umount_error.txt"
fi

The fast person will probably notice that Wordpress writes < and > as &lt; and &gt; .. that’s just the code plugin messing things up and I hope you can figure out how to fix that yourselves.. if not, the zipfile has the code without any odd layout errors.

All in all the code should be fairly self-explanatory.. if not, there are plenty of comments to help you use the script or change it to whatever you need.

Last but not least - Remember to add a cron job with the script.. If you don’t there won’t be much automatic backup about it.

That’s just about it.. Enjoy!




Sep 11

Energy saving hype

Tag: DebunkingMichael Lind Mortensen @ 9:17 am

I saw a new TV-add from “Elsparefonden” this morning. As many before it, it tried to get people to think about how much power they consumed and thereby consume less to save the environment. Before I go on, you can watch the add here from YouTube:

So what’s my problem with this? Well, basically it’s just plain bullshit! Sure, power consumption will fire up energy production demands and thereby harm the environment because the energy production harms the environment. However the only reason why energy production harms the environment is because of low-quality materials like coal! Why the hell try to get people to go back in technological development by using less power, instead of just making our energy production more effective and clean (which would probably also be cheaper than all does damn adds all the time).

But apparently the global warming hype has become almost a religion, with fanatics fighting to jump back in time on a lot of fronts like electronics, food, industrial production etc. For some reason they believe the world population was better off with the status we had 50 years ago! Like for example a Linux guy I heard at FOSDEM 08, whom claimed that the German government should not use Windows Vista and instead use Linux - what was his reason? Vista uses more power and Microsoft was therefore fighting to destroy the environment…. Now, there are many valid arguments for using Linux instead of Vista, however saving the environment is definitely not one of them! It really pisses me off a lot of organizations are using this global warming frenzy to push their agendas, just by coating it with some environmental bullshit.

So - My conclusion? Shift all energy production to wind power and nuclear power - and stop irritating us with demands of lower power consumption. The only real reason to consume less power is saving money - power is expensive and will probably keep on getting more expensive for a long while, so if one can develop machines that consume less power, these machines will obviously be cheaper - this however has nothing to do with saving the environment.




Sep 09

Funny Christian music

Tag: JunkMichael Lind Mortensen @ 7:10 pm

This is probably the funniest Christian music I have ever heard.. Very very odd!




Sep 04

Tribute to the American “Flag”

Tag: JunkMichael Lind Mortensen @ 9:27 pm

!!VOTE FOR BARACK OBAMA!!

Oh, say, can you see, by the dawn’s early light,
What so proudly we hailed at the twilight’s last gleaming?
Whose broad stripes and bright stars, thro’ the perilous fight’
O’er the ramparts we watched, were so gallantly streaming.
And the rockets red glare, the bombs bursting in air,
Gave proof through the night that our flag was still there.
Oh, say, does that star-spangled banner yet wave
O’er the land of the free and the home of the brave?

On the shore dimly seen, thro’ the mists of the deep,
Where the foe’s haughty host in dread silence reposes,
What is that which the breeze, o’er the towering steep,
As it fitfully blows, half conceals, half discloses?
Now it catches the gleam of the morning’s first beam,
In full glory reflected, now shines on the stream;
‘Tis the star-spangled banner: oh, long may it wave
O’er the land of the free and the home of the brave.

And where is that band who so vauntingly swore
That the havoc of war and the battle’s confusion
A home and a country should leave us no more?
Their blood has wash’d out their foul footstep’s pollution.
No refuge could save the hireling and slave
From the terror of flight or the gloom of the grave,
And the star-spangled banner in triumph doth wave
O’er the land of the free and the home of the brave.

Oh, thus be it ever when free men shall stand,
Between their loved homes and the war’s desolation;
Blest with vict’ry and peace, may the heav’n-rescued land
Praise the Power that has made and preserved us as a nation.
Then conquer we must, when our cause is just,
And this be our motto: “In God is our trust”;
And the star-spangled banner in triumph shall wave
O’er the land of the free and the home of the brave.




Aug 26

Linus Torvalds - Living in a dream world?

Tag: SecurityMichael Lind Mortensen @ 12:36 am

When I originally decided to write this post I was a bit hesitant about attacking Linus too vigorously. I do have a huge amount of respect for what this man has achieved, however I’m not going to censor myself in any way and need to say what has been irritating me for some time.

About a month ago I saw a news feed related to Mr. Torvalds’ comments here: http://article.gmane.org/gmane.linux.kernel/706950. His comments has since then been on my mind quite a lot and have actual decreased my regard for this man’s opinion, as he seems completely ignorant to the state of things.

To be fair, I should state that I do work with computer security and I use FreeBSD on my Laptop and several of my servers, so I might be a bit bias. However I do also have a couple of Linux machines, a couple of Linux servers and two Microsoft Windows systems - no Mac however, but that’s another discussion. But even though his comments were somewhat directed at people like me, I still don’t fit his stereotype completely (and don’t get mad easily) and therefore believe I am objective enough to comment in an adult way.

So - let’s get started. Let’s just put in his quote in it’s complete form and I’ll begin explaining why he’s wrong:

Btw, and you may not like this, since you are so focused on security, one
reason I refuse to bother with the whole security circus is that I think
it glorifies - and thus encourages - the wrong behavior.

It makes "heroes" out of security people, as if the people who don't just
fix normal bugs aren't as important.

In fact, all the boring normal bugs are _way_ more important, just because
there's a lot more of them. I don't think some spectacular security hole
should be glorified or cared about as being any more "special" than a
random spectacular crash due to bad locking.

Security people are often the black-and-white kind of people that I can't
stand. I think the OpenBSD crowd is a bunch of masturbating monkeys, in
that they make such a big deal about concentrating on security to the
point where they pretty much admit that nothing else matters to them.

To me, security is important. But it's no less important than everything
*else* that is also important!

			Linus

So why is he wrong? Well, it’s really not that complicated - he neglects to recognize what’s important for the biggest users of Linux systems in the world - the businesses and universities! The most important issues for these users are and have always been: Stability, Security and Reliability. All these humongous users have systems that need to stay up and running 24-7 all year long - without incident! So to claim that security issues aren’t more important than “normal” bugs is just plain naive! Functionality isn’t important for anyone but the end users, as the companies and institutions have already made the functions they want available - they don’t want their users to be able to do a bunch of stuff they didn’t expect or plan, so for them it doesn’t matter at all. Stability is another issue however and I do agree there isn’t much difference between a stability issue and a security issue.

Also the stuff about OpenBSD users being black-and-white - he’s got to be kidding right? By simply stating this without proof, he makes himself seem untrustworthy to me, because in my experience, I’ve seen the exact opposite! Linux users are the people whom are black-and-white, the people whom hate Microsoft for no other reason than they’re not Linux, the people whom claim all software should be free and whom believe that enterprises are killing innovation. Even though I’ve seen these things, I still wouldn’t conclude “Linux people are often the black-and-white kind of people…”, as I had no way of knowing this unless I actually knew enough of the world population of Linux users to claim that the majority believe certain things.

Also “Masturbating monkeys” - Stop being a fucking child! I can respect using profanities to emphasize your points and it would be easier to respect you if you weren’t the fucking creator of a struggling OS - but seriously… self-pleasuring primates? - Grow up and show some respect! The OpenBSD project has come out with a lot of good stable software and talking about them in this way is basically just like spitting in their fucking faces! It’s no different than if I said Linux users were donkey-fucking scat-lovers - an equally retarded statement!

And concerning Mr. Torvalds’ last point:

To me, security is important. But it's no less important than everything
*else* that is also important!

Most will probably agree with this - as I also do - however we apparently have very different views of what is important and what isn’t important!




Aug 13

Linear Algebra - pwn3d

Tag: JunkMichael Lind Mortensen @ 1:36 pm

LEARN BIATCH!

So as some of you may have read, I flunked Linear Algebra a few months ago due to picking a subject I hadn’t read or prepared in any way. So this time it was up for a re-match and I kicked Linear Algebra’s ass! Picking the subject of Orthogonality and Unitary Matrices - Schurs Theorem, Spectral Theorem etc. A very nice subject actually.

The score as of right now:

Lin Alg: 1

Michael: 10

Linear Algebra got pwn3d!

For those who might be interested, my course materials, notes and dispositions can be found here:

http://www.daimi.au.dk/~illio/courses/LinAlg/

Be aware however, the notes are in Danish.




Aug 06

Folkia loans - The stupid man’s loan!

Tag: DebunkingMichael Lind Mortensen @ 10:27 pm

I was watching tv the other day and suddenly this add came up:

Mikrolån: Du kan vælge at låne 1.000 kr. eller 2.000 kr. (til Danmarks laveste afgift). Lånet skal tilbagebetales inden 30 dage.

Now.. this is obviously Danish. Roughly translated it means:

Micro loans: You can choose to loan 1000 Danish Kroners or 2000 Danish Kroners (at the lowest rate in Denmark). The loan has to be repaid within 30 days.

So let’s see, how does this work? Well basically, you loan 1000 DKK or 2000 DKK and then repay the money + a fee of either 300 DKK or 450 DKK respectively.. oh yeah, and you have to do all this within 30 days. So basically you loan 2000 DKK and suddenly you’re 2450 DKK in debt and you have to pay it back within 30 days.. so you go out, have a night on the town, maybe buy a new mobile phone and then you’re pretty much broke again. So this took maybe 1-2 days and now you have under 30 days to earn 2450 DKK (after taxes of course) and repay those fuckers with that money.

To sum up here: You begin your month thinking: “I need money”. You go to folkia.dk and apply for a loan of 2000 DKK. You get your money (which actually assumes a bunch of stuff about your current job situation, e.g. a monthly income of over 10000 DKK) and then you immediately start using the money. A few days later you’ve used the money and now you need to find a way to earn 2450 DKK within 30 days, which in Denmark means around 4600 DKK before taxes for most people. So in all this time, why the hell didn’t it occur to you to just earn the fucking 2450 DKK in the first place and use the money at the end of the month you fucking retarded piece of shit!

Companies like this one seriously makes me sick! They exploit the stupidity of people who are already in financial trouble and generally lead to a more unstable population of people stressed by debt.

I hope people in Denmark will be smart enough to see through all of this and not make stupid mistakes.




Next Page »