Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Why are files like /etc/passwd readable by all?
View unanswered posts
View posts from last 24 hours

Goto page 1, 2  Next  
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
southsider
Guru
Guru


Joined: 05 Jul 2004
Posts: 358

PostPosted: Sat Jan 22, 2005 11:23 pm    Post subject: Why are files like /etc/passwd readable by all? Reply with quote

Pretty simple really, this seems to be a total arse to get around when you want to lock down user accounts - unless I'm missing something obvious...

What's the future? ACL's? SELinux?

:clueless:

Thanks
Back to top
View user's profile Send private message
adaptr
Watchman
Watchman


Joined: 06 Oct 2002
Posts: 6730
Location: Rotterdam, Netherlands

PostPosted: Sun Jan 23, 2005 12:18 am    Post subject: Reply with quote

How so ?
Can you explain to me how you would circumvent the authentication mechanism solely by being able to read the passwd file ?

There are several good howto's and guides on www.tldp.org on basic Linux security and authentication - search for "shadow passwords".

That was a free hint, by the way ;-)
_________________
>>> emerge (3 of 7) mcse/70-293 to /
Essential tools: gentoolkit eix profuse screen
Back to top
View user's profile Send private message
southsider
Guru
Guru


Joined: 05 Jul 2004
Posts: 358

PostPosted: Sun Jan 23, 2005 12:58 am    Post subject: Reply with quote

Thing is, I don't want users to be able to discover everything about my system configuration.

chroot jails seem a bit of a cop-out, though.
Back to top
View user's profile Send private message
thatguyiam
n00b
n00b


Joined: 17 Nov 2004
Posts: 23

PostPosted: Sun Jan 23, 2005 1:15 am    Post subject: Reply with quote

There's jailshell if you really want to tie your users down.
Back to top
View user's profile Send private message
sven-tek
Guru
Guru


Joined: 06 May 2003
Posts: 339

PostPosted: Tue Jan 25, 2005 11:14 pm    Post subject: Reply with quote

they are free to see, because security by obscurity doesn't work :)

for example, windows trys to hide information like this, but you can read
one admin-password that has been changed the last time, from the cache if you are logged in as an administrator too. so windows is only safe because not the hole world knows it.

ups, did i tell?
Back to top
View user's profile Send private message
southsider
Guru
Guru


Joined: 05 Jul 2004
Posts: 358

PostPosted: Tue Feb 15, 2005 1:07 pm    Post subject: Reply with quote

I don't want users to be able to find out about other local users, though...

It's a simple pre-emptive measure.
Back to top
View user's profile Send private message
nevynxxx
Veteran
Veteran


Joined: 12 Nov 2003
Posts: 1123
Location: Manchester - UK

PostPosted: Tue Feb 15, 2005 3:49 pm    Post subject: Reply with quote

sven-tek wrote:
they are free to see, because security by obscurity doesn't work :)


One word....Cryptography.

The art of obscuring information. How does a shadow password file work....it MD5 hashes your password, i.e obscures it.

Show me one security system that *does not* use cryptography, and hence obscurity. I bet you can't.

Saying that, to get proper security you have to obscure the information in the most secure manner possible/reasonable.

To answer the OP, it doesn't matter if the users can read passwd, they cannot write to it, and they cannot read shadow. They cannot gain any useful information, except in the case they want to hack each other, and they have weak passwords.
_________________
My Public Key

Wanted: Instructor in the art of Bowyery
Back to top
View user's profile Send private message
southsider
Guru
Guru


Joined: 05 Jul 2004
Posts: 358

PostPosted: Wed Feb 16, 2005 12:06 am    Post subject: Reply with quote

My idea of a secure system is denying access to everything and then explicitly allowing access to things users require access to.

Apache seems to work that way.
Back to top
View user's profile Send private message
spb
Retired Dev
Retired Dev


Joined: 02 Jan 2004
Posts: 2135
Location: Cambridge, UK

PostPosted: Wed Feb 16, 2005 1:32 am    Post subject: Reply with quote

If you really want to deny access to stuff like this, SELinux can help. However, getting it working on the desktop (ie with X) is a non-trivial undertaking right now. And yes, the default behaviour is to deny everything that isn't explicitly allowed.

Code:
maya ~ # cat /etc/shadow
cat: /etc/shadow: Permission denied
Back to top
View user's profile Send private message
angoraspruce
Apprentice
Apprentice


Joined: 08 Jan 2005
Posts: 193
Location: Minnesota, USA

PostPosted: Wed Feb 16, 2005 1:58 am    Post subject: Reply with quote

nevynxxx wrote:
sven-tek wrote:
they are free to see, because security by obscurity doesn't work :)


One word....Cryptography.


Encryption does not equal obscurity. But rather than playing the dictionary game, I'll let looking the words up as an exercise for the reader! :wink:
Back to top
View user's profile Send private message
justanothergentoofanatic
Guru
Guru


Joined: 29 Feb 2004
Posts: 337

PostPosted: Wed Feb 16, 2005 5:24 am    Post subject: Reply with quote

Well, encryption is provably perfect obscurity. Even if you know everything about how the information was encrypted, you still can't decrypt the information. This is different from most forms of information hiding, where you can retrieve the information as long as you have a rough idea of how it was hidden.

However, nevy does have a valid point if you consider the complete human system instead of just the computers. Even if an e-mail was encrypted, you can always get the information from the person who wrote it. One could argue that encryption is useless obscurity since many hackers/crackers have successfully used social engineering to circumvent it.

Anyway, I think /etc/passwd is visible mainly for legacy reasons. Originally, programs needed to access /etc/passwd so they could validate accounts and verify passwords. But now that we have PAM to do authentication for us, I don't see the need for a world-readable /etc/passwd.

-Mike
Back to top
View user's profile Send private message
RedDawn
Guru
Guru


Joined: 22 Sep 2003
Posts: 368
Location: Los Angeles, California

PostPosted: Wed Feb 16, 2005 6:00 am    Post subject: Reply with quote

spb wrote:
If you really want to deny access to stuff like this, SELinux can help. However, getting it working on the desktop (ie with X) is a non-trivial undertaking right now. And yes, the default behaviour is to deny everything that isn't explicitly allowed.

Code:
maya ~ # cat /etc/shadow
cat: /etc/shadow: Permission denied


I can agree with you on that one, i once tried to install SeLinux on gentoo but failed miserably.

Do you have X and other applications installed and running properly? How about for web hosting with a control panel such as plesk, or cpanel. do you think that the security the box applies into the system wont allow the control panels to work?

Thanks, and im sorry for hijacking this thread. im done now.
Back to top
View user's profile Send private message
j-m
Retired Dev
Retired Dev


Joined: 31 Oct 2004
Posts: 975

PostPosted: Wed Feb 16, 2005 6:14 am    Post subject: Reply with quote

southsider wrote:
I don't want users to be able to find out about other local users, though...

It's a simple pre-emptive measure.


Did you ever try /bin/who... :?: :P
Back to top
View user's profile Send private message
teknomage1
Veteran
Veteran


Joined: 05 Aug 2003
Posts: 1239
Location: Los Angeles, CA

PostPosted: Wed Feb 16, 2005 6:15 am    Post subject: Reply with quote

Couldn't a user get a list of other local users by executing 'ls ../' from their home directory?
Back to top
View user's profile Send private message
nevynxxx
Veteran
Veteran


Joined: 12 Nov 2003
Posts: 1123
Location: Manchester - UK

PostPosted: Wed Feb 16, 2005 9:05 am    Post subject: Reply with quote

My point was that the phrase "security through obscurity is worthless" is compleatly wrong.

At a basic level, the only security that can be obtained, whilst still giving access to some services, is through obscurity.

Obviously some levels of obscurity (i.e cryptography) are better than others.

What is port knocking?? Is it obscurity or is it cryptography? It does after all have a key.

That key is easily sniffed though, at which point it becomes pure obscurity.

Port knocking is useful against script kiddies, i.e. they wont find any open ports. But very bad against a concerted hack attempt, as it gives a false sense of security.

@angoraspruce
[quote=http://www.askoxford.com/]
encrypt

/enkript/

• verb convert into code.

obscure

• adjective (obscurer, obscurest) 1 not discovered or known about; uncertain. 2 not well known. 3 not clearly expressed or easily understood. 4 hard to make out; indistinct.

• verb conceal or make unclear.
[/quote]

That doesn't help much :)

I would say cryptography was a subset of obscurity, where cryptography has known (or unknown) algorithms and known keys.[/quote]
_________________
My Public Key

Wanted: Instructor in the art of Bowyery
Back to top
View user's profile Send private message
rex123
Apprentice
Apprentice


Joined: 21 Apr 2004
Posts: 272

PostPosted: Wed Feb 16, 2005 12:45 pm    Post subject: Reply with quote

The phrase "security though obscurity" normally refers to a security system that relies on other people not knowing how it works. eg hiding something in your shoe. This type of security can be very successful, but it is a mistake to rely on it. "Real" security is gained when you can tell the world exactly what your method is, and they still can't get at your data. That's where cryptography comes in. We all know (basically) how SSL works, for example, but it would take us a long time to decipher any SSL data we capture. Or that's the idea.

On a different subject...
Quote:
My idea of a secure system is denying access to everything and then explicitly allowing access to things users require access to.

Apache seems to work that way


It seems to, but that's only because people generally use a default distributed configuration. With no deny rules, apache actually does the opposite - allows access to everything.

From http://httpd.apache.org/docs/mod/core.html#directory
Quote:

Note that the default Apache access for <Directory /> is Allow from All. This means that Apache will serve any file mapped from an URL. It is recommended that you change this with a block such as

<Directory />
Order Deny,Allow
Deny from All
</Directory>

and then override this for directories you want accessible. See the Security Tips page for more details.
Back to top
View user's profile Send private message
nevynxxx
Veteran
Veteran


Joined: 12 Nov 2003
Posts: 1123
Location: Manchester - UK

PostPosted: Wed Feb 16, 2005 1:48 pm    Post subject: Reply with quote

rex123 wrote:
The phrase "security though obscurity" normally refers to a security system that relies on other people not knowing how it works. eg hiding something in your shoe. This type of security can be very successful, but it is a mistake to rely on it. "Real" security is gained when you can tell the world exactly what your method is, and they still can't get at your data. That's where cryptography comes in. We all know (basically) how SSL works, for example, but it would take us a long time to decipher any SSL data we capture. Or that's the idea.


Usually, start looking into port knocking though amd you get a whole lot of "security through obscurity doesn't work". This even though knowledge of the method is usless unless you know the exact algorithm, i.e. the key.

On the flip side a whole lot of military cryptography has used systems that would be obscurity by your definition. Enigma is the best example.

Unbreakable until someone got hold of an enigma machine.

I think I've made my point and gone wildly enough off topic now, so I'll stop arguing...
_________________
My Public Key

Wanted: Instructor in the art of Bowyery
Back to top
View user's profile Send private message
F.Ultra
Apprentice
Apprentice


Joined: 17 Mar 2004
Posts: 169
Location: Sweden

PostPosted: Wed Feb 16, 2005 2:07 pm    Post subject: Reply with quote

Quote:
Unbreakable until someone got hold of an enigma machine.
Actually no, it was broken way before the cryptographers could get their hands on a enigma machine. But then again this is an extremely bad example of obscurity since the enigma does use a key. Security though obscurity is bad period.
Back to top
View user's profile Send private message
nevynxxx
Veteran
Veteran


Joined: 12 Nov 2003
Posts: 1123
Location: Manchester - UK

PostPosted: Wed Feb 16, 2005 2:16 pm    Post subject: Reply with quote

F.Ultra wrote:
Actually no, it was broken way before the cryptographers could get their hands on a enigma machine. But then again this is an extremely bad example of obscurity since the enigma does use a key. Security though obscurity is bad period.


Ok, my bad, should really check things like that.....I do stand by the general jist though.
_________________
My Public Key

Wanted: Instructor in the art of Bowyery
Back to top
View user's profile Send private message
adaptr
Watchman
Watchman


Joined: 06 Oct 2002
Posts: 6730
Location: Rotterdam, Netherlands

PostPosted: Wed Feb 16, 2005 3:04 pm    Post subject: Reply with quote

By your reasoning, you claim to feel more secure if your home had an unlocked door that nobody could find, than if it had a normal door with a secure lock.

Think about it - I know which one I'd prefer.

There is a difference, but it's subtle enough that nobody's mentioned it yet.
_________________
>>> emerge (3 of 7) mcse/70-293 to /
Essential tools: gentoolkit eix profuse screen
Back to top
View user's profile Send private message
southsider
Guru
Guru


Joined: 05 Jul 2004
Posts: 358

PostPosted: Wed Feb 16, 2005 3:46 pm    Post subject: Reply with quote

OK if I could please knock this thread back on topic...

# chmod 751 /home

Any issues with this? I don't see any. All directories are still properly secured.

Will SELinux deal with stuff like normal users being able to lsmod and do other things they really should have no interest in?
Back to top
View user's profile Send private message
spb
Retired Dev
Retired Dev


Joined: 02 Jan 2004
Posts: 2135
Location: Cambridge, UK

PostPosted: Wed Feb 16, 2005 3:51 pm    Post subject: Reply with quote

RedDawn wrote:
I can agree with you on that one, i once tried to install SeLinux on gentoo but failed miserably.

Do you have X and other applications installed and running properly? How about for web hosting with a control panel such as plesk, or cpanel. do you think that the security the box applies into the system wont allow the control panels to work?
Well, I have my desktop working perfectly under SELinux. Only things that don't work are dbus (because I haven't installed the policy for it yet), bittorrent (because I haven't written the policy yet), and mpd (ditto). Generally speaking you'll have problems with software that wants to do weird stuff yet isn't common enough for someone to have written a decent policy for it (normally meaning anything that isn't in Fedora 3).
Back to top
View user's profile Send private message
nevynxxx
Veteran
Veteran


Joined: 12 Nov 2003
Posts: 1123
Location: Manchester - UK

PostPosted: Wed Feb 16, 2005 4:53 pm    Post subject: Reply with quote

adaptr wrote:
By your reasoning, you claim to feel more secure if your home had an unlocked door that nobody could find, than if it had a normal door with a secure lock.

Think about it - I know which one I'd prefer.

There is a difference, but it's subtle enough that nobody's mentioned it yet.


Who is that a reply to? It's a little difficult to make out.
_________________
My Public Key

Wanted: Instructor in the art of Bowyery
Back to top
View user's profile Send private message
adaptr
Watchman
Watchman


Joined: 06 Oct 2002
Posts: 6730
Location: Rotterdam, Netherlands

PostPosted: Wed Feb 16, 2005 5:48 pm    Post subject: Reply with quote

To you - which seems obvious to me ;-)

Your position on obscurity vs. encryption, and encryption being a form of obscurity.

Perhaps the analogy falls a little short, but in general I do not think of encryption, decent encryption where you can tell a malicious 3rd party exactly which cipher you used, and he will still not be able to crack one message in exponential time, as anything like obscuring sensitive data.

Except in the very, very literal sense, of course...

Heh.

I'll rectify that: the analogy sux0rs ;-)
_________________
>>> emerge (3 of 7) mcse/70-293 to /
Essential tools: gentoolkit eix profuse screen
Back to top
View user's profile Send private message
southsider
Guru
Guru


Joined: 05 Jul 2004
Posts: 358

PostPosted: Wed Feb 16, 2005 7:16 pm    Post subject: Reply with quote

So, any problems with 751'ing /home?
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum