Securing /tmp in a hosting env

Erwin123

Member
May 14, 2008
207
1
16
On our physical servers we used to set the /tmp partition to noexec, this saved us a lot of trouble.
This is not possible with OpenVZ since there is no separate partition for /tmp.

I searched for a way to protect them anyway since we have a lot of problems with rogue scripts that get uploaded through customers scripts.

I found this thread:
http://www.eukhost.com/forums/f29/how-do-i-mount-tmp-vpses-noexec-nosuid-options-1025/#post14817

This is on a virtuozzo server, will this work for OpenVZ?

* Login to VPS Hosting.

* Edit /etc/fstab

- Under the existing line (there should only be one line)
- add >> none /tmp tmpfs nodev,nosuid,noexec 0 0
- Reboot the VPS Hosting to make the changes take effect.
- Log back in and enter "df -h" to see whether the changes have taken effect.
To protect all the tmp dirs in all containers on a node:

Since Virtuozzo 3.0 SP1 it is very easy to mount /tmp (and /var/tmp if needed) dir on VEs with noexec, nosuid, nodev options using introduced 'bindmount' technology. You can follow the steps below to mount /tmp and /var/tmp directories on all VEs with noexec,nosuid options.

1. Update Virtuozzo installation to Virtuozzo 3 SP1 using 'vzup2date' utility.

2. If you want to mount /tmp and /var/tmp on all VEs with noexec,nosuid,nodev options then do the following:
Insert the following line into the main Virtuozzo configuration file /etc/sysconfig/vz:
Quote:
BINDMOUNT="/tmp,nosuid,noexec,nodev /var/tmp,nosuid,noexec,nodev "
and restart all VEs.
Anyone any thoughts on this?

Edit: I see Parallels has its own knowledgebase article about it:
http://kb.parallels.com/en/648
 
Last edited:
none /tmp tmpfs nodev,nosuid,noexec 0 0

Seems to work indeed.
I will test some more and let you know if this works.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!