LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 11-26-2008, 03:34 PM   #1
Syrrace
LQ Newbie
 
Registered: Nov 2008
Posts: 4

Rep: Reputation: 0
Completely disable SWAP


Is there a method to DISABLE the use of swap space (not to delete it) using a LiveCD (maybe from boot)?

- - -

I have created my own Ubuntu-based live distro for Computer Forensics, but the swap issue is a big problem!

When I boot my distro on the suspect PC, with installed a Linux OS, it is highly probable that would be a previously formatted swap space (like /dev/sda5, for example). And the livecd use this space as its own swap space.

The solutions I tried are many: mainly I tried to edit mountall.sh and checkroot.sh files (in /etc/init.d), and I even edit the line of the swap partition in /etc/fstab:
Code:
#From this
/dev/sda5 swap swap defaults 0 0
#To this
/dev/sda5 none swap ro 0 0
But... no way! If the system is in shortage of RAM, goes to the swap partition instead.

So, this is my situation... Can you give me a hand?

Thank you anyway!
 
Old 11-26-2008, 03:51 PM   #2
Disillusionist
Senior Member
 
Registered: Aug 2004
Location: England
Distribution: Ubuntu
Posts: 1,039

Rep: Reputation: 98
You can turn swap off (as root) by using the following command:

Code:
swapoff -a
This doesn't permanently disable the swap partition however (just turns it off until reboot or a swapon -a command)
 
Old 11-26-2008, 04:05 PM   #3
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,126

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
Too late - once mounted it is compromised from a forensics point of view.
The OP will need to compile a kernel with CONFIG_SWAP=N
 
Old 11-26-2008, 04:08 PM   #4
Disillusionist
Senior Member
 
Registered: Aug 2004
Location: England
Distribution: Ubuntu
Posts: 1,039

Rep: Reputation: 98
Sorry, hadn't read the OP's scenario properly!
 
Old 11-26-2008, 06:49 PM   #5
internetSurfer
Member
 
Registered: Jan 2008
Location: w3c
Distribution: Slackware 12 Zenwalk 5.2
Posts: 71

Rep: Reputation: 16
Not tested but worth a look into embedding dynswapd into the livecd:

Quote:
dynswapd - Dynamic Swap Daemon
http://dynswapd.sourceforge.net/

Dynamically de/activates swap files and partitions as required,
creating and deleting swap files as necessary.

Last edited by internetSurfer; 11-27-2008 at 12:58 AM.
 
Old 11-27-2008, 12:52 AM   #6
Disillusionist
Senior Member
 
Registered: Aug 2004
Location: England
Distribution: Ubuntu
Posts: 1,039

Rep: Reputation: 98
internetSurfer:
As pointed out by syg00 this is for forensic investigation.

If you mount the swap partition of the suspect machine, that swap partition is compromised from a forensics point of view.
 
Old 11-27-2008, 01:00 AM   #7
internetSurfer
Member
 
Registered: Jan 2008
Location: w3c
Distribution: Slackware 12 Zenwalk 5.2
Posts: 71

Rep: Reputation: 16
@Disillusionist

I understand the problem being presented.

unSpawn and I have had this conversation before.
I tend to forget to elaborate on a link or info I post.

Just tossing around the idea of maybe using this program
and configuring the daemon on boot to disable the swap of
the OS being checked and configuring/adding a swap for
analysis.

Example:
  1. livecd goes in
  2. gparted/dynswapd opens up
  3. reconfigs swap
  4. livecd boots
  5. forensic analysis begins

_

Last edited by internetSurfer; 11-27-2008 at 01:26 AM.
 
Old 11-27-2008, 07:09 AM   #8
Syrrace
LQ Newbie
 
Registered: Nov 2008
Posts: 4

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by Disillusionist View Post
You can turn swap off (as root) by using the following command:

Code:
swapoff -a
This doesn't permanently disable the swap partition however (just turns it off until reboot or a swapon -a command)
So... I think I did it, without the kernel compilation... I use the command "swapon -a" and now the swap partition is set in fstab as:

Code:
/dev/sda5 none swap ro,noauto 0 0
I'm trying it on a PC with 2 GB of RAM memory... Yes, I know, too much RAM.
So I used a little trick: I'm using memtester with the value 2000 to fill the RAM. The RAM is filled, but it doesn't swap. The swap remains untouched, md5 certified it.

Do you think it is forensic compliant this method? I think that memtester is secure, but can you suggest me a better method to fill the ram? Something like a little C code with a malloc, maybe?

Thank you...
 
Old 11-27-2008, 07:23 AM   #9
AuroraCA
Member
 
Registered: Jul 2008
Location: Northern CA USA
Distribution: Ubuntu, Slackware, Gentoo, Fedora, Red Hat, Puppy Linux
Posts: 370

Rep: Reputation: 35
From a forensics point of view you should not be using the hard disk at all. You should make a copy of it and use the copy. To examine the disk you would then mount it in another system for access to the files.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to disable swap in kernel 2.4.x lbdgwgt Linux - Kernel 1 10-19-2006 04:04 PM
dbx command for corrosponding commands disable or disable on gdb bshankha AIX 0 09-26-2006 09:38 AM
How to disable swap space entry for a process (Sticky bit?) Pandamatak Linux - General 3 09-25-2006 06:17 PM
how disable anti-aliasing fonts completely and how to change the default system theme user222 Linux - General 2 10-16-2004 02:03 AM
How to disable firewall completely zyzyis Linux - Newbie 2 09-21-2004 08:23 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 05:13 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration