grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Idea: implementation of the password command


From: Bean
Subject: Idea: implementation of the password command
Date: Tue, 12 Aug 2008 10:18:02 +0800

Hi,

First of all, we can store the encrypted password in a variable, like
PASSWORD. It's better to store it in grubenv. as it is more flexible,
and also allows the user to change it from the grub environment.

Then, we can add a password hook to normal.mod. Whenever we need
password verification, like before execution of menu or switching to
console mode, we call the hook and check the return value.

I introduce the attribute list concept in the other post. For example,
we can assign some attribute to a menuitem, one of which is "locked".
If we found this attribute, we call the password hook, otherwise
execute the menu directly.

We can also add a userland command check_password, which check the
password and return true or false. This can be used in script to run
some part of code when password matches.

Another way for userland interactive is to use variable hook instead
of command. For example, GET_PASSWORD. Whenever its value is query, we
prompt the user for password and return the encrypted value. Here are
some example of its usage:

# Verify password
if ($PASSWORD = $GET_PASSWORD) then
 ...
fi

# Store the new password
PASSWORD=$GET_PASSWORD
save_env PASSWORD

This way looks neat, but it requires a working test command to be useful.

-- 
Bean




reply via email to

[Prev in Thread] Current Thread [Next in Thread]