[SECURITY] Securing /var/tmp and Mounting /tmp As a Separate Filesystem
Register

We are the best invite forum on the internet! Here you will find free invites, free seedboxes, free bonuses, and much more. Our members know the true meaning of sharing and have created a truly global bittorent community! Our site has the most up to date information on all private trackers and our members will guide you and introduce you to this truly secretive and enlightened club. Ready to get started? Register now!


Results 1 to 7 of 7
Like Tree5Likes
  • 5 Post By pulser

Thread: [SECURITY] Securing /var/tmp and Mounting /tmp As a Separate Filesystem

  1. #1

    Join Date
    Nov 2010
    Location
    On the mats
    Posts
    2,089
    Blog Entries
    2

    Default [SECURITY] Securing /var/tmp and Mounting /tmp As a Separate Filesystem

    Hey everyone,

    This is a quick tutorial on securing your server against unwanted and dangerous access.

    By default, it is very easy to access a server's /var/tmp and run some nasty executables. This guide will help you to stop that. Not many people actively do this when securing their servers but it is a necessity to ensure security.

    As with any other guides I write, I try to keep it short and too the point, with more tags than general text ;-)

    So, onwards!

    ##########Part 1, deleting and symlinking /var/temp##########

    1. SSH in to your server
    -
    Code:
    SSH [-p port] user@host/ip
    2. Remove /var/tmp
    Code:
    rm -fR /var/temp
    3. Symlink (symbolic link) it to /tmp
    Code:
    ln -s /tmp /var/tmp
    ##########Part 2, mounting /tmp as a separate filesystem##########

    1. Backup your fstab
    Code:
    cp /etc/fstab /etc/fstab.bak


    2.
    Create a 1GB temp mount partition
    Code:
    cd /var
    Code:
    dd if=/dev/zero of=tmpMnt bs=1024 count=1048576


    3.
    Format the new partition
    Code:
    mkfs.ext3 -j /var/tmpMnt
    *Answer "Y" when asked.

    4.
    Backup the old /tmp
    Code:
    cp -Rp /tmp /tmp_backup


    5.
    Mount the new /tmp filesystem
    Code:
    mount -o loop,noexec,nosuid,rw /var/tmpMnt /tmp


    6.
    Set the necessary permissions
    Code:
    chmod 1777 /tmp


    7.
    Copy files back to /tmp [code]cp -Rp /tmp_backup/* /tmp/ [/code] *Code tags decided not to work here. Don't miss it!*

    8. Add new /tmp to fstab
    Code:
    echo “/var/tmpMnt /tmp ext3 loop,rw,noexec,nosuid,nodev 0 0″ >> /etc/fstab
    And there you go. Your server is now a lot more secure than it was before and chances are, you'v learnt a couple new commands!

    Cheers,
    -Pulser

    Last edited by pulser; December 23rd, 2011 at 08:28 AM.
    Duvaris, strepb, forever21 and 2 others like this.
    I am the the alpha and the omega, the beginning and the end.

    |
    FAQ | RULES | AREA 51 RULES | PM ME |



  2. To remove ads become VIP. Inquire about advertising here.
  3. #2

    Join Date
    Jun 2011
    Posts
    87

    Default

    I think your claim "/var/temp is insecure" begs an explanation...

  4. #3

    Join Date
    Apr 2010
    Location
    Hell
    Posts
    561
    Blog Entries
    2

    Default

    awesome mate awesome thanks :)

    You had become smart in just couple of Months cool :P
    http://www.leaseboxes.com/templates/default/img/leaseboxes.png

    Special thanks to Sky_

    PLEASE HAVE A LOOK HERE

    FUCK S.O.P.A

    Read Here


  5. #4

    Join Date
    Apr 2011
    Posts
    39

    Default

    If you managed to gain shell access, it is very easy to access a user's homedir and run some nasty executables. So, the gain in security by just addressing /tmp is very low at best.

    A real improvement is to run any service that can be used as an attack vector (i.e. at least the webserver) in a BSD jail or in a Linux container.

  6. #5

    Join Date
    Dec 2011
    Posts
    70

    Default

    As addition, if you manage your own DS usign OpenVZ, then this article may makes you easier.
    Code:
    http://www.eukhost.com/forums/f29/how-do-i-mount-tmp-vpses-noexec-nosuid-options-1025/
    Scroll down little bit to get the easy task to do. Hope it help.

  7. #6

    Join Date
    Nov 2010
    Location
    On the mats
    Posts
    2,089
    Blog Entries
    2

    Default

    Quote Originally Posted by pyroscope View Post
    If you managed to gain shell access, it is very easy to access a user's homedir and run some nasty executables. So, the gain in security by just addressing /tmp is very low at best.

    A real improvement is to run any service that can be used as an attack vector (i.e. at least the webserver) in a BSD jail or in a Linux container.
    If someone manages to gain shell access on your box, then you haven't bothered with security at all. I never professed this to be all that is needed to secure your server, it is but one of many processes that should be carried out. Additionally, I would recommend you make an introduction here, so that you can become an actual member of our site.
    I am the the alpha and the omega, the beginning and the end.

    |
    FAQ | RULES | AREA 51 RULES | PM ME |


  8. #7

    Join Date
    Dec 2010
    Posts
    110

    Default

    freebsd install /var/tmp as a default. You don't even need /var/tmp anyway. It's always better to have sepreate mounts i.e /tmp /var. But it's better to remove this and sym link it as pulser stated.
    Also this is a good tutorial to prevent local root access on your server.

    http://www.howtogeek.com/howto/linux/security-tip-disable-root-ssh-login-on-linux/





    http://www.webhostingtalk.com/showthread.php?t=936733
    Last edited by rlittl01; January 22nd, 2012 at 08:36 AM.

Similar Threads

  1. Ubuntu Seedbox with rtorrent/rutorrent and security
    By Deatherage in forum Operating Systems
    Replies: 9
    Last Post: 3 Weeks Ago, 01:32 AM
  2. Security, reinstalling OS and IPS
    By zeuodin in forum Help
    Replies: 6
    Last Post: December 18th, 2010, 03:36 PM
  3. Replies: 16
    Last Post: August 14th, 2010, 10:28 AM
  4. Extensive suggestion; Intro's/GA's, and security.
    By Jschro14 in forum Suggestions
    Replies: 45
    Last Post: February 19th, 2010, 03:35 AM
  5. Firefox - Additional Privacy and Security
    By userlame in forum Internet
    Replies: 2
    Last Post: May 11th, 2009, 12:24 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •