Created
January 25, 2023 19:41
-
-
Save jfinstrom/4b1b139f71255ec067a310c47f909d6c to your computer and use it in GitHub Desktop.
Generate a password hash for manual update of a FreePBX Userman user
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env php | |
# Copyright (c) 2023 James Finstrom. All rights reserved. | |
# This work is licensed under the terms of the MIT license. | |
# For a copy, see <https://opensource.org/licenses/MIT>. | |
# Usage: ./GenerateUsermanPasswordHash.php Passw0rdString | |
# | |
<?php | |
if(empty($argv[1]){ | |
echo "You must provide a string to hash" . PHP_EOL | |
return 1; | |
} | |
$bootstrap_settings = ['skip_astman' => true ]; | |
include '/etc/freepbx.conf'; | |
$webroot = FreePBX::Config()->get('AMPWEBROOT'); | |
include $webroot . '/admin/modules/userman/vendor/autoload.php'; | |
$passwordHasher = new \Hautelook\Phpass\PasswordHash(8,false); | |
echo $passwordHasher->HashPassword($argv[1]) . PHP_EOL; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment