Project

General

Profile

Actions

Feature #5585

closed

Support non-md5 root password

Added by Vincent Brillault about 10 years ago. Updated over 9 years ago.

Status:
Duplicate
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

When adding a root password in a hostgroup, Foreman automagically add a salt and hashes it using the md5 algorithm.

Could it be possible to support other, more recent, algorithms, for example SHA-256 or SHA-512 and even blowfish where it is implemented?

I do not know the code, but a simple grep seems to indicate that the following code is responsible for this:
(https://github.com/theforeman/foreman/blob/develop/app/models/concerns/host_common.rb#L108)
self.root_pass = root_pass.empty? ? nil : (root_pass.starts_with?('$') ? root_pass : root_pass.crypt("$1$#{SecureRandom.base64(6)}"))

The '1' in the "$1$" here is problematic.
Could it be changed to a configuration option (with '1' used by default) ?

Thanks in advance,
Vincent

PS: during my greping, I found another part using the root password:
(https://github.com/theforeman/foreman/blob/develop/app/helpers/unattended_helper.rb#L9)
def grub_pass
@grub ? "--md5pass=#{@host.root_pass}": ""
end
This is likely to break if root_pass is not a md5 password.


Related issues 1 (0 open1 closed)

Is duplicate of Foreman - Feature #2127: Support newer hash schemes for root passwordsClosed01/15/2013Actions
Actions

Also available in: Atom PDF