7 Testing clamfs

It is fairly easy to test clamfs. Use the following command to create a harmless file in customs:

echo ’I am harmless!’ > ~/customs/harmless.txt  
  

Then, confirm that clamfs lets you open the harmless file:

cat ~/customs/harmless.txt  
  

Next, let’s get a “harmless” files that will trigger anti-virus action. These files are crafted to have the signature of a virus, but they do not cause any harm even when opened in an unprotected platform.

Download these (http://www.eicar.org/download/eicarcom2.zip) files, and upload it to ~/customs. If you want to by-pass the host operating system’s own virus checking, you can do this directly from the VM. You will need to have wget installed.

sudo aptitude install wget  
  

With wget, you can download the files directly:

pushd ~/customs  
wget http://www.eicar.org/download/eicarcom2.zip  
wget http://www.eicar.org/download/eicar.com  
wget http://www.eicar.org/download/eicar.com.txt  
wget http://www.eicar.org/download/eicar_com.zip  
popd  
  

The commands pushd and popd let you remember the current directory, change to a new one (pushd), and later on get back to the original directory (popd).

Now, try to use the system command file to determine the type of these files:

pushd ~/customs  
file eicarcom2.zip  
file eicar.com  
file eicar.com.txt  
file eicar_com.zip  
popd  
  

You should get error messages like “ˇfilenameż: writable, regular file, no read permission”. This means that the files were scanned on-the-fly, determined infected, and requests to read the files were denied.

In other words, clamfs worked!