mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-06-25 16:19:19 +02:00
Encrypt SMTP password at rest with AES-256-GCM
This commit is contained in:
@@ -72,6 +72,11 @@ class SmtpRelay
|
||||
);
|
||||
$row = $stmt->fetch();
|
||||
|
||||
if ($row) {
|
||||
require_once __DIR__ . '/Crypto.php';
|
||||
$row['password'] = Crypto::decrypt($row['password']);
|
||||
}
|
||||
|
||||
return $row ?: [
|
||||
'host' => '',
|
||||
'port' => 587,
|
||||
@@ -124,12 +129,13 @@ class SmtpRelay
|
||||
WHERE id = 1'
|
||||
);
|
||||
|
||||
require_once __DIR__ . '/Crypto.php';
|
||||
$stmt->execute([
|
||||
':host' => trim($merged['host']),
|
||||
':port' => $port,
|
||||
':encryption' => $encryption,
|
||||
':username' => trim($merged['username']),
|
||||
':password' => $merged['password'],
|
||||
':password' => Crypto::encrypt($merged['password']),
|
||||
':from_email' => trim($merged['from_email']),
|
||||
':from_name' => trim($merged['from_name']),
|
||||
':notify_email' => trim($merged['notify_email'] ?? ''),
|
||||
|
||||
Reference in New Issue
Block a user