Pull request for branch yem-root-passwd
Hello All!
Here's a re-spin of the second-part of the 'root-paswd' series.
Changes v5 -> v6:
- set root password only for default skeleton, not for custom one (Gustavo)
- rebase on-top current master
Changes v4 -> v5:
- drop patch #1, applied upstream (Peter)
- make the password-encoding scheme generic (ie. not root-speific)
- rebase on-top current master
The following changes since commit 66bfe1d4fe2de50aef6ac3fc836a710fa577cdef:
xdriver_xf86-video-sunffb: remove package (2013-01-05 14:34:48 +0100)
are available in the git repository at:
git://gitorious.org/buildroot/buildroot.git yem-root-passwd
Yann E. MORIN (2):
system: set root password only for default skeleton
target: add different methods to encode passwords
system/Config.in | 84 ++++++++++++++++++++++++++++++++++++++++++++--------- system/system.mk | 5 ++- 2 files changed, 73 insertions(+), 16 deletions(-)
Regards,
Yann E. MORIN
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH 1/2 system: set root password only for default skeleton
In case one is using a custom skeleton, the root pasword might already be set in this case, and should not be overriden.
Just ask for (and set) the root password only for the default skeleton.
--- system/Config.in | 42 +++++++++++++++++++++--------------------- system/system.mk | 2 ++ 2 files changed, 23 insertions(+), 21 deletions(-)
system/Config.in +21 -21
@@ -12,27 +12,6 @@ config BR2_TARGET_GENERIC_ISSUE help Select system banner (/etc/issue) to be displayed at login. -config BR2_TARGET_GENERIC_ROOT_PASSWD - string "Root password" - default "" - help - Set the initial root password (in clear). It will be md5-encrypted. - - If set to empty (the default), then no root password will be set, - and root will need no password to log in. - - WARNING! WARNING! - Although pretty strong, MD5 is now an old hash function, and - suffers from some weaknesses, which makes it susceptible to attacks. - It is showing its age, so this root password should not be trusted - to properly secure any product that can be shipped to the wide, - hostile world. - - WARNING! WARNING! - The password appears in clear in the .config file, and may appear - in the build log! Avoid using a valuable password if either the - .config file or the build log may be distributed! - choice prompt "/dev management" default BR2_ROOTFS_DEVICE_CREATION_STATIC
@@ -140,6 +119,27 @@ endif if BR2_ROOTFS_SKELETON_DEFAULT +config BR2_TARGET_GENERIC_ROOT_PASSWD + string "Root password" + default "" + help + Set the initial root password (in clear). It will be md5-encrypted. + + If set to empty (the default), then no root password will be set, + and root will need no password to log in. + + WARNING! WARNING! + Although pretty strong, MD5 is now an old hash function, and + suffers from some weaknesses, which makes it susceptible to attacks. + It is showing its age, so this root password should not be trusted + to properly secure any product that can be shipped to the wide, + hostile world. + + WARNING! WARNING! + The password appears in clear in the .config file, and may appear + in the build log! Avoid using a valuable password if either the + .config file or the build log may be distributed! + config BR2_TARGET_GENERIC_GETTY_PORT string "Port to run a getty (login prompt) on" default "ttyS0"
system/system.mk +2 -0
@@ -47,7 +47,9 @@ ifneq ($(TARGET_GENERIC_ISSUE),) TARGETS += target-generic-issue endif +ifeq ($(BR2_ROOTFS_SKELETON_DEFAULT),y) TARGETS += target-root-passwd +endif ifneq ($(TARGET_GENERIC_GETTY),) ifeq ($(BR2_ROOTFS_SKELETON_DEFAULT),y)
Signature · 1 line
1.7.2.5
PATCH 2/2 target: add different methods to encode passwords
In reply to Yann E. MORINPasswords can be encoded in different ways (from the weakest to the strongest): des, md5, sha-256, sha-512
Add a choice entry to select the method, defaulting to 'md5'.
---
Previously, this was specific to encode the root password. I have made it generic (ie. not root-specific), in case buildroot needs to encode other passwords in the future (eg. when packages can create users, for which I've just sent an RFC)
--- system/Config.in | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ system/system.mk | 3 ++- 2 files changed, 56 insertions(+), 1 deletions(-)
system/Config.in +54 -0
@@ -13,6 +13,60 @@ config BR2_TARGET_GENERIC_ISSUE Select system banner (/etc/issue) to be displayed at login. choice + bool "Passwords encoding" + default BR2_TARGET_GENERIC_PASSWD_MD5 + help + Choose the password encoding scheme to use when Buildroot + needs to encode a password (eg. the root password, below). + + Note: this is used at build-time, and *not* at runtime. + +config BR2_TARGET_GENERIC_PASSWD_DES + bool "des" + help + Use standard 56-bit DES-based crypt(3) to encode passwords. + + Old, wildly available, but also the weakest, very susceptible to + brute-force attacks. + +config BR2_TARGET_GENERIC_PASSWD_MD5 + bool "md5" + help + Use MD5 to encode passwords. + + The default. Wildly available, and pretty good. + Although pretty strong, MD5 is now an old hash function, and + suffers from some weaknesses, which makes it susceptible to + brute-force attacks. + +config BR2_TARGET_GENERIC_PASSWD_SHA256 + bool "sha-256" + help + Use SHA256 to encode passwords. + + Very strong, but not ubiquitous, although available in glibc + for some time now. Choose only if you are sure your C library + understands SHA256 passwords. + +config BR2_TARGET_GENERIC_PASSWD_SHA512 + bool "sha-512" + help + Use SHA512 to encode passwords. + + Extremely strong, but not ubiquitous, although available in glibc + for some time now. Choose only if you are sure your C library + understands SHA512 passwords. + +endchoice # Passwd encoding + +config BR2_TARGET_GENERIC_PASSWD_METHOD + string + default "des" if BR2_TARGET_GENERIC_PASSWD_DES + default "md5" if BR2_TARGET_GENERIC_PASSWD_MD5 + default "sha-256" if BR2_TARGET_GENERIC_PASSWD_SHA256 + default "sha-512" if BR2_TARGET_GENERIC_PASSWD_SHA512 + +choice prompt "/dev management" default BR2_ROOTFS_DEVICE_CREATION_STATIC
system/system.mk +2 -1
@@ -1,8 +1,9 @@ TARGET_GENERIC_HOSTNAME:=$(call qstrip,$(BR2_TARGET_GENERIC_HOSTNAME)) TARGET_GENERIC_ISSUE:=$(call qstrip,$(BR2_TARGET_GENERIC_ISSUE)) TARGET_GENERIC_ROOT_PASSWD:=$(call qstrip,$(BR2_TARGET_GENERIC_ROOT_PASSWD)) +TARGET_GENERIC_PASSWD_METHOD:=$(call qstrip,$(BR2_TARGET_GENERIC_PASSWD_METHOD)) ifneq ($(TARGET_GENERIC_ROOT_PASSWD),) -TARGET_GENERIC_ROOT_PASSWD_HASH=$(shell mkpasswd -m md5 "$(TARGET_GENERIC_ROOT_PASSWD)") +TARGET_GENERIC_ROOT_PASSWD_HASH=$(shell mkpasswd -m "$(TARGET_GENERIC_PASSWD_METHOD)" "$(TARGET_GENERIC_ROOT_PASSWD)") endif TARGET_GENERIC_GETTY:=$(call qstrip,$(BR2_TARGET_GENERIC_GETTY_PORT)) TARGET_GENERIC_GETTY_BAUDRATE:=$(call qstrip,$(BR2_TARGET_GENERIC_GETTY_BAUDRATE))
Signature · 1 line
1.7.2.5
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Yann" == Yann E MORIN <[email protected]> writes:
Yann> Hello All!
Yann> Here's a re-spin of the second-part of the 'root-paswd' series.
Yann> Changes v5 -> v6:
Yann> - set root password only for default skeleton, not for custom one (Gustavo)
Yann> - rebase on-top current master
Yann> Changes v4 -> v5:
Yann> - drop patch #1, applied upstream (Peter) Yann> - make the password-encoding scheme generic (ie. not root-speific) Yann> - rebase on-top current master
Committed series, thanks.
Signature · 1 line
Bye, Peter Korsgaard
PATCH 1/2 system: set root password only for default skeleton
In reply to Yann E. MORINQuoted 6 lines · Yann E. MORIN
In case one is using a custom skeleton, the root pasword might already be set in this case, and should not be overriden.
Just ask for (and set) the root password only for the default skeleton.
Reported-by Gustavo Zacarias <[email protected]>
Hi Yann, all,
This is another change that in my opinion goes against the philosophy of buildroot. It is another change that tries to make BR a swiss army knife, (can do anything, nothing well). I would prefer a stiletto or Bowie Knife - good for one thing, but very good at that.
Why do we need yet another change to enable something easily done with the post build patch script? An easily built bsp skeleton with an etc/shadow file handles this beautifully. This kind of creeping feature requires maintenance, documentation etc. Why?
We need to separate people who build things using buildroot and end users that use those things. Is it real to think an end user will build from scratch with buildroot? There are full featured distributions for most popular platforms that contain this kind of stuff. For true embedded developers, adding more things like this just complicate things, does not make it easier.
I guess this is the sort of thing it would be good for the European Buildrooters to discuss at their next conference.
Regards, Steve
PATCH 1/2 system: set root password only for default skeleton
Steve, All,
Quoted 4 lines · On Monday 07 January 2013 Steve Calfee wrote:
Quoted 3 lines · Yann E. MORIN
In case one is using a custom skeleton, the root pasword might already be set in this case, and should not be overriden.
Quoted 8 lines
Quoted 3 lines
Just ask for (and set) the root password only for the default skeleton.
Reported-by Gustavo Zacarias <[email protected]>Hi Yann, all,
This is another change that in my opinion goes against the philosophy of buildroot.
IIRC, there have been some complaints on the list by users that just wondered what was the root password:
https://bugs.busybox.net/show_bug.cgi?id=5366 http://lists.busybox.net/pipermail/buildroot/2012-August/057017.html
Having this prompt in the menuconfig makes it clear to the user that Buildroot does not use a hard-coded secret password.
Quoted 4 lines
Why do we need yet another change to enable something easily done with the post build patch script? An easily built bsp skeleton with an etc/shadow file handles this beautifully. This kind of creeping feature requires maintenance, documentation etc. Why?
Well, that's basically where our view diverges:
- first, it is not trivial for everybody. It is for me, and I understand it is for you. But many people come to buildroot with little previous knowledge of Linux in general, and often even less about embdded Linux in particular;
- second, it makes it clear to the user what the root password is (see
above).
Quoted 3 lines
We need to separate people who build things using buildroot and end users that use those things. Is it real to think an end user will build from scratch with buildroot?
I am not sure what you mean by:
- people who build things with Buildroot,
- end users.
To me there are:
A) Buildroot developpers, who change Buildroot code,
B) Buildroot users, who build appliances,
C) users of appliances built with Buildroot.
Where:
- {A} ? {B}
- {A} ? {C} ? {?}
- {B} ? {C} ? {?}
IMHO, Buildroot should *not* take {C} into account, except for the list of packages to include in Buildroot, which is fact of matter to {B}.
Buildroot, however, should catter for {B}, the users of Buildroot. And this is achieved by having people in {A} implement some changes, and even better, people moving from {B} to {A} to do the job. ;-)
What I mean is: some Buildroot users have complained that the root pasword was not known (people in {B}). And the answer was to:
- put it in the doc (IIRC), done by people in {A},
- propose this change, also by people in {A},
so that people in {B} are no longer puzzled what to enter when prompted for the root pasword.
Also, people in {A} may think of a whole new feature, and implement it, without anything being asked for by people in {B} (but probably because people in {A} are also in {B}, they have a need for that change).
In the end, if a change is deemed not fit for use by people in {B}, there is always the solution to revert that change (if enough of them complain! ;-) )
Quoted 4 lines
There are full featured
distributions for most popular platforms that contain this kind of stuff. For true embedded developers, adding more things like this just complicate things, does not make it easier.
Well, true embedded developpers use their own skeleton, right? ;-) (Just kidding).
Well, true embedded developpers (and I've been one for the ~14 past years, now), know how to overcome what you see as a limitation. At least, I (and it seems a few others as well) see it as an enhancement.
Quoted 2 lines
I guess this is the sort of thing it would be good for the European Buildrooters to discuss at their next conference.
Yes. But this series has been floating for quite some time now:
http://lists.busybox.net/pipermail/buildroot/2012-September/058583.html
But I'm afraid that it is in the end the role of the maintainer to decide whether or not this feature is fit for inclusion or not. In this case, it seems it was! ;-) (which does not mean it can't be reverted, either).
Regards,
Yann E. MORIN.
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'