summaryrefslogtreecommitdiffstats
path: root/etc/rc.initial.password
diff options
context:
space:
mode:
authorMatthew Grooms <mgrooms@pfsense.org>2008-08-03 17:54:35 +0000
committerMatthew Grooms <mgrooms@pfsense.org>2008-08-03 17:54:35 +0000
commit659fa7f23bb28d316ec6c99a538ee74bc7ffc0a3 (patch)
tree31ce9604a21b27b3f88c50332251ea570136c817 /etc/rc.initial.password
parent5064cec7670cffa8efa3d7276ebf13c2c9d5e23c (diff)
downloadpfsense-659fa7f23bb28d316ec6c99a538ee74bc7ffc0a3.zip
pfsense-659fa7f23bb28d316ec6c99a538ee74bc7ffc0a3.tar.gz
Cleanup authentication code. The basic auth method, the passwd, htpasswd
and pam backing functions have been removed. The basic auth method was legacy code and the backing functions were redundant with no added value that I could see. A simplified replacement backing function named local_backed has been added that authenticates to the local configuration info which should be identical to system pwdb credentials. Since the htpassword file is no longer required, sync_webgui_passwords and its wrapper function system_password_configure have been removed. The local account management functions were renamed for consistency. A few minor bugs related to setting local passwords have also been corrected.
Diffstat (limited to 'etc/rc.initial.password')
-rwxr-xr-xetc/rc.initial.password26
1 files changed, 17 insertions, 9 deletions
diff --git a/etc/rc.initial.password b/etc/rc.initial.password
index f92055f..82a3edd 100755
--- a/etc/rc.initial.password
+++ b/etc/rc.initial.password
@@ -41,17 +41,25 @@ The webConfigurator password will be reset to the default (which is "' . strtolo
gettext('Do you want to proceed [y|n]?');
if (strcasecmp(chop(fgets($fp)), "y") == 0) {
-
- foreach ($config['system']['user'] as & $user) {
- if (isset($user['uid']) && !$user['uid']) {
- $user['name'] = "admin";
- set_local_user($user, strtolower($g['product_name']));
- write_config(gettext("password changed from console menu"));
- system_password_configure();
- break;
- }
+ $admin_user =& getUserEntryByUID(0);
+ if (!$admin_user) {
+ echo "Failed to locate the admin user account! Attempting to restore access.\n";
+ $admin_user = array();
+ $admin_user['uid'] = 0;
+ $admin_user['priv'] = explode(",", "user-shell-access,page-all");
+ if (!is_array($config['system']['user']))
+ $config['system']['user'] = array();
+ $config['system']['user'][] = $admin_user;
}
+ $admin_user['name'] = "admin";
+ $admin_user['scope'] = "system";
+ $admin_user['blah'] = "set by console";
+
+ local_user_set_password($admin_user, strtolower($g['product_name']));
+ local_user_set($admin_user);
+ write_config(gettext("password changed from console menu"));
+
echo "\n" . gettext('
The password for the webConfigurator has been reset and
the default username has been set to "admin".') . "\n" .
OpenPOWER on IntegriCloud