Seventy-five percent of the servers I have been working on over the last few months have been Linux.  Mostly Ubuntu.  This due to the fact that my company has allow me to start migrating over and building new servers on this platform.  With that, we need secure ways to access the servers.  On occasion I’ll use webmin but mostly just SSH and whatever website is running on it (management, applications, etc).  Webmin takes care of itself with a self signed certificate and SSH creates its own keys.  Pretty easy there.  Now, for the website that is running on the box, out of the gate it’s unencrypted TCP/80 traffic running from an Apache 2 web server.  This short tutorial will cover how to create a CSR with OpenSSL for use when getting a certificate from one of the CA’s.  I won’t explain everything here but you may use Ubuntu’s https-help guide if you need more info found here.

First, let’s make sure we have the right packages installed.

apt-get install openssh apache2 apache2.2-common php5

Now let’s enable SSL for apache2

sudo a2enmod ssl

Now lets create the server SSL key.

cd /etc/ssl/private
openssl genrsa -des3 -out dns.server.com.key 1024

Ok, now that we have the key, let’s create the CSR to be given to the CA.

openssl req -new -key dns.server.com.key -out dns.server.com.csr

It will prompt you for the passphrase and some other bits of information.  The most important one is site name.  This must match the name of your server.  Something like mail.domain.com or www.domain.com would be appropriate here.

The CSR can now be uploaded to whatever CA you choose.  I use GoDaddy because they are so cheap.

If you do not want to purchase a certificate you can create your own self signed cert with the following command.

openssl x509 -req -days 365 -in dns.server.com.csr -signkey dns.server.com.key -out dns.server.com.crt
cp /etc/ssl/private/dns.server.com.crt /etc/ssl/certs

Now that we have the cert created, let’s configure Apache to use it. Add the following 3 lines to your website configuration.  The default one is located in /etc/apache2/sites-available/default.

SSLEngine on
SSLCertificateFile /etc/ssl/certs/dns.server.com.crt
SSLCertificateKeyFile /etc/ssl/private/dns.server.com.key

Save that config file and enable Apache to listen on 443 for HTTPS traffic.  Add the following line to /etc/apache2/ports.conf

Listen 443

Restart your Apache2 process and you should have a fully functional SSL enabled website.

/etc/init.d/apache2 force-reload && /etc/init.d/apache2/restart

vi is neat.  Most of the engineers I work with like nano or pico but I like vi.  For some reason it makes me feel more like a geek when I’m using it.  In fact, I’ve been using it so often lately that I have been trying to use vi command in notepad (obviously without success).  This tutorial will cover only the basics but that should be enough to get you started.  A much better tutorial is available here.

vi /etc/network/interfaces - opens /etc/network/interfaces in vi

i - insert
/ - search
G - [Shift] g - go to bottom of page
dd - delete the line
d <- or d -> - d [left or right arrow] delete 1 character in that direction
10G - 10 [Shift] g - move to line 10 (obviously number can be replaced)
10dd - delete 10 lines from cursor and below (again, number can be changed)
:q - quit (no changes may have been made)
:q! - quit (do not save changes)
:wq - write quite (save and quit)
:w - write (save)

Ok, now that you have mastered the basics of vi, please refer all other needs to the link provided above.  Hope you like vi as much as I do.

NOTE:  Ubuntu (and maybe debian) have a few things that the built in vi program have that seem a little strange.  I usually install vim just to be safe.  to do this run sudo apt-get install vim-full.

Please!!  I’ve been using an old P4 1.6Ghz and 512Mb memory at home with Ubuntu loaded on it for some time now.  I can’t seem to ever come up with enough cash to purchase this myself so I thought I would give ChipIn at try.  It’s a new (I think) service that allows you to have a fund raiser of your own.  Check it out and try it for yourself.

I’m looking at one of the higher end HP or Dell’s running Vista Ultimate with a dual monitor setup for home.  I have dual monitors at work and it gets pretty hard to get all the work I want to get done at home when I only have a single 17″ flat panel.  Pretty low tech if you ask me.

For those of you who do donate, thank you very much.  I appreciate it.  For those of you who don’t, I won’t hold any grudges.

Ok,  one of the guys at the office started using twitter and kept prodding that I needed to use it to.  Well, I don’t like doing things that aren’t easy and I don’t like wasting time on something pointless.  I started searching around for “easy” ways to use Twitter and have discovered a few Firefox extensions, GMail chat add in via Twitter, and now a Wordpress plugin which I installed just before I started this blog post.  You can find me on twitter @ http://www.twitter.com/clamasters.

Here is what has annoyed me to the point that I don’t like using it.  Every time I do something on the website, that is Twitter.com, I get a stupid error saying that “Twitter is over capacity” and that I should try again later.  That makes me so angry.  Rarely do you ever see Facebook or Myspace to say that it’s too busy.  Why should any other e-service be held to a different standard.  I’m sure I’m just barking up a tree here and they are experiencing growing pains just like all the other social networks, but there has to be a balance.  So far JUST THIS MORNING, I have gotten the above error 9 times!!!  Ugh…

On a lighter note, it is kinda cool.

The original post for this is from the Ubuntu Geek website but I learned something new from it so I thought I would share my new favorite way to keep a package from being updated in Ubuntu.  This goes for pretty much any of the newer releases of Ubuntu.  I used to use dpkg to do this but now I like aptitude much better.  It’s easier for me.

To put a package on hold use this command.

sudo aptitude hold snort-mysql

To remove the hold use this command.

sudo aptitude unhold snort-mysql

To keep your entire system (I think) from being updated simply use this command.

sudo aptitude hold

And to remove the hold use this command.

sudo aptitude unhold

Very easy isn’t it.  Yep, that’s what I thought. I’ll be able to deploy appliances in the field now without worrying if an update is going to break something before I get a chance to fix the issue.