grant123 ... I'm not sure where your getting the idea that shadow is "clearly [an] identifiable weak point", perhaps from a previous post that wrongfully stated that MD5 is used, I'm fairly sure that all password hashes are sha512 (well, I may have changed this myself a long time ago, but again I believe this is now the default). As of now no known vulnerabilities have been exposed in sha512, but like anything of this nature it *could* be vulnerable to attack ... however, if you wanted to attack a password mechanism you would go for brute-forcing the password itself rather than the hash (and such is the inherent "weakness" of passphrases).grant123 wrote:I understand that the way I'm doing this isn't conventional or as secure as possible, but there are other benefits to carrying it out this way so I'd like to make it as secure as I can. It sounds like /etc/shadow is the only clearly identifiable weak point and I'll look into switching to hardened-shadow as soon as it's production-ready.
Incorrect ... the password file is only accessible to root (or via a process running with root privileges, such as 'login').grant123 wrote:To be sure I understand, /etc/shadow is always easily readable by anyone with physical access to any Linux system, correct?
Code: Select all
# ls -l /etc/shadow*
-rw-r----- 1 root root 818 2014-03-13 10:23 /etc/shadow
-rw------- 1 root root 796 2014-03-06 00:44 /etc/shadow-Yes, but the emphasis is on "if" ... and how big an "if" that might be. Its easy to look for potential issues where there are none ... or perhaps better put, these issues are minimal, or the lesser probable weakness. Now, if this worries you why not boot them and run 'passwd' and changing the password on each machine to something unique?grant123 wrote:What makes this scheme undesirable is that I'm moving one system's /etc/shadow to another system so if the passwords there are cracked, both systems are vulnerable?


Code: Select all
kazam@gentoo.org [ ~ ]$ ls -al /etc/passwd
-rw-r--r-- 1 root root 1140 Mar 14 01:33 /etc/passwdCode: Select all
kazam@gentoo.org [ ~ ]$ cat /etc/passwd
root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:/bin/false
daemon:x:2:2:daemon:/sbin:/bin/false
adm:x:3:4:adm:/var/adm:/bin/false
lp:x:4:7:lp:/var/spool/lpd:/bin/false
sync:x:5:0:sync:/sbin:/bin/sync
shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
halt:x:7:0:halt:/sbin:/sbin/halt
news:x:9:13:news:/var/spool/news:/bin/false
uucp:x:10:14:uucp:/var/spool/uucp:/bin/false
operator:x:11:0:operator:/root:/bin/bash
portage:x:250:250:portage:/var/tmp/portage:/bin/false
nobody:x:65534:65534:nobody:/var/empty:/bin/false
man:x:13:15:added by portage for man-db:/usr/share/man:/sbin/nologin
sshd:x:22:22:added by portage for openssh:/var/empty:/sbin/nologin
mail:x:8:12:added by portage for mailbase:/var/spool/mail:/sbin/nologin
postmaster:x:14:249:added by portage for mailbase:/var/spool/mail:/sbin/nologin
postfix:x:207:207:added by portage for postfix:/var/spool/postfix:/sbin/nologin
messagebus:x:101:206:added by portage for dbus:/dev/null:/sbin/nologin
polkitd:x:102:205:added by portage for polkit:/var/lib/polkit-1:/sbin/nologin
kazam:x:1000:1000::/home/kazam:/bin/bash
ntp:x:123:123:added by portage for ntp:/dev/null:/sbin/nologin
Yes, I'm well aware of that ...666threesixes666 wrote:"check /etc/shadow file as root. Passwords hashed with SHA-256 should begin with a $5 and passwords hashed with SHA-512 will begin with $6."
Code: Select all
# whoami
root
# awk -F'$' '/^root/{print "$"$2}' /etc/shadow-
$6Code: Select all
# awk '/\+.*sha512/{print}' <(equery -NC u pambase)
+ + sha512 : Switch Linux-PAM's pam_unix module to use sha512 for passwords hashes rather than MD5. This option requires >=sys-libs/pam-1.0.1 built against >=sys-libs/glibc-2.7, if it's built against an earlier version, it will silently be ignored, and MD5 hashes will be used. All the passwords changed after this USE flag is enabled will be saved to the shadow file hashed using SHA512 function. The password previously saved will be left untouched. Please note that while SHA512-hashed passwords will still be recognised if the USE flag is removed, the shadow file will not be compatibleIt's "/etc/shadow*" that contains the hashes ... so what has /etc/passwd to do with the above?666threesixes666 wrote:Code: Select all
kazam@gentoo.org [ ~ ]$ ls -al /etc/passwd -rw-r--r-- 1 root root 1140 Mar 14 01:33 /etc/passwd
Again, what has /etc/passwd to do with it?666threesixes666 wrote:Code: Select all
kazam@gentoo.org [ ~ ]$ cat /etc/passwd
Wrong ... everyone here knows I'm a long time zsh user/advocate.666threesixes666 wrote:Code: Select all
kazam:x:1000:1000::/home/kazam:/bin/bash
As I [post=7516472]warned you previously[/post] this is now reported ... and btw, your only making your self look silly with this poor attempt at proving me wrong and the silly name calling ...666threesixes666 wrote:KAZAM!!!!!


You will still have the exact same problem. Hardened shadow will not help you if the users have root access. As you said earlier, all they need to do is boot with a live CD, or just take the hard drive out and plug it in another machine.I'll look into switching to hardened-shadow as soon as it's production-ready.
Originally, /etc/passwd contained a hashed version of each account's password. The file itself was readable by any user, which enabled features like looking up usernames by their UIDs, and other tricks unrelated to the passwords themselves. The trouble was that attackers could calculate hashes offline then compare their results against /etc/passwd looking for matches. Shadow shuts down that attack vector by separating the hashed password information into a separate file that is readable only by trusted processes. In a sense, both tcb and hardened-shadow take that same approach: separating unrelated information further to reduce the potency of attacks.
Taking care of passwords
Openwall's tcb mechanism stores salted-and-hashed passwords in a directory of its own, /etc/tcb/, beneath which there is a separate directory for each user. Each user's directory is owned by that user account, and contains their own private shadow file (e.g., /etc/tcb/linus/shadow) also owned by the user.
That is correct. And hardened shadow would not help you.To be sure I understand, /etc/shadow is always easily readable by anyone with physical access to any Linux system, correct? What makes this scheme undesirable is that I'm moving one system's /etc/shadow to another system so if the passwords there are cracked, both systems are vulnerable?
I now see I'd misread the above, if users have "physical access" then the bios should be password protected to prevent users booting from CD's, USB sticks, etc, and the bootloader should be password protected to prevent changes to the boot parameters, etc, (ie, lilo or via grub).SirRobin2318 wrote:That is correct. And hardened shadow would not help you.To be sure I understand, /etc/shadow is always easily readable by anyone with physical access to any Linux system, correct?

And the hard drive should be encrypted so you can't read it from another machine.I now see I'd misread the above, if users have "physical access" then the bios should be password protected to prevent users booting from CD's, USB sticks, etc, and the bootloader should be password protected to prevent changes to the boot parameters, etc, (ie, lilo or via grub).
hehe ... and/or the case should be locked with a padlock (many/most cases come with such things) ... and the keyboard cable should be glued in its slot so no hardware keylogger can be inserted :)SirRobin2318 wrote:And the hard drive should be encrypted so you can't read it from another machine.
.... ooooooor a centralised authentication mechanism should used and pam_unix disabled ... or a RBAC (role-based access control) should be used to limit the root account ... the list goes on :)SirRobin2318 wrote:Oooor you could not share /etc/shadow so it doesn't even matter if a user gains root access.
You forgot the sub-basement, the alligators, etc. Oh, and put it somewhere on a planet around Alpha Centauri, for even better measure.khayyam wrote:hehe ... and/or the case should be locked with a padlock (many/most cases come with such things) ... and the keyboard cable should be glued in its slot so no hardware keylogger can be insertedSirRobin2318 wrote:And the hard drive should be encrypted so you can't read it from another machine.
.... ooooooor a centralised authentication mechanism should used and pam_unix disabled ... or a RBAC (role-based access control) should be used to limit the root account ... the list goes onSirRobin2318 wrote:Oooor you could not share /etc/shadow so it doesn't even matter if a user gains root access.
best ... khay

Yes. My point it is all this could be avoided easily. Instead of trying to protect valuable information, don't give it away in the first place..... ooooooor a centralised authentication mechanism should used and pam_unix disabled ... or a RBAC (role-based access control) should be used to limit the root account ... the list goes on![]()
SirRobin2318 ... ok, perhaps we were talking at cross purposes, or better put, at different tangents. I had somewhat put the question of /etc/shadow to rest and had moved on to the wider question of "security". I *would* in this instance change the password on the various cloned machines ... however ... if the machines in question were exposed to users then /etc/passwd wouldn't be my first concern, I would be more concerned about far easier ways in which the machine might be compromised ... and a security policy that reflects this. So, *before* I might even consider login I would think about the boot procedure (bios and bootloader), physical security (of both the machine and user input), and access controls (including a centralised authentication mechanism ... though this may not be a workable solution for laptops). As I tried to point out earlier: its easy to look for issues where there are none (or that exist only minimally), and so miss the obvious. Even if a machine was rooted sha512 would still need to be broken, or the passphrase brute-forced/keylogged, and though thats a possibility the real concern should be with the methods that someone might get this root access rather than focus on ways of securing /etc/passwd exclusively.SirRobin2318 wrote:My point it is all this could be avoided easily. Instead of trying to protect valuable information, don't give it away in the first place.
I did, thats because alligators are sooooooo 1980's ... flesh eating bacteria is where its at nowadays :)depontius wrote:You forgot the sub-basement, the alligators [....]
Oh yeah? You gonna drive to Alpha Centauri every time udev needs updating? :)depontius wrote:[...] and put it somewhere on a planet around Alpha Centauri, for even better measure.
You're making me feel old - when HHGtG references are no longer automatically spotted. Obviously for systems around Alpha Centauri you want a good, reliable boot mechanism, along with a reliable ssh daemon configuration, etc.khayyam wrote:...
I did, thats because alligators are sooooooo 1980's ... flesh eating bacteria is where its at nowadaysdepontius wrote:You forgot the sub-basement, the alligators [....]
Oh yeah? You gonna drive to Alpha Centauri every time udev needs updating?depontius wrote:[...] and put it somewhere on a planet around Alpha Centauri, for even better measure.
best ... khay