Setting up a RAM-only Linux server as a protection to servers seized

Discussion in 'Linux, Freebsd, *nix' started by Doisti74, 14 Feb 2014.

  1. Doisti74

    Doisti74 New Member

    Joined:
    12 Feb 2014
    Messages:
    1
    Likes Received:
    2
    Reputations:
    6
    May occur that your server is going to be seized if you dont have a bullet-proof.

    In this case, LE will have a lot of info on your files, database, bots. They can even issue uninstall commands if you dont use public/private encryption to deliver update to your bots.

    In this setup, as soon as the server is powered off, all the information is lost.

    Pros: No information leaked, no proof of nothing, you can go to another provider and continue the administration of your bots

    Cons: You need a server with more RAM memory, need daily/hourly backups, your datacenter can't suffer from power loss

    1) Install mysqld and httpd as usual in /var/lib/mysql /var/www/

    2) stop all daemons that uses /var/www/ and /var/lib/
    /etc/init.d/httpd stop
    /etc/init.d/mysqld stop

    3) check if some process are using /var/www/ or /var/lib . If yes, stop them
    lsof -n | egrep '/var/www/|/var/lib'

    4) move all files from /var/www/ and /var/lib/ to other place

    mkdir -p /root/www/ /root/lib/
    mv /var/www/* /root/www/
    mv /var/lib/* /root/lib/

    5) mount a ramfs filesystem there . In this case i am supposing your files and databases are not larger than 1G, and your server has more than 3G of RAM

    mount -t ramfs -o size=1G ramfs /var/lib/
    mount -t ramfs -o size=1G ramfs /var/www/

    6) move all the files back

    mv /root/www/* /var/www/
    mv /root/lib/* /var/lib/

    7) start the daemons

    /etc/init.d/httpd start
    /etc/init.d/mysqld start

    8) now setup your database, files, etc. make sure to monitor if the /var/www/ or /var/lib/ are growing more than 1G (in this case) with the command:

    du -sh /var/www/ /var/lib/
     
    2 people like this.
  2. b3

    b3 Banned

    Joined:
    5 Dec 2004
    Messages:
    2,170
    Likes Received:
    1,155
    Reputations:
    202
    tmpfs better ;) ramfs can damage ur System when you overload RAM-space
     
  3. Doisti74

    Doisti74 New Member

    Joined:
    12 Feb 2014
    Messages:
    1
    Likes Received:
    2
    Reputations:
    6
    sure it can damage.

    i didn't said tmpfs because it will use swap space when RAM is full, causing your data to be written to disk.