Answer the question
In order to leave comments, you need to log in
How to protect yourself from shells on the server?
Есть виртуальный выделенный сервер. На нем крутятся порядка 50 сайтов, все на разных CMS и версиях. Недавно все сайты практически были заражены шеллами и рассылали письма со спамом. После чего пришлось восстанавливать бэкап. Как можно обезопаситься? Обновлять CMS не представляет возможности, есть модули которые заточены только под текущую версию joomla или opencart например.
Возможно взломали только один сайт и через соседнии директории заразили остальные.
Answer the question
In order to leave comments, you need to log in
First you need to separate the sites from each other physically. The site scripts themselves, temporary files and session files.
For example, the structure might be:
/var/www
+ toster.ru
| + site
| + sessions
| + temp
+ example.com
| + site
| + sessions
| + temp
+ остальные сайты
<VirtualHost *:80>
ServerName example.com
php_admin_value open_basedir /var/www/example.com/:/tmp/
php_admin_value upload_tmp_dir /var/www/example.com/temp/
php_admin_value sys_temp_dir /var/www/example.com/temp/
php_value session.save_path /var/www/example.com/sessions/
</VirtualHost>
[HOST=example.com]
open_basedir /var/www/example.com/:/tmp/
upload_tmp_dir /var/www/example.com/temp/
sys_temp_dir /var/www/example.com/temp/
session.save_path /var/www/example.com/sessions/
[HOST=toster.ru]
; конфиг для toster.ru и т.д.
/var/www (755, root:root)
+ toster.ru (750, my_user:toster)
| + site (755, my_user:toster)
| + sessions (777, my_user:toster)
| + temp (777, my_user:toster)
+ example.com (750, my_user:example)
| + site (755, my_user:example)
| + sessions (777, my_user:example)
| + temp (777, my_user:example)
+ остальные сайты - всё аналогично
<VirtualHost *:80>
ServerName example.com
AssignUserId exapmle example
</VirtualHost>
<VirtualHost *:80>
ServerName toster.ru
AssignUserId toster toster
</VirtualHost>
no way. joomla and opencart are synonymous with holes. Well, maybe not they themselves, but their components. Recently I hacked one site through a blunt insertion, I went through a file upload file that was not closed for direct access from TinyMCE or whoever, I don’t remember
at one time I defended myself as follows (although I protected Bitrix and frameworks, but it doesn’t change the essence)
I kept all sites in git repositories and gave all site files read-only access 0555
If some kind of infection appeared, it was enough for me to restore everything with one command. and git easily showed which files changed and what was changed
, and most importantly, never keep all sites under one user. do not be lazy to create different users. including for databases, and even better install (if you have a vps) control panel
scatter all sites among different users
if the sites do not change, prohibit writing to files and folders and mark all files as unchanged
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question