LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 07-27-2017, 02:51 PM   #1
justmy2cents
Member
 
Registered: May 2017
Location: U.S.
Distribution: Un*x
Posts: 237
Blog Entries: 2

Rep: Reputation: Disabled
Difference between these two strings?


tmpfs /tmp tmpfs rw,noexec,nosuid 0 0
tmpfs /run/shm tmpfs defaults,noexec,nosuid 0 0

Im putting one of them in /etc/fstab, and I know both these strings are supposed to lock down /tmp to protect the kernel from vulnerabilities that can occur due to shared memory and tmpfs file systems.. But which one is more hardened for security? Also I like to note that I use live installs and I read that the command mount -a, would have these configuration changes take affect without me having to do a system restart (which I cant do cause I'm in a live environment).

Last edited by justmy2cents; 07-27-2017 at 02:54 PM.
 
Old 07-27-2017, 08:36 PM   #2
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 19,324
Blog Entries: 28

Rep: Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142
According to man fstab, this is what the "defaults" option means:

Quote:
defaults
use default options: rw, suid, dev, exec, auto, nouser, and async.
I'm in no way qualified to answer your question, but it seems to me that the phrase "defaults,noexec,nosuid" contains internal contradictions, unless the "noexec,nosuid" cancel out what "defaults" specifies by being positioned after it.

Perhaps someone who does know will help both of us out.
 
Old 07-27-2017, 09:53 PM   #3
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,779

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
In /etc/fstab, the "defaults" option is just a no-op keyword needed when the options field would otherwise be empty, since the file format does not allow for empty fields. If there is any other option in that field, there is no need for "defaults". It has no effect, and that is regardless of where it is in the sequence of options.
 
Old 07-29-2017, 02:19 AM   #4
justmy2cents
Member
 
Registered: May 2017
Location: U.S.
Distribution: Un*x
Posts: 237

Original Poster
Blog Entries: 2

Rep: Reputation: Disabled
I got those strings from "Ubuntu server hardening" websites, and more than a few included the defaults option. Though I understand now why you guys say it's pointless, but maybe it's used for interoperability with /etc/apt/apt.conf? E.g. some packages upon installation need to run scripts out of /tmp, and if /tmp is mounted with noexec the package wont install. So the solution is to remount /tmp without the noexec setting, or to automate it upon installation by adding this code to /etc/apt/apt.conf

Code:
DPkg::Pre-Invoke{"mount -o remount,exec /tmp";};
DPkg::Post-Invoke{"mount -o remount -o remount,rw,noexec,nosuid,nodev /tmp";};
Is anyone familer with the code (the DPkg one) and if so would this new string be compatable with it? none /run/shm tmpfs ro,noexec,nosuid,nodev /tmp";};. Mind you I came up with that myself with what I think I know about this.

Last edited by justmy2cents; 07-31-2017 at 11:33 AM.
 
Old 07-30-2017, 04:35 PM   #5
AwesomeMachine
LQ Guru
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524

Rep: Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015
Systemd does that now. See
Code:
$ man systemd-tmpfiles
$ man tmpfiles.d
 
Old 07-31-2017, 11:05 AM   #6
justmy2cents
Member
 
Registered: May 2017
Location: U.S.
Distribution: Un*x
Posts: 237

Original Poster
Blog Entries: 2

Rep: Reputation: Disabled
I actually recently just found out that /run was created by Lenart Poettering to act as a unified tmpfs to replace multiple tmpfs, such as /var/lock, /dev/shm, /tmp, /var/run.. I'm not sure how Im supposed to feel about this. But anyways thanks for the info! If anyone has a response pertaining to post #4 , that would be cool..

Last edited by justmy2cents; 07-31-2017 at 12:15 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
BASH: replace strings in on file by the strings in another one cristalp Programming 5 10-28-2011 09:47 AM
How to retrieve the text difference between two strings having substrings pklcnu Linux - Newbie 1 05-10-2011 03:35 PM
[SOLVED] Searching and replacing strings in a file with strings in other files xndd Linux - Newbie 16 07-29-2010 02:40 PM
shell script to find the difference betwwn two file and place the difference to other kittunot4u Linux - General 3 07-19-2010 04:26 AM
how to find duplicate strings in vertical column of strings markhod Programming 7 11-02-2005 04:04 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 11:57 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration