<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
    <title>Linux Coaching</title>
    <link rel="alternate" type="text/html" href="http://linuxcoaching.ie/linux_coaching/" />
    <link rel="self" type="application/atom+xml" href="http://linuxcoaching.ie/linux_coaching/atom.xml" />
    <id>tag:linuxcoaching.ie,2009-03-30:/linux_coaching/1</id>
    <updated>2010-03-29T12:13:39Z</updated>
    <subtitle>Making Open Source Software Work For You.</subtitle>
    <generator uri="http://www.sixapart.com/movabletype/">Movable Type 4.25</generator>

<entry>
    <title>Going SSL With Evolution</title>
    <link rel="alternate" type="text/html" href="http://linuxcoaching.ie/linux_coaching/2010/03/going-ssl-with-evolution.html" />
    <id>tag:linuxcoaching.ie,2010:/linux_coaching//1.30</id>

    <published>2010-03-27T18:39:59Z</published>
    <updated>2010-03-29T12:13:39Z</updated>

    <summary>You may have followed my advice I gave in an earlier posting to set up a secure email server that will allow clients to fetch their email from the server only if they present a valid SSL certificate in addition...</summary>
    <author>
        <name>Ralph</name>
        <uri>http://kerry-linux.ie</uri>
    </author>
    
        <category term="Cryptography" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="Open Source" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="Security" scheme="http://www.sixapart.com/ns/types#category" />
    
    
    <content type="html" xml:lang="en" xml:base="http://linuxcoaching.ie/linux_coaching/">
        <![CDATA[You may have followed <a href="http://linuxcoaching.ie/linux_coaching/2009/11/fetch-your-email-through-a-secure-tunnel.html">
my advice I gave in an earlier posting</a> to set up a secure email server that will allow clients to fetch their email from the server only if they present a valid SSL certificate in addition to the usual password for the mailbox user. The most appealing aspect of this approach is that once the system had been set up, the client user, who has already stored his certificate on his local laptop will just have to provide the password as usual. This solution comes with no additional burden, and at the same time ensures that the email travels encrypted from the email server to the laptop. A clear boost of security, fine.<br /><br />The only problem is that the email client software must be capable of establishing a SSL connection using the users certificate. Unfortunately not every prominent email software is able to do that. In my case I fetch my email from the server with fetchmail as I'm interested to archive all incoming email.<br />But email software usually tends to fetch the email on its own account. So the lack of being able to establish a SSL connection could clearly ruin the new approach.<br /><br />

<h3>What's Written On The Tin?</h3>
As a consequence I was very surprised to learn that Evolution, generally being celebrated as the Outlook killer software, actually is one of those culprits. Googling towards a solution I came across some well-intended advice "just" to upload the my certificate using the pertinent buttons in Evolution. This is good advice although it requires a little bit of openssl hacking to beat the two separate cert and key files in shape to form a p12 file, but it doesn't solve the problem at all. Evolution uses uploaded certificates to sign messages a user sends to other people, but it still refuses to use such a certificate to establish a SSL connection to the mail server. Strange, but true.<br /><br /><br />

<h3>Let The Expert Do The Connecting</h3>

Fortunately there is a small but powerful piece of software that is rapidly becoming my favorite tool in such situations, called STUNNEL. Its primary goal is to read data from one port and to connect to an entirely different port on a different computer, initiating a clean SSL connection with the certs and key provided in a single configuration file. From the remote server's perspective it looks like some SSL capable software had connected to the server, while indeed any dumb non-SSL-aware code is using stunnel to do the hard work.
This code could as well be Evolution, right?

Let's have a look at the simple config file for stunnel:<br /><br />
<div class="code">
debug = 7<br />
output = /secure/stunnel/logfile<br />
pid = /securestunnel/stunnel.pid<br />
<br />
[imaps]<br />
accept  = laptop.kerrylinux.ie:143<br />
connect = mail.kerrylinux.ie:993<br />
CAfile  = /etc/pki/tls/cert.pem<br /> 
cert    = /secure/stunnel/joe@kerrylinux.ie.cert<br />
key     = /secure/stunnel/joe@kerrylinux.ie.key<br />
CRLfile = /secure/stunnel/CRL.pem<br />
client = yes<br />
</div>

<br />Essentially, the "normal" IMAP port 143 on the laptop is wired as a secure IMAPS mail server to be used by Evolution. All certs and keys are stored in a secure place on the laptop.<br /><br />

<h3>Getting Evolution To Use The Tunnel</h3>

The remote mail server mail.kerrylinux.ie would usually be listed as the server in the settings for "Receiving Email". Now you just have to replace this entry with the local laptop's name and make sure that "no encryption" is selected. Remember it is STUNNEL's job to perform the SSL encryption not Evolution's.
"Yes, but it should be evolution's", I can hear you say. You're right, but  even if the evolution team decides to sex up their software in future, this solution will work for every other non-SSL capable email client as well, and that's the reason why I told you how to do it.]]>
        
    </content>
</entry>

<entry>
    <title>Tracking Down A Suspected &quot;Backdoor&quot;</title>
    <link rel="alternate" type="text/html" href="http://linuxcoaching.ie/linux_coaching/2010/01/tracking-down-a-suspected-backdoor.html" />
    <id>tag:linuxcoaching.ie,2010:/linux_coaching//1.29</id>

    <published>2010-01-29T08:08:49Z</published>
    <updated>2010-02-11T06:40:16Z</updated>

    <summary>After having installed an open source online-shop software on a VPS I had to suffer a hefty delay following the login as administrator until eventually the control panel appeared on the screen. Despite of this admin login problem the software...</summary>
    <author>
        <name>Ralph</name>
        <uri>http://kerry-linux.ie</uri>
    </author>
    
        <category term="Behind the Curtains" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="Open Source" scheme="http://www.sixapart.com/ns/types#category" />
    
    
    <content type="html" xml:lang="en" xml:base="http://linuxcoaching.ie/linux_coaching/">
        <![CDATA[After having installed an open source online-shop software on a VPS I had to suffer a hefty delay following the login as administrator until eventually the control panel appeared on the screen. Despite of this admin login problem the software ran fast and responsive, but the admin login, which would normally only take 2 seconds, took more than two minutes to complete.<br /><br />

<table><tbody><tr><td valign="top">
</td><td>

<span class="mt-enclosure mt-enclosure-image" style="display: inline;"><a href="http://linuxcoaching.ie/linux_coaching/assets_c/2010/01/img13-39.html" onclick="window.open('http://linuxcoaching.ie/linux_coaching/assets_c/2010/01/img13-39.html','popup','width=800,height=464,scrollbars=no,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no,left=0,top=0'); return false"><img src="http://linuxcoaching.ie/linux_coaching/assets_c/2010/01/img13-thumb-400x232-39.jpg" alt="img13.jpg" class="mt-image-center" style="margin: 0pt auto 20px; text-align: center; display: block;" height="232" width="400" /></a></span>
</td>
<td>&nbsp;&nbsp;</td>
<td valign="top">
Possible causes for this problem are manifold, some misplaced configuration option, a software bug, a missing software component, many things are conceivable. 
<br /><br />What raised my suspicion was the fact that this problem seems to occur only at the administrator login, well, I hadn't created new users by now.
<p><br />
It is likely that the problem occurs for new users as well.
</p></td></tr></tbody></table>
<h3>The Hunt</h3>

Actually there were two separate delays that cropped up after I typed the admin password, with a little bit of activity in between. It looked like a time-out, so I shut down the VPN's firewall and the problem was gone. At this point it was clear that some network activity took place which normally was blocked by the firewall. To find out what was going on I engaged a wonderful network analysing tool called wireshark or tshark to capture the network packets after login. It turned out that the VPN initiated a http and a second https connection to a server within the domain of the online-shop's original vendor. <br /><br />I know it's only me who tends to think of a possible backdoor, a software "calling home" to report something, in such a case. But at this point I wanted to find out what was going on behind the scenes. Out of sheer curiosity I started to poke into the source code to find more informative evidence. As you may imagine, looking for "http" in the source code revealed tons of references that were mostly inactive links to the vendor's homepage. More extensive filtering brought a function "load_xml_file" to light that was used to download a file that contained only innocent version information in XML format that could as well be part of the distribution and stored locally.<br /><br />

<h3>Benefits of Open Source</h3>

The vendor had decided to download this file to make sure that the online-shop software will automatically become aware of a new version once it is released. Of course this is a legitimate intention, but it would force the shop user to open outgoing connections on the server machine to avoid the timeout penalty which could open up another can of worms for other applications. I decided to change the source code to load the information from local files instead of the vendor's homepage and turned on my restrictive firewall again. <br /><br />This is exactly the flexibility and reliability one gets with using open source software which would never, ever be possible if you used proprietary solutions instead. People often say, nobody looks at the source code, which is true for many open source programs, but with proprietary products you would not even have the chance to take the approach described above, because you are at the vendor's mercy to accept what the program is actually doing. <br /><br />The freedom to change the code is a benefit that could possibly not be overestimated.<br /><br /> ]]>
        
    </content>
</entry>

<entry>
    <title>Celebrating Expiration Day</title>
    <link rel="alternate" type="text/html" href="http://linuxcoaching.ie/linux_coaching/2010/01/celebrating-expiration-day.html" />
    <id>tag:linuxcoaching.ie,2010:/linux_coaching//1.25</id>

    <published>2010-01-02T16:53:16Z</published>
    <updated>2010-01-24T21:31:50Z</updated>

    <summary>On the last day of the year my email stopped coming in. You may have read about my approach to fetch my email using a secure tunnel that uses SSL certificates in addition to a password to access my email....</summary>
    <author>
        <name>Ralph</name>
        <uri>http://kerry-linux.ie</uri>
    </author>
    
        <category term="Behind the Curtains" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="Cryptography" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="Security" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="rootkey" label="root key" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://linuxcoaching.ie/linux_coaching/">
        <![CDATA[On the last day of the year my email stopped coming in. You may have read about <a href="http://linuxcoaching.ie/linux_coaching/2009/11/fetch-your-email-through-a-secure-tunnel.html">my approach to fetch my email using a secure tunnel </a> that uses SSL certificates in addition to a password to access my email. Well, on the last day of the year my ROOT CERTIFICATE, which I use for Kerry Linux, had expired after five years. Time flies by.

<br /><br />As I had other plans for the days ahead I thought just to renew the root certificate to buy time, but it seemed that my attempts to renew my root certificate did not result in a new usable certificate to replace the old one. My user certs, which are not up for expiration yet could not be reanimated with a quick fix like that.

<br /><br />After a while I thought, there is a reason for that and I began to think about root certificates more thoroughly. In the past five years we've definitively seen the crackdown of MD5 and SHA-1 is not invincible, too. Would it not be prudent to increase the key length and to use a more secure (i.e longer) hash and go through the trouble of creating a new root key and issue new user certs? I decided to go along that route and created <a href="http://linuxcoaching.ie/linux_coaching/kerry-linux-certification-center---root-certificate.html">a fresh new CA root key with 4096 bits</a> for the Kerry Linux Certification Center. Although my openssl software does only permit using SHA-1, which is a pity, I felt content and everything was up and running for me in an hour or so.

<h3><br /></h3><h3>Re-Animation of the old ROOT KEY</h3>

After a while I began to wonder if it was possible to reanimate the old key and out of curiosity tried to explore the way to do it in more detail. <a href="http://marc.info/?l=openssl-users&amp;m=113292902213919&amp;w=2">I googled and found this nice posting from Arsen Hayrapetyan </a> which led me to success.

My former attempts to recreate the old certificate always led me to the following error message when I tried to verify a user's certificate::
<p>
</p><div class="code">
openssl verify -verbose -CAfile KLCC-2010.pem support@kerrylinux.ie.cert<br />
</div>
<div class="output">
support@kerrylinux.ie.cert:<br />/C=IE/ST=Ireland/L=Kerry/O=Kerry Linux/CN=support@kerrylinux.ie/emailAddress=support@kerrylinux.ie<br />
error 20 at 0 depth lookup:unable to get local issuer certificate<br />
</div>
<br />
Unable to get the issuer certificate? I supplied it in the command, but it didn't work out as planned.
<p>
So I followed Arsen's hints and created a testbed for an experiment, where I set the serial number back to 00 and emptied the file "index.txt" so that my new certificate could inherit the properties of the old one including its serial number. Then I created a new certificate request based on the old root certificate "cacert.cert" and used this new request to sign it with the old key.
</p><p>
</p><div class="code">
openssl x509 -x509toreq -in cacert.cert -signkey private/cakey.pem \<br />
-out certreq.csr<br />
<br />openssl ca -config KLCC.cnf  -in certreq.csr -out cacert_renewed.pem \<br />
-keyfile private/cakey.pem -cert cacert.cert -extensions v3_ca
</div>
<p><br />
The result was a new root certificate "cacert_renewed.pem" that verified my old user certs
perfectly.
</p><p>
</p><div class="output">
openssl verify -verbose -CAfile cacert_renewed.pem \<br>support@kerrylinux.ie.cert <br />
support@kerrylinux.ie.cert: OK<br />
</div>
<p><br />
It's good to have an alternative, isn't it?
</p>]]>
        
    </content>
</entry>

<entry>
    <title>Using Big Files As Hard Disks</title>
    <link rel="alternate" type="text/html" href="http://linuxcoaching.ie/linux_coaching/2009/12/using-big-files-as-hard-disks.html" />
    <id>tag:linuxcoaching.eu,2009:/linux_coaching//1.24</id>

    <published>2009-12-01T06:34:10Z</published>
    <updated>2009-12-01T06:04:31Z</updated>

    <summary> The XEN hypervisor uses big files (a couple of gigabytes) as filesystem images for virtual machines. Unlike other virtualisation solutions XEN does not impose its own internal structure on the image file. The big file simply has to contain...</summary>
    <author>
        <name>Ralph</name>
        <uri>http://kerry-linux.ie</uri>
    </author>
    
        <category term="Behind the Curtains" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="System Administration" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="Virtualisation" scheme="http://www.sixapart.com/ns/types#category" />
    
    
    <content type="html" xml:lang="en" xml:base="http://linuxcoaching.ie/linux_coaching/">
        <![CDATA[ The XEN hypervisor uses big files (a couple of gigabytes) as filesystem
images for virtual machines. Unlike other virtualisation solutions XEN
does not impose its own internal structure on the image file. The big
file simply has to contain an ordinary ext3 filesystem and, optionally, 
a partition table just as if it were a real hard disk. 

The ability to use big files as hard disks comes in handy if you are
running short of space on your main hard disk. With an external hard
disk you should be well prepared to run a number of virtual machines
as big files.

However, having the filesystem of a virtual machine in a big file 
raises the question of how to boot the virtual machine. 
Essentially there are two options to do that:<br /><br /><ol>
 <li> Provide the VM's kernel and the init-ramdisk, which are usually stored
    inside the filesystem (in the /boot directory), as separate files
    together with the big file, and modify the VM's configuration to use
    them.
<p>
</p></li><li> leave the kernel and the init-ramdisk in the big file and provide
    a working boot sector that accesses the kernel inside the big file,
    using the native XEN pygrub bootloader to start the virtual machine.
</li></ol>

Both options require that the big file must be associated with a real, special
device file (i.e /dev/loop0) in order to create a filesystem on the big file.
While for the first option it is sufficient to simply connect the big file 
with the loop device, using the "losetup /dev/loop0 bigfile" command, the
second option is much more complex, as the big file has to be partitioned like
an ordinary hard disk before the filesystem can be created.<br /><br />For the rest of this article we will focus on the second option which is much
more appealing as everything is kept inside the big file. I will show you how
exactly the big file is turned into a virtual hard disk and how you can access
and modify the information stored in the virtual machine's own filesystem.<br /><br />

<h3>Getting Partitions And Filesystem Sizes Sorted</h3>

Our journey through the big file's internal structure naturally begins with
the creation of the big file.<br /><br />

<div class="code">
   dd if=/dev/zero of=bigfile bs=1M count=3950<br />
</div>

<br />As a second step we use this chunk of 4141875200 bytes to act as a hard disk 
and try to partition the bigfile as usual:<br /><br />

<div class="code">
   <br />losetup /dev/loop0 bigfile<br />
   fdisk /dev/loop0<br />
</div>
<div class="output">
   <br />Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel<br />
   Building a new DOS disklabel. Changes will remain in memory only,<br />
   until you decide to write them. After that, of course, the previous<br />
   content won't be recoverable.<br />
<br />
   Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)<br />
<br />
   Command (m for help): 
   </div>

<br />As expected, the fdisk program throws a number of error messages at us, 
because we have given a big file instead of a real hard disk to the program.
But let's see how the fdisk program recognizes our new hard disk in detail<br />.

<div class="output">
Disk /dev/loop0: 4141 MB, 4141875200 bytes<br />
255 heads, 63 sectors/track, 503 cylinders<br />
Units = cylinders of 16065 * 512 = 8225280 bytes<br />
<br />
      Device Boot      Start         End      Blocks   Id  System<br />
</div>

<br />Obviously there is no partition table yet, but the program assumes that the 
big file represents a hard disk with 255 heads and 63 sectors of 512 bytes
data each. Every cylinder of our virtual hard disk is made of 
255 x 63 x 512 bytes = 8225280 bytes which represents the units in which we
can chop the hard disk space into partitions now. All in all there are
503 cylinders in our virtual hard disk which makes a total of 
503 x 8225280 bytes = 4137315840 bytes to spend on partitions. 

<br /><br />But wait, didn't we create 4141875200 bytes in the first place? That's
4559360 bytes less than what we had originally. Well, this loss is due to
the fact that for the 504th cylinder we'd need 8225280 bytes which we don't
have, so this loss is inevitable. But the important consequence of this 
reduction of space is that we cannot create a filesystem on the whole bunch
of data we supplied. At the moment the size of our filesystem is not 
determined at all.

The next step is to create a new primary partition inside our big file using
all the space we have:<br /><br />

<div class="output">
    Disk /dev/loop0: 4141 MB, 4141875200 bytes<br />
    255 heads, 63 sectors/track, 503 cylinders<br />
    Units = cylinders of 16065 * 512 = 8225280 bytes<br />
<xmp>
       Device Boot      Start        End      Blocks   Id  System
/dev/loop0p1               1         503     4040316   83  Linux
</xmp>
</div>

<br />After having written the partition table to the big file, have you checked for
the new device file /dev/loop0p1? Don't worry, it does not exist!
Adding p1 to the disk label is fdisk's way to denote partitions, that
does not mean that you'll find such a thing in the /dev directory.<br /><br />

<h3>Poking Inside The Big File </h3>

From the partition table you can see that 4040316 blocks have been allocated
for the new partition. With each block storing 1024 bytes we now know our first 
partition size, it's 4040316 x 1024 bytes = 4137283584 bytes. This is another
number we never saw before! After having written off some 4.5 megabytes 
because we cannot use half a cylinder, we now face another loss of exactly
4137315840 - 4137283584 = 32256 bytes.

<br /><br />Of course these 32256 bytes at the beginning of the big file are there for a
purpose, which is to store the partition table. Our first partition begins
right after this amount of data, at an offset of 32256 inside the big file.
The amount of 32256 bytes results from the fact that one track (63 sectors
of 512 bytes for one head) are put away for the partition table.

Now it's time to use a second loop device (/dev/loop1) to poke inside the
big file at exactly the point where our first partition begins and create
a new filesystem there:<br /><br />

<div class="code">
    losetup -o 32256 /dev/loop1 bigfile<br />
    mkfs -t ext3 -c /dev/loop1 4040316<br />
</div>

<br />It's essential that we supply the number of blocks as a parameter to the 
mkfs command to ensure, that our new filesystem on the first partition fits
exactly in the space we have allocated. Without this parameter our filesystem
would become too big, as the 4.5 megabytes after the first partition would
be used for the filesystem too, and when the virtual machine is going to
use the filesystem its actual size would conflict with the numbers in the
partition table. Either the partition table or the filesystem's superblock
is lying, which will cause distress for the virtual machine that expects a
consistent filesystem to operate.<br /><br />


<h3>Writing The Master Boot Record</h3>

You can fill up the filesystem with whatever carefully selected quality open
source software you can find on the planet, but in the end we need to write
the new virtual disk's master boot record to boot the jewel. There is one step
of preparation to be done before we can use the grub shell to write the MBR.
We have to make a symbolic link named /dev/loop to the device that points to
the master boot record, that is to the beginning of the big file, /dev/loop0
in the example above.<br /><br /><div class="code">
   grub&gt;  device (hd0) /dev/loop<br />
   grub&gt;  root (hd0,0)<br />
   grub&gt;  setup (hd0)<br />
   grub&gt;  quit<br />
</div>

 <br />Now your spick-and-span virtual hard disk is ready to boot.<br />]]>
        
    </content>
</entry>

<entry>
    <title>Fetch Your Email Through A Secure Tunnel</title>
    <link rel="alternate" type="text/html" href="http://linuxcoaching.ie/linux_coaching/2009/11/fetch-your-email-through-a-secure-tunnel.html" />
    <id>tag:linuxcoaching.eu,2009:/linux_coaching//1.23</id>

    <published>2009-11-09T11:04:26Z</published>
    <updated>2009-11-09T11:13:24Z</updated>

    <summary> Current Phishing Attacks In early October when news came up that quite a lot of Hotmail and Gmail accounts had been compromised by phishers who tricked users into using a faked login page the general advice for scared users...</summary>
    <author>
        <name>Ralph</name>
        <uri>http://kerry-linux.ie</uri>
    </author>
    
        <category term="Security" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="System Administration" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="dovecot" label="dovecot" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="fetchmail" label="fetchmail" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ssl" label="SSL" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://linuxcoaching.ie/linux_coaching/">
        <![CDATA[ <h3>Current Phishing Attacks</h3>

In early October when news came up that quite a lot of Hotmail and Gmail accounts had been compromised by phishers who tricked users into using a faked login page the general advice for scared users was: "change your email password immediately".
Although nobody really knew how the email passwords published on the internet were gathered, it became common knowledge that only those users who had used the phishing sites to log into their email accounts were vulnerable. Everybody else whose account was not blocked by the email providers started to feel safe again.
<p>
The fundamental problem with email is that access to the mail account is only protected by a password, and that every time a user fetches his email from the internet service provider (ISP), his password is transmitted to the mail server in clear text. To improve the situation email service providers are beginning to use opportunistic TLS, a method to encrypt traffic between mail servers. In this cases encryption is used if the mail server provides it, and in a perfect world mail would always travel encrypted to the user's mail server. 
But opportunistic TLS does not solve the user's problem as almost all email software he actually uses do rely on a password only to access an email account.

</p><h3>The Perfect Mail Server</h3>
In fact, what we have to do is to make sure that email is properly encrypted while the user
fetches it from his email account, and that the mail server establishes a connection only if the person trying to get the mail is able to present more information than a password. This configuration would not only protect the email content and the password
during transmission, it would as well ensure that someone only knowing the password would never be able to establish a connection to the mail server.
<p>
Fortunately this can be achieved without an additional burden on the user, because we only need a careful setup on the server side and provide the user with the additional information (a secret key) which has to be stored safely on the computer that initiates the mail transfer for her.  

</p><h3>Setting Up A Secured Mail Domain</h3>

Let's start with the mail server configuration, which in my case is dovecot 1.0.7 on a CentOS server. I will show you how to configure dovecot to provide the mailbox of system users in a secure way. I assume that the firewall on the mail server is open for  incoming mail on port 25 and that the mail server uses port 993 for outgoing secure IMAP traffic. 

<p>
This is the essential part of the "dovecot.conf"  file I use for secure IMAP access: <br />
(I discuss the relevant parts of the configuration only)
</p><div class="output">
protocols = imaps pop3s<br />
listen = [::]<br />
<br />
ssl_disable = no<br />
verbose_ssl = yes<br />
<br />
ssl_cert_file = /kx/dovecot/mail.kerrylinux.ie.cert<br />
ssl_key_file = /kx/dovecot/mail.kerrylinux.ie.key<br />
ssl_ca_file = /kx/dovecot/kxCAcrl-bundle<br />
ssl_verify_client_cert = yes<br />
<br />
mail_location = mbox:~/mail:INBOX=/var/spool/mail/%n<br />
<br />
auth default {<br />
  &nbsp;&nbsp;mechanisms = plain<br />
  &nbsp;&nbsp;passdb passwd-file {<br />
     &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  args =  /kx/dovecot/%d/imap.shadow<br />
  &nbsp;&nbsp;}<br />
  &nbsp;&nbsp;userdb passwd-file {<br />
     &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  args = /kx/dovecot/%d/imap.passwd<br />
  &nbsp;&nbsp;}<br />
&nbsp;&nbsp;ssl_require_client_cert = yes<br />
}<br />
</div>
<p><br />
</p><p>First of all, by restricting the protocols to imaps and pop3s dovecot releases port 143 and 110 which could safely be blocked now. There are three certificate files which have to be in pem format. While the first file contains the public certificate for the mail server, the second must hold the unencrypted secret key. The file permissions on the later have to be restricted to read access for the root user as the key is read by the dovecot process before dropping permissions to the dovecot user.  
</p><p>

The third file does not only contain the RootCA's certificate but also a valid Certificate Revocation List in pem format
appended to the RootCA certificate with a newline in between. Without the CRL in this file the user's certificate cannot be validated and the connection will not be established.
It is extremely important to keep an eye on this CRL, as the time frame for replacing a CRL is usually only a few days long. If you miss to keep the CRL part up-to-date you'll
risk that the perfect mail server setup expires in a few days, leaving your users with no access to their email. You can create long-living CRLs with the openssl crl command as you like, but bear in mind that the expiration date of your CRL does determine the ability of your users to get at their mail in the same way as does the expiration date of the user's certificate.
</p><p>

You may have noticed that in the authentication section everything is disabled except the use of two files which serve as a static user and password database. Only system users
listed here are able to access their mailboxes. The two files "imap.passwd" and "imap.shadow" are exact copies of their system analogies, limited to the lines of valid email users. Just make sure that both are stored in a directory with the name of the email domain you use, which is shown as %d in the configuration file above. 
</p><p>
Finally, the last line "ssl_require_client_cert = yes" determines that the mail server shuts down the connection if the user's email client is unable to present a client certificate, that the mail server can validate based on the content of the CA certificate file in the configuration. 
</p><p>
By now we have made access to our mailboxes as difficult as possible, it's time to make it accessible for the user in a way that does not hurt. Please read on.
</p><p>


</p><h3>Supplementing The Mail Password With SSL Certificates</h3>

What the user needs is a certificate, a public key, which is signed by the 
RootCA used by the mail server and a corresponding secret key. And, of course, a software that uses this information to download the email from the user's mailbox to the local machine over an encrypted tunnel. With another careful setup on the client's computer this is automatically done by the fetchmail process that can be run via cron in certain intervals. So the users receive their mail without bothering about the encryption process at all. They can read their internet email just like they read their local email.
<p>

Fetchmail uses a config file ".fetchmailrc" which has to be protected carefully (read access for the root user only) as it contains all the user's email passwords. It looks like this:
</p><div class="output">
poll mail.kerrylinux.ie protocol POP3 <br />
<br />
     &nbsp;&nbsp;user joe@kerrylinux.ie password PASXXXXXX is joe here <br />
          &nbsp;&nbsp;&nbsp;&nbsp; ssl sslcertck sslcert /secure/certs/joe@kerrylinux.ie.cert <br />
           &nbsp;&nbsp;&nbsp;&nbsp;  sslkey  /secure/certs/joe@kerrylinux.ie.key<br />
<br />
     &nbsp;&nbsp;user patrick@kerrylinux.ie password PASXXXXXX2 is paddy here<br />
          &nbsp;&nbsp;&nbsp;&nbsp; ssl sslcertck sslcert /secure/certs/patrick@kerrylinux.ie.cert <br />
           &nbsp;&nbsp;&nbsp;&nbsp;  sslkey  /secure/certs/patrick@kerrylinux.ie.key<br />
</div>  
<br />
<p>

For the client to establish the SSL connection it is not enough to present the public certificate to the mail server, it is also necessary to be able to use the secret key.
And this is what the attacker who may have learned the email password will not posses
and what will keep him out of our mailboxes. <br /></p><p>If you have trouble creating those certificates, please drop me an email and I will see what I can do for you. <br /></p>]]>
        
    </content>
</entry>

<entry>
    <title>WEP Is Dead, Long Live WPA</title>
    <link rel="alternate" type="text/html" href="http://linuxcoaching.ie/linux_coaching/2009/09/wep-is-dead-long-live-wpa.html" />
    <id>tag:linuxcoaching.eu,2009:/linux_coaching//1.22</id>

    <published>2009-09-28T17:54:23Z</published>
    <updated>2009-09-28T17:55:47Z</updated>

    <summary> The Final Nail in WEP&apos;s Coffin I have to admit it, this is old news, very old news. WEP is dead, and the final nail had been driven into WEP&apos;s coffin some three years ago. But many WiFi networks...</summary>
    <author>
        <name>Ralph</name>
        <uri>http://kerry-linux.ie</uri>
    </author>
    
        <category term="Cryptography" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="Security" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="Wireless" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="wep" label="WEP" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="wpa" label="WPA" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://linuxcoaching.ie/linux_coaching/">
        <![CDATA[ <h3>The Final Nail in WEP's Coffin</h3>

I have to admit it, this is old news, very old news. WEP is dead, and the
<a href="http://www2.computer.org/portal/web/csdl/doi/10.1109/SP.2006.40">
final nail had been driven into WEP's coffin </a> some three years ago.
But many WiFi networks still use WEP today, although a much more secure 
alternative, WPA-2, has been available for a long time.

<p>
People tend to believe that any encryption is better than none and don't bother to use
high-grade security methods instead of broken ones like WEP. Obviously the publication 
of research papers does have a limited effect on  the ordinary user's willingness to change
habits or consciousness of the problem. Unless the weak methods disappear from the 
router's firmware menu, we'll see people using it.  

</p><p>
</p><h3>Switching Over to WPA</h3>

It's fairly easy to dump WEP and to use WPA-2 instead, because WPA-2 can use a pre-shared key, a secret that must be available both in the router or access point and in
the client machine that is about to establish a secure wireless connection.
There is clearly no need to add further complexity (like Radius servers and the like)
just to replace WEP for a simple wireless link.
<p>
In a first step you have to change the security settings of the access point / router to WPA2-PSK and select a new long secret key for encryption. As WEP-2 uses the advanced encryption standard (AES) with a 256 bit key, the new secret key ought to have as much entropy as possible. You can use the following command to get a reasonably long random secret (of 160 bit entropy) for use by the router and the client.

</p><div class="code">
#&gt;  dd if=/dev/random  bs=1 count=200 |  sha1sum
</div> 
<br />

After that your wireless client is cut off, as the router makes use of a different, and more
secure, access method. It's prudent to use a new secret key as your encryption has been weak in the past and the old one might have been compromised long ago, you'll never know for sure. <p>

In order to re-establish the wireless link the client machine
will use a daemon software called wpa_supplicant that has to be started just before the
wireless network adapter starts to reach out for the access point or router. Of course
the wpa_supplicant will need at least two pieces of information, the name of the wireless
network (its SSID) and the secret encryption key, we've already stored in the router.
Please double-check that the daemon's config file has minimal permissions (root read
access only) to protect the wireless secret key and add something like the following 
lines to your config file "<b>/etc/wpa_supplicant/wpa_supplicant.conf</b>":
</p><p>
</p><div class="output">
network={<br />
        ssid="your-wireless-network-name"<br />
        scan_ssid=0<br />
        key_mgmt=WPA-PSK<br />
        psk="420320d9c0fa8e6cc635381f4717090224385965"<br />
}
</div>
<br />
The only thing you need to ensure is, that the daemon is started whenever you use your
wireless adapter, and that the firewall recognizes your new link. Yes, it's that easy to
dump WEP for good. Finally.
]]>
        
    </content>
</entry>

<entry>
    <title>Booting a CD Without a CD Drive</title>
    <link rel="alternate" type="text/html" href="http://linuxcoaching.ie/linux_coaching/2009/08/booting-a-cd-without-a-cd-drive.html" />
    <id>tag:linuxcoaching.eu,2009:/linux_coaching//1.21</id>

    <published>2009-08-31T07:04:47Z</published>
    <updated>2009-08-31T07:06:48Z</updated>

    <summary>ISO Files Most Linux distributions and a number of CD utilities like Clonezilla or GPARTED-Live come as iso-images, ready to be burned to a CD medium, to start an installation or running a live session for some useful purpose. But...</summary>
    <author>
        <name>Ralph</name>
        <uri>http://kerry-linux.ie</uri>
    </author>
    
        <category term="Behind the Curtains" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="System Administration" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="grub2" label="grub2" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="usbkey" label="USB key" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://linuxcoaching.ie/linux_coaching/">
        <![CDATA[<h3>ISO Files</h3>

Most Linux distributions and a number of CD utilities like
<a href="http://clonezilla.org/">Clonezilla</a> or <a href="http://gparted.sourceforge.net/livecd.php">GPARTED-Live</a> come as iso-images, ready to be burned to a CD medium, to start an installation or running a live session for some useful purpose.
But all these iso files are supposed to be booted inside an ordinary CD drive. <i>What if you just don't have a CD burner at hand or if your CD drive is damaged or missing all together, because you are testing the shiny new motherboard without a CD drive?</i>
<p>
Don't think you are stuck, there's help around the corner that will lead you into a habit of booting your iso files in a much more creative fashion.
</p><p>
</p><blockquote>
"Stop for a moment, could I not simply put the iso file on a USB key using the dd command?
Most modern BIOSes are perfectly capable of booting USB keys and surely there is a USB slot on your new motherboard you can use."
</blockquote>

Of course you could do that, the iso file contains a valid iso9660 filesystem together with the bootloader for CDs. And the dd command will transfer the file to your USB key without adding any other structure. But, don't expect the new USB key to boot like a CD, because after you have changed your BIOS settings to allow booting from a USB hard disk, the BISO will expect the structure of a hard disk not that of an iso-filesystem.

It will look for a MasterBootRecord (MBR) in sector 0 in the same way as if it would boot your ordinary hard disk. And an iso-filesystem doesn't have a MBR and a partition table where the BIOS expects it to be. So forget booting iso files directly.
<p>
</p><blockquote>
"Ok, seems as if there is no way around putting a bootloader like grub on the USB key, and ... , wait, there is a file called iso9660_stage1_5 in the grub directory. It looks like grub has iso9660 support already. Can we use this to boot the iso file?"
</blockquote>

Well, unfortunately no. The iso9660 support built into grub can be used to create a bootable CD with grub as the bootloader. Your file is being used when a new iso file
containing your grub bootloader is created. What we need instead is the ability to read the kernel and the initramdisk inside the iso-filesystem at boot time when no filesystem is mounted.
<p>
</p><blockquote>
"Sounds as if we need a loop device to get at the files inside the iso filesystem. Does
grub support mounting a iso-filesystem using a loop device?"
</blockquote>
<p>
</p><h3>The New Grub</h3>

Yes and no. The traditional grub (version 1) that everyone uses does not have this loopback support, but the grub development team has been working on grub2 for a number of years now, which has loopback support already. The new grub2 is still under
development, so it's not yet ready to replace the legacy grub version 1, but grub2 is exactly what we need to boot our iso files directly.

<p>
</p><h3>A Word Of Caution</h3>

So we are about to prepare a USB key to boot iso files with the grub2 bootloader written into the key's master boot record. Writing MBRs on a Linux system usually raises blood pressure a bit, as we have to be extra cautious not to ruin our running Linux system. If you want to follow me from here, please make sure that you do not perform the grub2 installation on your company's production server and double-check everything before issuing commands, to be on the safe side.

And for those of you, who hesitate to write MBRs at all, I have an offer for you at the end of this posting, read on.

<p>
</p><h3>Preparing The USB Boot Key</h3>

Like any other software grub2 can be installed using the distros repositories, at least with Fedora 11 that I use now. The installation will not replace our legacy grub software we are using to boot our computer, as the new files go into a directory "/boot/grub2" without changing anything of the current grub setup unless grub2 is deliberately used to overwrite the MBR. And this is the only thing we have to avoid. But for now, our objective is to get the grub2 software onto our USB key, writing the key's MBR will then be the crowning event before we start testing the key.
<p>
For preparing the boot key it is absolutely essential that you know how the Linux kernel recognizes your USB key. To find out, you can observe the log file "/var/log/messages" while you plug your key into the computer. For now I assume that you have one hard disk in your computer (/dev/sda) and your USB key will probably show up as /dev/sdb.
First we re-partition the key and create two Linux partitions, a small one of 10 MBytes for the grub2 software and a larger one where all our iso files can be stored:
</p><p>
</p><div class="code">
  #&gt;  umount /dev/sdb1<br />
  #&gt;  fdisk /dev/sdb<br />
  #&gt;  mkfs -t ext3 -c /dev/sdb1 ; tune2fs -L usbboot /dev/sdb1<br />
  #&gt;  mkfs -t ext3 -c /dev/sdb2 ; tune2fs -L isos /dev/sdb2<br />
</div>
<br />
You can now mount the second partition and copy all the iso files you wish to boot into this location.

Writing the MBR now requires that the first partition is mounted on a well know mount point like /mnt, because we will use this directory to write the grub2 software to the key with the following command:
<p>
</p><div class="code">
 #&gt;  grub2-install --root-directory=/mnt /dev/sdb
</div>
<br />
Please double-check that your key is mounted and is called /dev/sdb before you use this command, which populates the directory /mnt/boot/grub2 with grub2 modules and writes the MBR into /dev/sdb.
<p>

As you may know there is one task still left before we can start testing our boot key, we
need to create a menu list, which is called "/boot/grub2/grub.cfg" now. A number of changes have been made to the config file compared to the old grub, so let's have a look at the new configuration:
</p><p>
</p><div class="output">
set timeout=5 <br />
set default=0 <br />
<br />
menuentry "ISOLINUX" {<br />
    loopback loop  (hd0,2)/centos.iso <br />
    set root=(loop) <br />
    linux /isolinux/vmlinuz <br />
    initrd /isolinux/initrd.img <br />
}   <br />
</div>
<br />

The most remarkable change is the numbering of partitions which has become more natural as the first partition now is (hd0,1), while hard disks still start with number 0.
Then the old title entry is replaced by menuentry and loading the kernel is now done with the linux command. Apart from all these cosmetics we can now create a new device called (loop)
that will replace a real partition like (hd0,2) to access files inside the iso-filesystem, once we have connected the iso file with this new device using the loopback command.
<p>
It is even possible to list the files that grub2 can see on the (loop) device using the grub2 command line:
</p><p>
</p><div class="code">
grub2&gt;  set root (loop) <br />
grub2&gt;  ls / <br />
</div>
<br />

Now it's time to check if the ISOLINUX menuentry works. Reboot and see your new boot key fire up the CentOS netinstall process. Voila.
<p>
</p><h3>Download Your Bootable USB Key</h3>

I have prepared an image of my boot key for you that you can download, if you want to create a boot key without the hassle of following the steps above. The small 32 MByte
image file contains all the magic and can be copied to your USB key with the dd command. Please send me an email and I will give you a download  link with the necessary instructions.
Once you have your key working, you can delete and re-create the second partition to make space for all your live CD iso files on the key. All you need to edit is the config file.
<br /><br />That way you can carry all your distros on one key and boot them all from the grub2 menu without having to change the Linux system on your hard disk.
]]>
        
    </content>
</entry>

<entry>
    <title>Hardcore Virtualisation - Learn To Love XEN</title>
    <link rel="alternate" type="text/html" href="http://linuxcoaching.ie/linux_coaching/2009/08/hardcore-virtualisation---learn-to-love-xen.html" />
    <id>tag:linuxcoaching.eu,2009:/kerry_linux_help_center//1.16</id>

    <published>2009-08-17T08:29:20Z</published>
    <updated>2009-08-17T08:44:29Z</updated>

    <summary> A few weeks ago I happened to install CentOS-5.3 on a HP blade server, and while scrolling through the software selection dialog, I ticked everything that had to do with Virtualisation and Clustering. Consequently, the new system came up...</summary>
    <author>
        <name>Ralph</name>
        <uri>http://kerry-linux.ie</uri>
    </author>
    
        <category term="Virtualisation" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="xen" label="Xen" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://linuxcoaching.ie/linux_coaching/">
        <![CDATA[ A few weeks ago I happened to install CentOS-5.3 on a HP blade server, and while scrolling through the software selection dialog, I ticked everything that had to do with Virtualisation and Clustering. Consequently, the new system came up with a shiny Xen kernel and displayed a new icon in the system tools menu, the "Virtual Machine Manager".<br /><br />Everything else was still pretty normal, but the XEN kernel was constantly reminding me to use it for what it's for, starting a virtual machine. As you may know Xen is not the easiest way to get such a virtual system in place even thought there is a graphical frontend for Xen as well. But there is one advantage of Xen that makes up for all the trouble you are having to get the thing going and that is speed. <br /><br />Unlike other virtualisation software like VirtualBox that are designed to run unmodified operating systems within an application environment that emulates everything, Xen aims at running on bare hardware as directly as possible. Xen promises to achieve near native performance by putting a kernel software called hypervisor between the hardware and the guest operating system. The hypervisor occupies the privileged part of the CPU driving the guests away into the non-privileged areas of the CPU, but offering to execute privileged code on behalf of the guests whenever they need to use privileged code. It is this design, that speeds up performance but on the other hand makes it necessary that the guests find their way to the hypervisor by using a special Xen-enabled kernel themselves. So operating systems that cannot be modified to have a Xen kernel (like Microsoft Windows) cannot run in the speedy paravirtualized mode.<br />&nbsp; 
<h3>Beware Of Using Defaults</h3>

In my experience, what makes Xen very tricky to use at first, is that the default values after a fresh installation can easily break your network connection, leaving you with plenty new network interfaces but without a working local network, let alone the internet. On boot there are two services that are being started for the Xen system, the libvirtd and the xend daemons. These services read a single, very short&nbsp; configuration file "/etc/xen/xend-config.sxp" which consists of only nine lines:<br />
<br /><div class="output">
(xend-unix-server yes)<br />
(xend-unix-path /var/lib/xend/xend-socket)<br />
(xend-relocation-hosts-allow '^localhost$ ^localhost\\.localdomain$')<br />
(network-script network-bridge)<br />
(vif-script vif-bridge)<br />
(dom0-min-mem 1024)<br />
(dom0-cpus 0)<br />
(vnc-listen '0.0.0.0')<br />
(vncpasswd '')<br />
</div>
<br />And line no. 4 is the culprit that renames a working ethernet interface, recreates it and introduces two bridge interfaces leaving a mess in which nothing does work any more. I strongly suspect that this is not what defaults are for. Fortunately a small modification gets Xen on track again. Simply don't use the script "network-bridge" and replace it by /bin/true, problem solved. It seems to me that the Xen defaults are striving to isolate the new virtual machines from the ethernet as much as possible, while someone starting to use Xen might want the virtual machine to use the already working internet adapter with a new fixed IP address in the LAN.<br /><br /> 

<h3>Use Your Own Bridge</h3>

If you are after a new virtual machine on the same LAN you can create a config file for a bridge (br0) that replaces your ethernet interface and connect your ethernet interface to that bridge. All firewall settings for your host can remain the same as your new bridge takes over the old fixed IP address and nothing seems to have changed for the LAN.
Once your virtual machine is ready to run, just use the new bridge br0 as network interface in the config file and you can assign an unused IP for the guest on the LAN with the default gateway for internet access, and everything works well.
<p>
<br />
<b><code>/etc/xen/xend-config.sxp</code></b>
</p><div class="output">
...<br />
vif = [ "mac=00:16:3e:27:84:7a,bridge=br0" ]<br />
</div> 

<p>
<br />
<b><code>/etc/sysconfig/network-scripts/ifcfg-br0</code></b>
<br />
</p><div class="output">
DEVICE=br0<br />
TYPE=Bridge<br />
BOOTPROTO=none<br />
ONBOOT=yes<br />
DELAY=0<br />
IPADDR=192.168.2.188         #  your host's LAN IP may be different<br />
NETMASK=255.255.255.0<br />
GATEWAY=192.168.2.1        # adapt IP here<br />
</div>
<p>
<b><code></code></b><br />
<b><code>/etc/sysconfig/network-scripts/ifcfg-eth0</code></b>
<br />
</p><div class="output">
DEVICE=eth1<br />
TYPE=Ethernet<br />
BOOTPROTO=none<br />
ONBOOT=yes<br />
BRIDGE=br0<br />
GATEWAY=192.168.2.1<br />
</div>

<p><br />

Try it, and you are beginning to love Xen!
</p>]]>
        
    </content>
</entry>

<entry>
    <title>Just Linux Everywhere</title>
    <link rel="alternate" type="text/html" href="http://linuxcoaching.ie/linux_coaching/2009/07/just-linux-everywhere.html" />
    <id>tag:linuxcoaching.eu,2009:/kerry_linux_help_center//1.14</id>

    <published>2009-07-18T09:21:42Z</published>
    <updated>2009-12-23T15:45:14Z</updated>

    <summary><![CDATA[ Finally I've started to develop Linux virtual machines for people that simply want to run Linux on Windows or Mac OS-X without the need to touch their hard disk or to engage in installation or troubleshooting at all. &nbsp;&nbsp;...]]></summary>
    <author>
        <name>Ralph</name>
        <uri>http://kerry-linux.ie</uri>
    </author>
    
        <category term="Just Linux" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="virtualmachine" label="virtual machine" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://linuxcoaching.ie/linux_coaching/">
        <![CDATA[ Finally I've started to develop Linux virtual machines for people that simply want to run Linux on Windows or Mac OS-X without the need to touch their hard disk or to engage in installation or troubleshooting at all.<br /><br />
<table><tbody><tr><td valign="top">
</td><td>
<span class="mt-enclosure mt-enclosure-image" style="display: inline;"><a href="http://linuxcoaching.ie/linux_coaching/assets_c/2009/07/img4-35.html" onclick="window.open('http://linuxcoaching.ie/linux_coaching/assets_c/2009/07/img4-35.html','popup','width=800,height=600,scrollbars=no,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no,left=0,top=0'); return false"><img src="http://linuxcoaching.ie/linux_coaching/assets_c/2009/07/img4-thumb-400x300-35.jpg" alt="img4.jpg" class="mt-image-center" style="margin: 0pt auto 20px; text-align: center; display: block;" height="300" width="400" /></a></span>

</td>
<td>&nbsp;&nbsp;</td>
<td valign="top">
        <b><i>Just Linux Everywhere</i></b> is a virtual machine that  you can run on almost
 every operating system including Windows  XP/Vista, Mac OS-X and of course Linux 
 itself. 
 As it is based on 
  <a href="http://www.virtualbox.org">Sun Microsystem's VirtualBox Software</a> 
 you will be able to run a fully fledged Linux inside a window just like another application inside Windows or Mac OS-X. 
 No fundamental changes like overwriting the Master Boot Record are being made to your
 hard disk to run Linux, which is entirely confined to two or three big files on your
 computer that come with the Kerry Linux DVDs. 
        
<p>
 Essentially there are two different versions of 
        <b><i>Just Linux Everywhere</i></b>, a compact version of 4.7 gigabytes (<i><b>JULIE</b></i>) that contains the
        prominent software packages like Firefox, OpenOffice and Evolution 
        and more, which fits on one single DVD and a lager one, <i><b>JULIEplus</b></i> 
        that strives for providing all the very best of Linux software 
        available at the moment. 
</p></td></tr></tbody></table>


     

        Both versions are fully configured, thoroughly tested and
        ready to run within minutes, once you have installed the 
        VirtualBox software in your operating system. There is simply
        no easier way to get Linux running on Windows and Mac without
        the hassle of installation and testing.<br /><br />

        <p align="justify">
        And there are more options to avail of, as <b><i>JULIEplus</i></b>  
        can be set up to store 1 gigabyte (or more) of user data 
        online on a server on the internet encrypted using an automatic
        backup solution. You can use this option anytime, because JULIE
        is prepared to use the Kerry Linux Support Server on your
        request to provide remote administration of your virtual machine
        by Kerry Linux if you like to entrust me to manage your system remotely. <br /></p><p align="justify">These are the options that are available for you at the moment:<br /></p><center>
        <table cellpadding="10">
        <tbody><tr><td>
           <table border="1" cellpadding="5" cellspacing="3">
           <tbody><tr><th bgcolor="#ccffcc"></th>  <th align="center" bgcolor="#ccffcc">JULIE </th> <th align="center" bgcolor="#ccffcc">JULIEplus </th></tr>
           <tr>
             <td bgcolor="#eeeeee">Requirements </td>
             <td align="center" bgcolor="#ccccee"><a href="http://www.virtualbox.org/">Sun VirtualBox</a></td>
             <td align="center" bgcolor="#ccccee"><a href="http://www.virtualbox.org/">Sun VirtualBox</a></td>
           </tr>
           <tr>
             <td bgcolor="#eeeeee">Size </td>
             <td align="right" bgcolor="#ccccee">one DVD, 4.7 GByte</td>
             <td align="right" bgcolor="#ccccee">two DVDs, 8 GByte</td>
           </tr>
           <tr>
             <td bgcolor="#eeeeee">Kerry Linux<br />Support Option </td>
             <td align="right" bgcolor="#ccccee">available</td>
             <td align="right" bgcolor="#ccccee">available</td>
           </tr>
           <tr>
             <td bgcolor="#eeeeee">Online Backup Option </td>
             <td align="right" bgcolor="#ccccee">NO</td>
             <td align="right" bgcolor="#ccccee">YES</td>
           </tr>
           <tr>
             <td bgcolor="#eeeeee">Delivery by mail </td>
             <td align="right" bgcolor="#ccccee">included</td>
             <td align="right" bgcolor="#ccccee">included</td>
           </tr>
           <tr>
             <td bgcolor="#eeeeee">Price </td>
             <td align="right" bgcolor="#ccccee"><b>25 Euro </b></td>
             <td align="right" bgcolor="#ccccee"><b>35 Euro </b></td>
           </tr>
           <tr> 
              <td align="center" bgcolor="#ccffcc"> 
              </td>
              <td align="center" bgcolor="#ccffcc"> 
              <form action="https://www.paypal.com/cgi-bin/webscr" method="post" contenteditable="false">
              <input name="cmd" value="_s-xclick" type="hidden" />
              <input name="hosted_button_id" value="6847357" type="hidden" />
              <input src="https://www.paypal.com/en_US/i/btn/btn_buynowCC_LG.gif" name="submit" alt="PayPal - The safer, easier way to pay online!" type="image" border="0" />
              <img alt="" src="https://www.paypal.com/en_US/i/scr/pixel.gif" height="1" width="1" border="0" />
              </form>

              </td>
              <td align="center" bgcolor="#ccffcc"> 
              <form action="https://www.paypal.com/cgi-bin/webscr" method="post" contenteditable="false">
              <input name="cmd" value="_s-xclick" type="hidden" />
              <input name="hosted_button_id" value="6847382" type="hidden" />
              <input src="https://www.paypal.com/en_US/i/btn/btn_buynowCC_LG.gif" name="submit" alt="PayPal - The safer, easier way to pay online!" type="image" border="0" />
              <img alt="" src="https://www.paypal.com/en_US/i/scr/pixel.gif" height="1" width="1" border="0" />
              </form>
             
           </td></tr>
           </tbody></table>
<br />
<div><br /></div></td></tr></tbody></table></center>]]>
        
    </content>
</entry>

<entry>
    <title>Improve Your VirtualBox Experience</title>
    <link rel="alternate" type="text/html" href="http://linuxcoaching.ie/linux_coaching/2009/06/improve-your-virtualbox-experience.html" />
    <id>tag:linuxcoaching.eu,2009:/kerry_linux_help_center//1.12</id>

    <published>2009-06-29T18:41:50Z</published>
    <updated>2009-12-23T15:44:04Z</updated>

    <summary> Maybe you have followed my guide to easy virtualisation with Sun&apos;s VirtualBox software and you are familiar with the basics of running a virtual machine inside your normal Windows or Linux system by now. I hope that you enjoy...</summary>
    <author>
        <name>Ralph</name>
        <uri>http://kerry-linux.ie</uri>
    </author>
    
        <category term="Virtualisation" scheme="http://www.sixapart.com/ns/types#category" />
    
    
    <content type="html" xml:lang="en" xml:base="http://linuxcoaching.ie/linux_coaching/">
        <![CDATA[ Maybe you have <a href="http://linuxcoaching.ie/linux_coaching/2009/05/virtualisation---the-easy-way.html"> followed my guide to easy virtualisation</a> with Sun's VirtualBox software and you are familiar with the basics of running a virtual machine inside your normal Windows or Linux system by now. I hope that you enjoy the many features of your new virtual machine as most devices used by the virtual machine just work out of the box. Reading CDs and using the audio device for playback should work right away and setting up a printer via the network connection is a matter of few clicks. <br /><br />But the one problem you have certainly run into by now is the low display resolution which defaults to 800x600 pixels, considerably impeding your freedom on the screen. Two simple steps will sort out this problem forever. First select a suitable "Monitor Type" in the Administration - Display dialog and save the setting. Then edit the file "/etc/X11/xorg.conf" and add something like the following in the SubSection "Display" part:<br /><br />
<div class="output">
<pre>       SubSection "Display"
                Viewport   0 0
                Depth     24
                Modes "1024x768"  "800x600"
       EndSubSection</pre>
</div>
<br />After logging out and restarting the X server again you should have a much bigger screen that almost covers the whole display if you switch into FULLSCREEN mod with &lt;Ctl&gt;F.<br /><br />

<p></p><h3>Guest Extensions pave the way for a seamless desktop experience</h3>

During the installation of VirtualBox a custom kernel module was being built that enables the host system to manage the guest, but the guest system runs without any consciousness of the fact that it is only a virtual machine. To ensure a better integration between the host and the guest, SUN have developed a package called "Guest Extensions" that must be installed <i>inside the guest</i> to make it VBox-aware. The installation of Guest Extensions culminate in compiling another kernel module that is being used by the guest to improve communications with the host and to make additional features like shared folders available.<br /><br />Before we can use these desired features we still have to prepare the guest system to compile kernel modules, that means we have to install a full development stack inside the guest system for kernel modules first, and then install the Guest Extensions. Use the following yum command to prepare the CentOS/Fedora host:<br />&nbsp; <br />
<div class="code">
yum update kernel kernel-headers kernel-devel dkms
</div>

<br />The Guest Extensions come as an iso-file "VBoxGuestAdditions.iso" that could be found in the directory "/usr/share/virtualbox". Make sure that this iso file is available as a CD-iso-image to the guest system by adding it to the appropriate section in the Virtual Media Manager menu. Restart your virtual machine to make sure the new, updated kernel is actually running and start the setup script "VBox LinuxAdditions-x86.run" on the CD image after you have mounted the iso-file from within the guest system. After rebooting the virtual machine the new kernel module for the guest becomes active and the extensions are ready to use.

The first thing you'll notice ist that the mouse pointer is no longer confined to the guest window, you can click on everything that is visible on the screen, no matter if it is a host or a guest window. And, of course, you now can copy and paste text between the host and the guest as you like it. A much more important change took place behind the curtain, your access to the hard disk is faster now. Let's have a look at the following table
which gives an overview over transfer rates measured on my laptop.
<p>

</p><center><table cellpadding="15" cellspacing="15">
<tbody><tr><th class="overview"> <i><b>Action</b></i> </th>
      <th class="overview"> <i><b>CentOS 5.2 HOST</b></i>  </th>
      <th class="overview"> <i><b> Fedora 10 GUEST <br />WITH Guest Extensions </b></i> </th>
      <th class="overview"> <i><b> Fedora 10 GUEST <br />without Guest Extensions</b></i>
</th></tr>
<tr><td class="overview"> creating files with zeroes </td>
      <td class="overview"> 27.1 MByte/sec  </td>
      <td class="overview">  21.8 MByte/sec</td>
      <td class="overview">  14.1 MByte/sec</td>
</tr>
<tr><td class="overview"> copying files </td>
      <td class="overview">  12.47 MByte/sec</td>
      <td class="overview">   11.96 MByte/sec</td>
      <td class="overview">  N/A</td>
</tr>
<tr><td class="overview">  writing to network shares</td>
      <td class="overview">  12.26 MByte/sec</td>
      <td class="overview">   5.6 MByte/sec</td>
      <td class="overview">  5.4 MByte/sec</td>
</tr>
<tr><td class="overview"> writing to shared folders </td>
      <td class="overview">  18.0 MByte/sec</td>
      <td class="overview">   6.7 MByte/sec</td>
      <td class="overview">  not available</td>
</tr></tbody></table>
</center>


<br />As you can see the performance has considerably improved for writing files to disk and is almost the same for writing normal files while there is still a huge difference when network attached storage is used to extend the usually poor disk space of the virtual machine. But the use of virtual folders at least enables the host system to write data to the guest's file system rather quickly, while the guest does not really gain any speed doing the reverse operation.<br /><br />Anyway, installing SUN's Guest Extension truly polishes your virtual guest machine and lets it shine brighter than before.<br />
]]>
        
    </content>
</entry>

<entry>
    <title>Clone Your Hard Disk Today - With Clonezilla</title>
    <link rel="alternate" type="text/html" href="http://linuxcoaching.ie/linux_coaching/2009/06/clone-your-hard-disk-today---with-clonezilla.html" />
    <id>tag:linuxcoaching.eu,2009:/kerry_linux_help_center//1.11</id>

    <published>2009-06-06T15:35:52Z</published>
    <updated>2009-06-06T15:37:19Z</updated>

    <summary> I know, you are one of those people who know that it is absolutely essential to make regular backups of your system&apos;s hard disk. There is no excuse not to make regular backups, but as we all know, we...</summary>
    <author>
        <name>Ralph</name>
        <uri>http://kerry-linux.ie</uri>
    </author>
    
        <category term="System Administration" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="Troubleshooting" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="backup" label="backup" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="clonezilla" label="Clonezilla" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://linuxcoaching.ie/linux_coaching/">
        <![CDATA[ I know, you are one of those people who know that it is absolutely essential to make regular backups of your system's hard disk. There is no excuse not to make regular backups, but as we all know, we don't really do that. Or is it just me?<br /><br />No, you have to admit that even though the reasons to make backups are indisputable, something strange always - no, not always, but many times - keeps you from doing the necessary, updating your backups and securely storing them away. Making backups is not fun, but that's not the reason why we don't do it regularly. I suspect that you as well as I simply don't have the right tool yet, to initiate an automatic process that boils down to getting a reliable backup complete and safe to restore, which does not require much attention while assembling the data for us.<br /><br />Fortunately this situation is going to change dramatically for you, today. I've run into a backup solution that is just that, an automatic process that does not require user intervention when started to do the right thing. It's called CLONECILLA and is essentially a Live Linux system, optimised for backup and recovery.<br /><br />
<h3>Clonezilla - Your bootable backup CD</h3>Clonezilla <a href="http://clonezilla.org/download/sourceforge/stable/iso-zip-files.php">
can be downloaded here as an ISO-file of 106 megabytes.</a>. This file contains everything that makes up a bootable Linux system, so be careful to write this downloaded iso-file to your CD in raw-mode. Because it's of no use to have the iso-file on a CD in another file system, the iso-file is the file system and it is the only thing that has to be on the CD.

<br /><br />Did I mention that Clonezilla is a backup solution that covers all sorts of partition types, so that our windows-using friends could use it, too? Clonezilla has the ability to clone a complete hard disk no matter what kind of partition your disk comprises of. It even backs up the master boot record and the partition table, you will get a complete set of data from which all or any part will be recoverable when you need it. And all data is created as zipped files of max. 2 gigabytes size so that everything can be burned to DVDs, if needed.<br /><br />





<h3>Setting Clonezilla on the right track</h3>As we are now heading for a complete backup of your laptop's hard disk, one thing is to be considered before we start, where will all the backup data be stored? Fortunately Clonezilla offers a number of possible storage media ranging from an additional (plugable) local disk, a SSH server or a SAMBA server to the traditional NFS server. I assume that you have a portable USB hard disk on which you will store the backup. Please ensure that the free space on this disk is about half of the size of what you are going to backup, and add a little bit of a buffer, too.<br /><br />I have found that a second thing is important before you start letting Clonezilla create the backup, make sure that all partitions of your hard disk can be mounted. Best practice would be to perform a file system check on all partitions before starting the Clonezilla boot CD.<br /><br />The following few steps are all you need to initiate a full backup of your laptop's hard disk and you will see that once you've selected a few things the rest is going in a jiffy.<br />
<p>
</p><blockquote>
<table cellpadding="10" cellspacing="4">
  <tbody><tr><td valign="top" width="60"><b>Step 1</b></td>
     <td>
        Boot your Clonezilla backup CD, select language and keymap, then select "Start Clonezilla"
<p>
     </p></td></tr>

   <tr><td valign="top"><b>Step 2</b></td>
     <td>
        After selecting the backup media (local_dev) power on your USB disk and allow a few seconds for the system to recognize your new hard disk on which the backup will be stored. Clonezilla creates a directory on the USB disk derived from the date and time of the backup. You can choose where to store this directory on the disk. 
<p>
You can always switch to another terminal using &lt;CTR&gt;&lt;ALT&gt;F2 to see that the USB disk is now mounted on /home/partimag. All files go into this directory.
</p><p>     
</p></td></tr>
  <tr>
     <td valign="top"><b>Step 3</b></td>
    <td>
       Select "savedisk" to ensure that the whole hard disk is backed up. When the partition information is read in Clonezilla will start the backup process automatically.
<p>
     </p></td></tr>
  <tr>
     <td valign="top"><b>Step 4</b></td>
     <td> Depending on the size of your hard disk, you can now relax and let Clonezilla compose your backup for you. Check the backup directory in the meantime to see it filling up with data.
      <p> 
     </p></td></tr>
</tbody></table>
</blockquote>
<p>
The performance of creating the backup is very good, it took 47 minutes for a 30 gigabyte data partition on my three year old laptop. The whole disk (120 gigabyte) was ready after two and a half hours time leaving me a total of 66 gigabytes of compressed data.</p><p>

<br /><i><b>Try Clonezilla today, it takes very little time to be secure. No excuses!</b></i></p><p><br /></p>]]>
        
    </content>
</entry>

<entry>
    <title>Virtualisation - The Easy Way</title>
    <link rel="alternate" type="text/html" href="http://linuxcoaching.ie/linux_coaching/2009/05/virtualisation---the-easy-way.html" />
    <id>tag:linuxcoaching.eu,2009:/kerry_linux_help_center//1.10</id>

    <published>2009-05-15T15:32:50Z</published>
    <updated>2009-12-23T13:15:54Z</updated>

    <summary>Virtualisation is one of the big next things to become mainstream technology. But it&apos;s a complex technology as there are many different software solutions available that differ greatly in terms of usability, flexibility and performance. As always there is a...</summary>
    <author>
        <name>Ralph</name>
        <uri>http://kerry-linux.ie</uri>
    </author>
    
        <category term="HELP-CENTER" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="Virtualisation" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="fedora" label="Fedora" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://linuxcoaching.ie/linux_coaching/">
        <![CDATA[Virtualisation is one of the big next things to become mainstream technology. But it's a complex technology as there are many different software solutions available that differ greatly in terms of usability, flexibility and performance. As always there is a trade-off between ease-of-use and the performance of the guest system on your hardware. <b><i>This time we will try to get a virtual machine up and running with a minimum of possible obstacles on our way to success, and we will try to install a cutting-edge Linux OS, Fedora-11-Preview, which will finally be released in about two weeks, today! </i></b><br /><br />After all, trying out a new Linux distribution without the risk of making a mess of your hard disk is one of the most attractive features of virtualisation. What makes creating a guest virtual machine easy is the graphical user interface of <b>VirtualBox</b> from Sun Microsystems, that will guide us through the process in an intuitive way. Nevertheless the downside of this software is that even though it's open source, it's not entirely free. According to Sun's  <a href="http://www.virtualbox.org/wiki/VirtualBox_PUEL"> "VirtualBox Personal Use and Evaluation License (PUEL)"</a> the software is free to use for personal and educational purposes as well as for product evaluation:<br /><br /><blockquote>
Sun grants you a personal, non-exclusive, non-transferable, limited license without fees to reproduce, install, execute, and use internally the Product a Host Computer for your Personal Use, Educational Use, or Evaluation. "Personal Use" requires that you use the Product on the same Host Computer where you installed it yourself and that no more than one client connect to that Host Computer at a time for the purpose of displaying Guest Computers remotely. "Educational use" is any use in an academic institution (schools, colleges and universities, by teachers and students). "Evaluation" means testing the Product for a reasonable period (that is, normally for a few weeks); after expiry of that term, you are no longer permitted to evaluate the Product. 
</blockquote>

But even though you'll need a commercial license from SUN to use VBox after evaluation, the download is free of charge and the PUEL allows for intense testing and is practicable for a number of  non-commercial environments.<br /><br /><h3>Getting VirtualBox for Your Linux Distribution</h3>

As we are going to install a new Fedora 11 as a guest on top of your current Linux system, the host, the first step is obviously to get VirtualBox for your host system and install it there. Fortunately SUN has prepared binaries for a number of different Linux distributions for download, so <a href="http://www.virtualbox.org/wiki/Downloads">
go to Sun's download page here and choose your package</a>. Binaries are available in rpm or deb format, so your system's native installation tool should do the job.
Just bear in mind to install the kernel headers and the gcc compiler first, to enable VirtualBox to compile a kernel module that will be loaded on boot after installation.<br /><br />Unlike XEN which changes the way your usual Linux system works fundamentally, VirtualBox is just another application that runs inside your normal environment without changing anything on your host, except that it relies on the new kernel module created on installation.<br /><br />
<h3>Preparing VirtualBox for Installation of Fedora</h3>

Do you have two hours to burn? Let's get going.<br /><br />To get to the point where we can start to install Fedora, we basically have to prepare a virtual disk and attach a boot medium to the virtual machine.<br /><br /><br />
<table><tbody><tr><td>
</td><td>
By now you will have found the VirtualBox GUI in the System Tools menu and have started to create a new virtual machine. <br /><br />First, we have to give it a name and select the OS type.<br /><br />Adjust the memory slider to at least 512 MB or even more if you can afford it. The more memory you assign to the virtual machine the faster it will run eventually. <br /></td>
<td>&nbsp;&nbsp;</td>
<td valign="top">
<span class="mt-enclosure mt-enclosure-image" style="display: inline;"><a href="http://linuxcoaching.ie/linux_coaching/assets_c/2009/05/xvm1-10.html" onclick="window.open('http://linuxcoaching.ie/linux_coaching/assets_c/2009/05/xvm1-10.html','popup','width=503,height=371,scrollbars=no,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no,left=0,top=0'); return false"><img src="http://linuxcoaching.ie/linux_coaching/assets_c/2009/05/xvm1-thumb-400x295-10.gif" alt="xvm1.gif" class="mt-image-center" style="margin: 0pt auto 20px; text-align: center; display: block;" height="295" width="400" /></a></span>
</td></tr></tbody></table>

<p>

</p><table><tbody><tr><td valign="top">
</td><td>
<span class="mt-enclosure mt-enclosure-image" style="display: inline;"><a href="http://linuxcoaching.ie/linux_coaching/assets_c/2009/05/xvm2-13.html" onclick="window.open('http://linuxcoaching.ie/linux_coaching/assets_c/2009/05/xvm2-13.html','popup','width=454,height=347,scrollbars=no,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no,left=0,top=0'); return false"><img src="http://linuxcoaching.ie/linux_coaching/assets_c/2009/05/xvm2-thumb-400x305-13.gif" alt="xvm2.gif" class="mt-image-center" style="margin: 0pt auto 20px; text-align: center; display: block;" height="305" width="400" /></a></span>
</td>
<td>&nbsp;&nbsp;</td>
<td>
In a second step we need to create a virtual hard disk in a file. During installation of the guest system this file will be used as the device "/dev/sda". All formatting and partitioning is being performed inside this file although it seems to be a normal block device for the guest system to use.<br /><br />Later, when Fedora uses its hard disk you will be asked to erase all your data on the device "/dev/sda". I can see the sweat on your face when you click the OK button for the first time. Your real hard disk, called /dev/sda as well, will survive this procedure, believe me.<br /><br />You have to choose the final size of your filesystem for the Fedora installation here, so think twice how much space you will need.<br /></td></tr></tbody></table>

<table><tbody><tr><td valign="top">
</td><td>

As you can see I have only spent 4 Gigabytes for my Fedora test system, enough to finish a default installation. But your mileage may vary, you know, and it's not easy to expand your virtual disk after finishing the installation.<br /></td>
<td>&nbsp;&nbsp;</td>
<td valign="top">
<span class="mt-enclosure mt-enclosure-image" style="display: inline;"><a href="http://linuxcoaching.ie/linux_coaching/assets_c/2009/05/xvm3-16.html" onclick="window.open('http://linuxcoaching.ie/linux_coaching/assets_c/2009/05/xvm3-16.html','popup','width=451,height=161,scrollbars=no,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no,left=0,top=0'); return false"><img src="http://linuxcoaching.ie/linux_coaching/assets_c/2009/05/xvm3-thumb-400x142-16.gif" alt="xvm3.gif" class="mt-image-center" style="margin: 0pt auto 20px; text-align: center; display: block;" height="142" width="400" /></a></span>
</td></tr></tbody></table>

<p>

</p><table><tbody><tr><td valign="top">
</td><td>
<span class="mt-enclosure mt-enclosure-image" style="display: inline;"><a href="http://linuxcoaching.ie/linux_coaching/assets_c/2009/05/xvm4-19.html" onclick="window.open('http://linuxcoaching.ie/linux_coaching/assets_c/2009/05/xvm4-19.html','popup','width=503,height=364,scrollbars=no,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no,left=0,top=0'); return false"><img src="http://linuxcoaching.ie/linux_coaching/assets_c/2009/05/xvm4-thumb-400x289-19.gif" alt="xvm4.gif" class="mt-image-center" style="margin: 0pt auto 20px; text-align: center; display: block;" height="289" width="400" /></a></span>
</td>
<td>&nbsp;&nbsp;</td>
<td>
Initialising the file that represents your virtual disk will take a while.<br /><br />Check that the correct vdi-file is selected and finish this part of the job.<br /><br /><br /></td></tr></tbody></table>

<p>

</p><table><tbody><tr><td valign="top">
</td><td>

Before you can start the new virtual machine (to install Fedora) some minor changes to the default settings have to be made.<br /><br />First of all I would recommend to change the network configuration. <br /></td>
<td>&nbsp;&nbsp;</td>
<td valign="top">
<span class="mt-enclosure mt-enclosure-image" style="display: inline;"><a href="http://linuxcoaching.ie/linux_coaching/assets_c/2009/05/xvm5-23.html" onclick="window.open('http://linuxcoaching.ie/linux_coaching/assets_c/2009/05/xvm5-23.html','popup','width=818,height=412,scrollbars=no,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no,left=0,top=0'); return false"><img src="http://linuxcoaching.ie/linux_coaching/assets_c/2009/05/xvm5-thumb-400x201-23.gif" alt="xvm5.gif" class="mt-image-center" style="margin: 0pt auto 20px; text-align: center; display: block;" height="201" width="400" /></a></span>
</td></tr></tbody></table>

<p>

</p><table><tbody><tr><td valign="top">
</td><td>
<span class="mt-enclosure mt-enclosure-image" style="display: inline;"><a href="http://linuxcoaching.ie/linux_coaching/assets_c/2009/05/xvm6-26.html" onclick="window.open('http://linuxcoaching.ie/linux_coaching/assets_c/2009/05/xvm6-26.html','popup','width=665,height=338,scrollbars=no,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no,left=0,top=0'); return false"><img src="http://linuxcoaching.ie/linux_coaching/assets_c/2009/05/xvm6-thumb-400x203-26.gif" alt="xvm6.gif" class="mt-image-center" style="margin: 0pt auto 20px; text-align: center; display: block;" height="203" width="400" /></a></span>
</td>
<td>&nbsp;&nbsp;</td>
<td valign="">
Usually the VirtualBox GUI selects NAT, but I think it's more straightforward to configure the network interface to share the physical host interface with the new guest system.<br /><br /><br />I don't know whether or not this is really necessary in your situation, but it does not hurt anyway.<br /></td></tr></tbody></table>

<p>
</p><table><tbody><tr><td valign="top">
</td><td>
As a last step we need to tell VirtualBox where to find the installation media.<br /><br />If you have a download of the Fedora packages at hand stored in ISO format, you can use it here.<br /><br />For the sake of simplicity I would like to go a different route and would ask you to <a href="http://ftp.heanet.ie/pub/fedora/linux/releases/test/11-Preview/Fedora/i386/iso/Fedora-11-Preview-i386-netinst.iso">download the 166 MB netinstall.iso file from the Fedora downloads page</a>. This file could be burned to a CD making up for a nice boot CD, but we can use the downloaded iso-file here as the requested "Image File". <br /><br />The only problem is, that we did not attach the file to the virtual machine yet.<br /></td>
<td>&nbsp;&nbsp;</td>
<td valign="top">
<span class="mt-enclosure mt-enclosure-image" style="display: inline;"><a href="http://linuxcoaching.ie/linux_coaching/assets_c/2009/05/xvm7-29.html" onclick="window.open('http://linuxcoaching.ie/linux_coaching/assets_c/2009/05/xvm7-29.html','popup','width=449,height=416,scrollbars=no,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no,left=0,top=0'); return false"><img src="http://linuxcoaching.ie/linux_coaching/assets_c/2009/05/xvm7-thumb-400x370-29.gif" alt="xvm7.gif" class="mt-image-center" style="margin: 0pt auto 20px; text-align: center; display: block;" height="370" width="400" /></a></span>
</td></tr></tbody></table>

<p>

</p><table><tbody><tr><td valign="top">
</td><td>
To make it available we have to go back to the "Virtual Media Manager" in the File menu and choose the downloaded iso-file as a CD/DVD image.<br /></td>
<td>&nbsp;&nbsp;</td>
<td valign="top">
<span class="mt-enclosure mt-enclosure-image" style="display: inline;"><a href="http://linuxcoaching.ie/linux_coaching/assets_c/2009/05/xvm8-32.html" onclick="window.open('http://linuxcoaching.ie/linux_coaching/assets_c/2009/05/xvm8-32.html','popup','width=626,height=398,scrollbars=no,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no,left=0,top=0'); return false"><img src="http://linuxcoaching.ie/linux_coaching/assets_c/2009/05/xvm8-thumb-400x254-32.gif" alt="xvm8.gif" class="mt-image-center" style="margin: 0pt auto 20px; text-align: center; display: block;" height="254" width="400" /></a></span>
</td></tr></tbody></table>
<p>
I hope you have come this far and I'd like to  encourage you to start your new virtual machine to go ahead with the installation. Once you've hit the start button again, you should be greeted with the Fedora installation window, and from this point onwards everything should work as if you had inserted a real CD and tried to install on bare hardware. In the course of installation you will inevitably reach the point where the hard disk has to be formatted, so keep an eye on the size of your install disk, it is exactly the size of your vdi-file. It does not matter that your real hard disk is also referenced by /dev/sda, your new /dev/sda is entirely separate, so dont't hesitate to repartition it to your hearts content. And you can safely install the GRUB boot loader in the master boot record, your original one will not be overwritten by the new installation. That's the magic of virtualisation. <br /></p><p><br /></p><p>After finishing your Fedora installation, there is one thing to remember, you have to remove the installation media before booting (the virtual machine) again. Well, you know how we had attached the iso-file to the machine, simply untick the box to detach it, then power off the virtual machine and start it again. Congratulations to your new Fedora 11 almost two weeks ahead of schedule. 

</p>]]>
        
    </content>
</entry>

<entry>
    <title>Hosting Virtual Users</title>
    <link rel="alternate" type="text/html" href="http://linuxcoaching.ie/linux_coaching/2009/05/hosting-virtual-users.html" />
    <id>tag:linuxcoaching.eu,2009:/kerry_linux_help_center//1.9</id>

    <published>2009-05-04T09:16:13Z</published>
    <updated>2009-12-23T13:12:10Z</updated>

    <summary> Normally, a user is someone listed in the system&apos;s database file /etc/passwd. There is no need for a flesh-and-bone user equipped with a password and ready to log in. Many users listed in the system database are simply immaterial...</summary>
    <author>
        <name>Ralph</name>
        <uri>http://kerry-linux.ie</uri>
    </author>
    
        <category term="System Administration" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="Virtual Private Servers" scheme="http://www.sixapart.com/ns/types#category" />
    
    
    <content type="html" xml:lang="en" xml:base="http://linuxcoaching.ie/linux_coaching/">
        <![CDATA[ Normally, a user is someone listed in the system's database file /<b>etc/passwd</b>. There is no need for a flesh-and-bone user equipped with a password and ready to log in. Many users listed in the system database are simply immaterial daemon users, like mysql, listed for the operating system to be able to assign a name (especially a UID in the form of a number) to a running process. <br /><br />But at least these daemon users own processes, i.e. the mysql database server, and of course, real objects like files and directories are owned by those users. In a well run environment these users do not have a password, so their account cannot be abused by somebody else, and almost always the shell that would be started <b>if</b> someone could log into this account is the binary <b>/sbin/nologin,</b> which does exactly what's on the tin, denying login. <br /><br />

<table><tbody><tr><td valign="top">
</td><td>
<span class="mt-enclosure mt-enclosure-image" style="display: inline;"><a href="http://linuxcoaching.ie/linux_coaching/assets_c/2009/05/img3-7.html" onclick="window.open('http://linuxcoaching.ie/linux_coaching/assets_c/2009/05/img3-7.html','popup','width=800,height=600,scrollbars=no,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no,left=0,top=0'); return false"><img src="http://linuxcoaching.ie/linux_coaching/assets_c/2009/05/img3-thumb-400x300-7.jpg" alt="img3.jpg" class="mt-image-center" style="margin: 0pt auto 20px; text-align: center; display: block;" height="300" width="400" /></a></span>
</td>
<td>&nbsp;&nbsp;</td>
<td valign="top">
And then there is another breed of users that seem to be ordinary fellows in the system and still do not exist as a user in the normal sense. These <strong>virtual users</strong> do have the ability to run certain programs, they all have a mailbox in which their private messages arrive and they all need a password to access their home directory, in which all their assets are being stored, but strangely enough there is no trace of them in the system's user base and password file. <p><br />

One can argue that because the virtual users don't have a valid number (UID) they are no users, and in a strict sense this is certainly true. <br /></p><p><em>But how can they own files and use a mailbox, just like other users do?</em>


</p></td></tr></tbody></table>


<h3>Hunting down the virtual users</h3>

We all know that in order to have a mailbox, there has to be a mailbox file (usually in /var/spool/mail) that is owned by the user respectively. And if someone is attempting to read this mailbox, there has to be some kind of authentication, so the password must be stored somewhere.

At this point a real (daemon) user comes into play, the postman Tom, who of course has a valid UID listed in the file /etc/passwd, which is in fact 555 on my system.
<br /><br />
Tom works at the heart of the mail delivery process, managing the virtual user's home directories and their mailboxes, and he is the only real user necessary to serve hundreds of virtual users on the system.  <p>

</p><h3>Virtual home directories and mailboxes</h3>

For every virtual user Tom creates a home directory that is used by IMAP to store the virtual user's inbox and various index and logfiles individually.<p>
</p><div class="output">
-bash-3.2# ls -laR  /kx/dovecot/home<br />
total 16<br />
drwx------ 4 postman root    4096 Nov 16 16:56 .<br />
drwxr-xr-x 5 root    root    4096 Dec  1 15:10 ..<br />
drwx------ 3 postman postman 4096 Nov 16 15:41 alice<br />
drwx------ 3 postman postman 4096 Nov 16 15:19 ron<br />
...
<br />
/kx/dovecot/home/alice/mail:<br />
total 24<br />
drwx------ 3 postman postman 4096 Nov 16 15:44 .<br />
drwx------ 3 postman postman 4096 Nov 16 15:41 ..<br />
drwx------ 4 postman postman 4096 Nov 16 15:44 .imap<br />
-rw------- 1 postman postman   10 Nov 16 15:44 .subscriptions<br />
-rw------- 1 postman postman 5318 Dec 11 18:34 sent-mail<br />
</div>
<br /><p>
All these files have been created by Tom for each of the virtual users.
In order to provide this infrastructure, we have to make sure that Tom is able to use the virtual user's password when needed, and most importantly to handle the authentication process for them as well. The following lines of code show how the configuration of DOVECOT has to be changed for <b>Virtual Domains</b>.
</p><p>
</p><div class="output">
##### VIRTUAL DOMAIN USERS #######<br />
mail_location = mbox:~/mail:INBOX=/kx/dovecot/mail/%n<br />
auth default {<br />
&nbsp;  userdb static {<br />
  &nbsp;&nbsp;     args = uid=postman gid=postman home=/kx/dovecot/home/%n<br />
&nbsp;  }<br />
<br />
 &nbsp;  passdb passwd-file {<br />
  &nbsp;&nbsp;     args = /kx/horde/htpasswd<br />
 &nbsp; }<br />
&nbsp; user = apache<br />
}<br />
</div>
<p><br />

All passwords are stored in the file  /kx/horde/htpasswd in the usual way required by the apache web server. This is important for two reasons, because the dovecot process can use this file to authenticate virtual users by changing permissions to apache for authentication, and simultaneously this file allows other web-based software to access the virtual user's homes with the same password. We will have a look at this later.
<br /></p><p>
</p><div class="output">
ron:hLILWelxS7E82<br />
alice:ildPSIfh7EkT2<br />
</div>
<p>

</p><h3>Getting all email in the right direction</h3>
By now we have managed to install mailbox access for virtual users via IMAP without the need of registration of all these users in the system's database. What we do not have in place is a mechanism to fill up the virtual user's mailboxes with incoming mail.

<p>
As you may suspect another important part of the mail delivery process has to be adjusted to ensure that the virtual users who can have totally different email-addresses will receive their mail without hassle. This time we need to add a few lines to the POSTFIX configuration file and we have to create a mapping between the email addresses and the (real) virtual users, who are supposed to read the mail. 
</p><p>
</p><div class="output">
virtual_mailbox_domains = linuxcoaching.eu, somedomain.ie<br />
virtual_mailbox_base = /kx/dovecot/mail<br />
virtual_mailbox_maps = hash:/kx/dovecot/virtual_mailbox_map<br />
virtual_uid_maps = static:555<br />
virtual_gid_maps = static:555<br />
</div>
<p><br />
The pivotal point here is the text file "kx/dovecot/virtual_mailbox_map" in which each email address is followed by the virtual user's name. But before postfix can use this database to deliver mail it has to be hashed, i.e converted into a database file "kx/dovecot/virtual_mailbox_map.db" with the  postmap command below.
</p><div class="output">
ron@linuxcoaching.eu ron<br />
alice@somedomain.ie alice<br />
</div>
<p>
</p><div class="code">
/usr/sbin/postmap /kx/dovecot/virtual_mailbox_map<br />
</div>

<h3><br /></h3><h3>Extending our infrastructure</h3>

The most important benefit of this system is not to have virtual users in the system's user database and being able to treat them as ordinary users at the same time. As some users tend to choose a weak password this will help to limit the damage that can be done to the system considerably. But once virtual users are established with an email address and password in the manner I have described, it seems to be an obvious idea to use these credentials for another purpose, to organise a file system-like structure for virtual users, to store their data as well. Fortunately such a file storage can be easily set up using the HORDE framework, and in particular the gollem module, that can be configured to use the file system or a MySQL database to store the virtual user's files while making them available for upload and download via a browser-enabled interface. ]]>
        
    </content>
</entry>

<entry>
    <title>Getting Outahere - Explained</title>
    <link rel="alternate" type="text/html" href="http://linuxcoaching.ie/linux_coaching/2009/04/getting-outahere---explained.html" />
    <id>tag:linuxcoaching.eu,2009:/kerry_linux_help_center//1.8</id>

    <published>2009-04-22T17:23:39Z</published>
    <updated>2009-04-24T11:21:06Z</updated>

    <summary>How do I connect to the Internet? By putting a network cable into the DSL router, well, most of the time, yes. But sometimes my laptop needs to establish the connection to the Internet using a wireless data modem. Obviously...</summary>
    <author>
        <name>Ralph</name>
        <uri>http://kerry-linux.ie</uri>
    </author>
    
        <category term="Behind the Curtains" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="Wireless" scheme="http://www.sixapart.com/ns/types#category" />
    
    
    <content type="html" xml:lang="en" xml:base="http://linuxcoaching.ie/linux_coaching/">
        <![CDATA[<h3>How do I connect to the Internet?</h3>

By putting a network cable into the DSL router, well, most of the time, yes. But sometimes my laptop needs to establish the connection to the Internet using a wireless data modem. Obviously this will change a few things on the machine that are not entirely clear to someone starting on this track for the first time.<p>

</p><blockquote>
In this article we will look behind the curtain to understand the process of dialling into the Internet via a wireless modem.
</blockquote><p>

Let's begin with the basic differences. In using the modem, we have decided that the laptop itself will become part of the Internet, while it was only part of the local area network up to now. First of all, that would require to run a firewall on the laptop if you did not already have set up a firewall before. Protecting your machine while connected to the Internet is indispensable, and you have to make sure, that your firewall is not disabled entirely. Check your firewall rules with the following command:
<br />
</p><div class="code">
/sbin/iptables -L
</div>
<div class="output">
Chain INPUT (policy ACCEPT)<br />
target     prot opt source               destination<br />         
<br />
Chain FORWARD (policy DROP)<br />
target     prot opt source               destination<br />         
<br />
Chain OUTPUT (policy ACCEPT)<br />
target     prot opt source               destination<br />
</div>
<p><br /> 
The output above shows, that there is no protection and you have to solve this problem first. Anyway, firewall configuration will be covered in a separate post.</p>
<p>
</p><h3>Where do all these packets go?</h3>
As long as your machine had been using the router an IP number belonging to the router was listed in the laptop's routing table. More precisely, the ethernet adaptor would send every data packet destined for the Internet to the machine with this default address, and for the laptop to be able to establish its own connection, the old default route to the DSL router has to be removed from the network setting. Nowadays we simply click through the network dialog and delete the "default gateway address" there. But if you like to know where to check that setting, please examine the file "ifcfg-eth0" in a directory called "/etc/sysconfig/network-scripts", there should be no GATEWAY line.<br />
<p>
<br />
It is one of the tasks performed by a process called "pppd" to set up a new default route when the connection to the Internet is successfully installed using the modem and a new network interface "ppp0". Getting the Point-To-Point-Protocol-Daemon (pppd) up and running will be the most important thing to get right, but then, fortunately it is the only thing to do. There was no need for a pppd as long as we had the router, but now this process working in the background is responsible for shovelling all packets back and forth into the Internet for us. <br /><br />

</p><h3>Chatting up the PPP Daemon</h3>

Given that everything is well prepared, starting the pppd process is as easy as the following<p><br />
</p><div class="code">
/usr/sbin/pppd file three.options connect '/usr/sbin/chat -v -f three.chat ' /dev/ttyUSB0
</div>
<br /><p>

As I am using a THREE data modem there are two files that determine the process of dialling into the Internet, an options file and the chat-script. The last parameter the pppd process depends on is the device file for the hardware used. In most cases running the pppd fails because this special file that represents the wireless modem does not exist.
Look around if your Linux system lists the device file, and  if not, we cannot proceed unless the hardware is actually accessible through the kernel. 

The kernel module that is responsible to make the wireless modem visible to the kernel is called "usbserial" and it has to be used with two pieces of information, the vendor-id and the product-id, which are different for every modem you use. For my wireless modem I have to use this command.
</p>
<div class="code">
/sbin/modprobe usbserial vendor=0x19d2 product=0x0001
</div><p><br />
You have to check your actual hardware and find out which values are correct for your hardware, using the "lsusb" command for further information.

<br />
Now that the hardware is available through the device file "/dev/ttyUSB0" we can define a few options the pppd process should honour while starting up.
</p><div class="output">
460800<br />
noipdefault<br />
defaultroute<br />
persist<br />
noauth<br />
updetach<br />
novj<br />
novjccomp<br />
nopcomp<nr>
nodeflate<br />
holdoff 5<br />
</nr></div>
<br />
Apart from requesting the desired baud rate the process tries to get a remote IP address from the ISP's login server (noipdefault), does not require the ISP's end point to authenticate itself (noauth) and establishes the default route in the routing table after setting up the connection.

<p>
During this process the pppd process exchanges some information with the ISP's login server on the Internet to get the required IP address. The details of this conversation are lay down in the chat-script. 


</p><p>
</p><div class="output">ABORT   BUSY<br />
ABORT   VOICE <br />
ABORT   "NO CARRIER"<br />
ABORT   "NO DIALTONE"<br />
ABORT   "NO DIAL TONE"<br />
""      ATZ<br />
OK ATE0V1&amp;D2&amp;C1S0=0+IFC=2,2<br />
OK AT+CGDCONT=1,"IP","3ireland.ie"<br />
OK ATDT*99#<br />
CONNECT "" <br />
</div>
<br />
This file lists two corresponding pieces of information each line. While reading the modem input the process waits for the appearance of the first part being sent by the server, responding with the second part which is, in most cases of course, an old-fashioned modem AT command. You can watch this conversation between the modem and the ISP's access machine in detail if you display the tail of the logfile "/var/log/messages".<br />&nbsp;<br />
<div class="code">
/tail -f /var/log/messages
</div><p><br />

Finally, when the remote IP address is obtained, the interface "ppp0" can be used.

</p><h3>Get a decent Name Service - And Enjoy!</h3>

Of course you should be able to surf the web using the new network connection as the default route should be created by the now running pppd process. If you still don't get your Internet applications running there is a last hurdle to overcome. The domain name service (or DNS for short) is always been used by our applications. No matter what kind of program you use, the first step is always the substitution of a domain name by the correct IP address. Because of the fact that this substitution has to be done many times, one or more name servers must be in easy reach for your laptop. I have found some nameservers that work for me and are reliable and fast, but depending on your location, different ones may be better. Try to find the ones that perform best for you and finally record their IP addresses in the file "/etc/resolv.conf" to make sure, that your internet connection is performing well.<br />&nbsp;<br /><p>
Now, this is how I connect to the Internet!  The following excerpt is taken from the usual suspect file  "/<strong>var/log/messages</strong>"
<br /></p><p>
<script type="text/javascript" language="JavaScript">
  function showbox1(selection) {
     obj = document.getElementById("box1");
     if ( selection.selectedIndex == 1 ) {
          obj.style.display = "block";
     } else {
          obj.style.display = "none";
     }
  }
</script>
<select name="selector" onchange="showbox1(this)">
  <option value="0" selected="selected">Hide textbox</option>
  <option value="1">Show textbox</option>
</select>

<textarea cols="80" rows="15" id="box1" style="display: none;">Apr 15 22:15:45 mosel pppd[8859]: pppd 2.4.4 started by root, uid 0
Apr 15 22:15:46 mosel chat[8860]: abort on (BUSY)
Apr 15 22:15:46 mosel chat[8860]: abort on (VOICE)
Apr 15 22:15:46 mosel chat[8860]: abort on (NO CARRIER)
Apr 15 22:15:46 mosel chat[8860]: abort on (NO DIALTONE)
Apr 15 22:15:46 mosel chat[8860]: abort on (NO DIAL TONE)
Apr 15 22:15:46 mosel chat[8860]: send (ATZ^M)
Apr 15 22:15:46 mosel chat[8860]: expect (OK)
Apr 15 22:15:46 mosel chat[8860]: ^M
Apr 15 22:15:46 mosel chat[8860]: +ZUSIMR:2^M
Apr 15 22:15:46 mosel chat[8860]: ^M
Apr 15 22:15:46 mosel chat[8860]: OK
Apr 15 22:15:46 mosel chat[8860]:  -- got it
Apr 15 22:15:46 mosel chat[8860]: send (ATE0V1&amp;D2&amp;C1S0=0+IFC=2,2^M
Apr 15 22:15:46 mosel chat[8860]: expect (OK)
Apr 15 22:15:46 mosel chat[8860]: ^M
Apr 15 22:15:46 mosel chat[8860]: ATE0V1&amp;D2
Apr 15 22:15:46 mosel chat[8860]: +ZUSIMR:2^M
Apr 15 22:15:46 mosel chat[8860]: 1S0=0+IFC=2,2^M^M
Apr 15 22:15:46 mosel chat[8860]: OK
Apr 15 22:15:46 mosel chat[8860]:  -- got it
Apr 15 22:15:46 mosel chat[8860]: send (AT+CGDCONT=1,"IP","3ireland.ie"^M)
Apr 15 22:15:46 mosel chat[8860]: expect (OK)
Apr 15 22:15:46 mosel chat[8860]: ^M
Apr 15 22:15:46 mosel chat[8860]: ^M
Apr 15 22:15:46 mosel chat[8860]: OK
Apr 15 22:15:46 mosel chat[8860]:  -- got it
Apr 15 22:15:46 mosel chat[8860]: send (ATDT*99#^M)
Apr 15 22:15:46 mosel chat[8860]: expect (CONNECT)
Apr 15 22:15:46 mosel chat[8860]: ^M
Apr 15 22:15:46 mosel chat[8860]: ^M
Apr 15 22:15:46 mosel chat[8860]: CONNECT
Apr 15 22:15:46 mosel chat[8860]:  -- got it
Apr 15 22:15:46 mosel chat[8860]: send (^M)
Apr 15 22:15:46 mosel pppd[8859]: Serial connection established.
Apr 15 22:15:46 mosel pppd[8859]: Using interface ppp0
Apr 15 22:15:46 mosel pppd[8859]: Connect: ppp0 &lt;--&gt; /dev/ttyUSB0
Apr 15 22:15:49 mosel pppd[8859]: Could not determine remote IP address: defaulting to 10.64.64.64
Apr 15 22:15:49 mosel pppd[8859]: local  IP address 10.214.138.131
Apr 15 22:15:49 mosel pppd[8859]: remote IP address 10.64.64.64
</textarea>]]>
        
    </content>
</entry>

<entry>
    <title>Learn to Frustrate the Intruders</title>
    <link rel="alternate" type="text/html" href="http://linuxcoaching.ie/linux_coaching/2009/04/learn-to-frustrate-the-intruders.html" />
    <id>tag:linuxcoaching.eu,2009:/kerry_linux_help_center//1.7</id>

    <published>2009-04-16T17:32:12Z</published>
    <updated>2009-04-16T17:39:56Z</updated>

    <summary>Have you ever listened to someone who had been fallen victim to a burglary, someone whose home had been broken into by a criminal, entirely ignoring his privacy, snooping around in his personal belongings and making a total mess of...</summary>
    <author>
        <name>Ralph</name>
        <uri>http://kerry-linux.ie</uri>
    </author>
    
        <category term="Security" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="Virtual Private Servers" scheme="http://www.sixapart.com/ns/types#category" />
    
    
    <content type="html" xml:lang="en" xml:base="http://linuxcoaching.ie/linux_coaching/">
        <![CDATA[Have you ever listened to someone who had been fallen victim to a burglary, someone whose home had been broken into by a criminal, entirely ignoring his privacy, snooping around in his personal belongings and making a total mess of everything coming across his way? It is nearly impossible not to feel the pain yourself this person has been through. <br /><br />And in the online world things are not that different. After all the effort you've put in to getting a Virtual Private (!) Server going, and after furnishing it with something you think is valuable and worth protecting, you can easily get into a similar rage about people starting to break into your VPS the minute you have finished to make it a venerable target for those careless and often thoughtless digital scumbags on the Internet.<br /><br />A brief look at the file "<b>/var/log/security</b>" shows how your virtual home is under attack right at the moment.<br /><br />

<div class="output">
[skipped earier lines ...]<br />
Apr 15 13:25:40 vm829 sshd[15230]: Invalid user admin from 58.151.115.9<br />
Apr 15 12:25:40 vm829 sshd[15231]: input_userauth_request: invalid user admin<br />
Apr 15 12:25:41 vm829 sshd[15231]: Received disconnect from 58.151.115.9: 11: Bye Bye<br />
Apr 15 14:46:01 vm829 sshd[15816]: Did not receive identification string from 210.4.143.55<br />
Apr 15 15:00:28 vm829 sshd[15910]: reverse mapping checking getaddrinfo for 210-4-143-55.inter.net.th failed - POSSIBLE BREAK-IN ATTEMPT!<br />
Apr 15 14:00:28 vm829 sshd[15911]: Received disconnect from 210.4.143.55: 11: Bye Bye<br />
Apr 15 15:00:34 vm829 sshd[15915]: Invalid user fluffy from 210.4.143.55<br />
Apr 15 15:00:34 vm829 sshd[15915]: reverse mapping checking getaddrinfo for 210-4-143-55.inter.net.th failed - POSSIBLE BREAK-IN ATTEMPT!<br />
[skipped following lines ...]<br />
</div>
<br /><br />I sincerely welcome any and all attempts possible to counter the disgusting actions of those, who in most cases are not even remotely aware of or capable to understand, what the software does they are (ab)using.

<br /><p>
</p><h3>Statistics of a Break-In Attack</h3>

Let's have a look at such an attempt to abuse the ssh service at my VPS. It is recorded in the very first hours this machine became visible on the Internet.
<p>
</p><div class="quote">
<blockquote>
<table cellpadding="5">
<tbody><tr> <td> Creation of the VPS </td> <td>&nbsp;&nbsp;</td> <td> Dec 9, 15:00  </td></tr>
<tr> <td>  Begin of Attack</td><td>&nbsp;&nbsp;</td><td> Dec 10, 20:24  </td></tr>
<tr> <td>  End of Attack</td><td>&nbsp;&nbsp;</td><td> Dec 10, 21:12  </td></tr>
<tr> <td> Duration of Attack </td><td>&nbsp;&nbsp;</td><td> 38 minutes  </td></tr>
<tr> <td> Attacker's IP </td><td>&nbsp;&nbsp;</td><td> 58.213.125.25  </td></tr>
<tr> <td>  Number of Break-In Attempts</td><td>&nbsp;&nbsp;</td><td>  583 </td></tr>
<tr> <td>  Attempts to login as root</td><td>&nbsp;&nbsp;</td><td>474 (81.3 %)   </td></tr>
<tr> <td>  Valid user names tried</td><td>&nbsp;&nbsp;</td><td>postscript (5) , mysql (2)   </td></tr>
<tr> <td> Invalid user names tried </td><td>&nbsp;&nbsp;</td><td> 102  </td></tr>
<tr> <td> Usernames tried multiple times </td><td>&nbsp;&nbsp;</td><td> admin (8), george (3), gnax (6), test (2)   </td></tr>
<tr> <td>Selection of other invalid names  </td><td>&nbsp;&nbsp;</td><td>anita, asterisk, dj, email, foo, gv, joe,    </td></tr>
<tr> <td>  </td><td>&nbsp;&nbsp;</td><td> kateroselmau, mythtv, ruby, sales, windywang, wwang  </td></tr>
</tbody></table>
</blockquote></div>

During the best part of an hour the attacker had tried 583 passwords to break into my digital home, nearly every 4 seconds a failed ssh connection was recorded in my logfiles, not unsurprisingly targeting the root account.  As it turned out, the IP address was not bound to a registered domain name, so it could even be a innocent user's PC taken-over by the attacker.
<br /><p>
</p><h3>Counter-Measures</h3>

Some people have suggested trying to play "hide and seek" with the culprits by switching the native port 22 which is used by SSH to something like 51679. Even though that may reduce the rate of attacks, it surely won't deter those who use port scanners to find the port used for SSH.<br /><br />Others rely on periodically updating their "/etc/hosts.deny" file blocking access from IP-addresses that have proven to be suspicious. This may solve the problem for those attacks that always start at the same hosts, but attackers changing their base frequently will still enjoy an open door, once they are using a freshly taken-over host machine.<br /><br />I have been taking a different approach, namely to change the response of my firewall to incoming ssh requests. I changed the rules so that only 3 attempts per 2 minute period are being served. This reduced my server's susceptibility greatly, as the automated attacks tend to break off after very few tries and don't return.<br /><br />The following lines added to my firewall script did the job:<br /><p>
</p><div class="code">
/sbin/iptables -A INPUT -p tcp --dport 22 -m state --state NEW -m recent --set --name SSH<br />
/sbin/iptables -A INPUT -p tcp --dport 22 -m state --state NEW -m recent --update --seconds 120 --hitcount 4 --rttl --name SSH -j DROP<br />
</div>
]]>
        
    </content>
</entry>

</feed>
