Further updates

This commit is contained in:
Pinga 2023-12-03 02:21:34 +02:00
parent 3e25d7afad
commit 734325492e
3 changed files with 66 additions and 2 deletions

View file

@ -115,7 +115,7 @@ class RegistrarsController extends Controller
$randomPrefix .= $characters[rand(0, strlen($characters) - 1)];
}
$currency = $_SESSION['_currency'] ?? 'USD';
$eppPassword = password_hash($data['eppPassword'], PASSWORD_ARGON2ID, ['memory_cost' => 2048, 'time_cost' => 4, 'threads' => 4]);
$eppPassword = password_hash($data['eppPassword'], PASSWORD_ARGON2ID, ['memory_cost' => 1024 * 128, 'time_cost' => 6, 'threads' => 4]);
if (empty($data['ianaId']) || !is_numeric($data['ianaId'])) {
$data['ianaId'] = null;
@ -220,7 +220,7 @@ class RegistrarsController extends Controller
}
}
$panelPassword = password_hash($data['panelPassword'], PASSWORD_ARGON2ID, ['memory_cost' => 2048, 'time_cost' => 4, 'threads' => 4]);
$panelPassword = password_hash($data['panelPassword'], PASSWORD_ARGON2ID, ['memory_cost' => 1024 * 128, 'time_cost' => 6, 'threads' => 4]);
$db->insert(
'users',

View file

@ -0,0 +1,48 @@
<?php
require __DIR__ . '/../vendor/autoload.php'; // Path to the Composer autoload file
// Load environment variables from .env file
$dotenv = Dotenv\Dotenv::createImmutable(__DIR__ . '/..');
$dotenv->load();
// Retrieve database connection details from environment variables
$dbHost = $_ENV['DB_HOST'];
$dbName = $_ENV['DB_DATABASE'];
$dbUser = $_ENV['DB_USERNAME'];
$dbPass = $_ENV['DB_PASSWORD'];
// User details (replace these with actual user data)
$email = 'admin@example.com'; // Replace with admin email
$newPW = 'admin_password'; // Replace with admin password
$username = 'admin'; // Replace with admin username
// Hash the password
$options = [
'memory_cost' => 1024 * 128,
'time_cost' => 6,
'threads' => 4,
];
$hashedPassword = password_hash($newPW, PASSWORD_ARGON2ID, $options);
try {
// Create PDO instance
$pdo = new PDO("mysql:host=$dbHost;dbname=$dbName;charset=utf8", $dbUser, $dbPass);
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
// SQL query
$sql = "INSERT INTO users (email, password, username, status, verified, resettable, roles_mask, registered, last_login, force_logout, tfa_secret, tfa_enabled, auth_method, backup_codes)
VALUES (:email, :password, :username, 1, 1, 1, 0, 1, NULL, 0, NULL, 0, 'password', NULL)";
// Prepare and execute SQL statement
$stmt = $pdo->prepare($sql);
$stmt->execute([
':email' => $email,
':password' => $hashedPassword,
':username' => $username
]);
echo "Admin user created successfully." . PHP_EOL;
} catch (PDOException $e) {
// Handle error
die("Error: " . $e->getMessage());
}

View file

@ -70,6 +70,8 @@ apt install -y mariadb-client mariadb-server php8.2-mysql
mysql_secure_installation
```
(Tune your MariaDB)[https://github.com/major/MySQLTuner-perl]
### 2b. Install and configure PostgreSQL:
```bash
@ -90,6 +92,8 @@ postgres=# CREATE DATABASE registry;
postgres=# \q
```
(Tune your PostgreSQL)[https://pgtune.leopard.in.ua/]
## 3. Install Adminer:
```bash
@ -239,6 +243,18 @@ composer install
This command will install the dependencies defined in your ```composer.json``` file, ensuring that your control panel has all the necessary components to operate effectively.
### Creating an Admin User:
1. Navigate to the 'bin' Directory: Change to the 'bin' subdirectory where the admin user creation script is located. (```create_admin_user.php```)
2. Update Admin User Details: Open the script and enter the desired details for the admin user, such as email, username, and password.
3. Execute the Script: Run the script to create the admin user in your system.
4. Verify Admin Access: Attempt to log in with the new admin credentials to ensure they are functioning correctly.
5. Remove the Script: Once verified, delete the script to maintain system security.
## 8. Setup Web WHOIS:
```bash