• XSS.stack #1 – первый литературный журнал от юзеров форума

Setting up a RAM-only Linux server as a protection

Doisti74

HDD-drive
Пользователь
Регистрация
12.02.2014
Сообщения
47
Реакции
0
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/
 
cool approach, but server will live until first reboot, so you need to add periodic backups.
i suggest to make backups encrypted with PGP, add to cron something like this:
Код:
mkdir -p /dev/shm/backup
cd /dev/shm
tar -zcf /dev/shm/backup/www.tgz /var/www
mysqldump -u root -pYOURPASSWORD YOURDATABASE > /dev/shm/mysql.sql
tar -zcf /dev/shm/backup/mysql.tgz /dev/shm/mysql.sql
rm -f /dev/shm/mysql.sql 
tar -zcf /dev/shm/full_backup.tgz /dev/shm/backup
rm -rf /dev/shm/backup
gpg --encrypt -a -r FINGERPRINT /dev/shm/full_backup.tgz
rm -f /dev/shm/full_backup.tgz
 


Напишите ответ...
  • Вставить:
Прикрепить файлы
Верх