SSL-Verifizierung als Opt-in: pro Site (UniFi) und für SMTP
- UniFiController: CURLOPT_SSL_VERIFYPEER/-HOST über neues Site-Feld ssl_verify steuerbar (Default aus, da UniFi meist self-signed); testConnection() und alle Aufrufer angepasst - sites: Checkbox in Anlegen/Bearbeiten-Modal, Spalte via Migration 0003 (Alt-Installationen tolerant über '?? 0') - Mailer: stream_context verify_peer/verify_peer_name über neues Setting smtp_verify_ssl (Checkbox im SMTP-Tab) - Sprach-Keys de/en ergänzt https://claude.ai/code/session_01KKVpVPJjrTKGoRgpJcySD4
This commit is contained in:
parent
6e19958a37
commit
968afbb212
12 changed files with 68 additions and 26 deletions
|
|
@ -7,6 +7,7 @@ class Mailer {
|
|||
private $smtpUsername;
|
||||
private $smtpPassword;
|
||||
private $smtpEncryption;
|
||||
private $smtpVerifySsl;
|
||||
private $fromEmail;
|
||||
private $fromName;
|
||||
|
||||
|
|
@ -22,6 +23,7 @@ class Mailer {
|
|||
$this->smtpUsername = $this->db->getSetting('smtp_username', '');
|
||||
$this->smtpPassword = $this->db->getSetting('smtp_password', '');
|
||||
$this->smtpEncryption = $this->db->getSetting('smtp_encryption', 'tls');
|
||||
$this->smtpVerifySsl = $this->db->getSetting('smtp_verify_ssl', '0') === '1';
|
||||
$this->fromEmail = $this->db->getSetting('smtp_from_email', 'noreply@' . ($_SERVER['HTTP_HOST'] ?? 'localhost'));
|
||||
$this->fromName = $this->db->getSetting('smtp_from_name', $this->db->getSetting('app_title', 'UniFi Voucher System'));
|
||||
}
|
||||
|
|
@ -122,11 +124,12 @@ class Mailer {
|
|||
}
|
||||
|
||||
private function connectToSmtp() {
|
||||
// Zertifikatspruefung optional aktivierbar (Setting smtp_verify_ssl)
|
||||
$context = stream_context_create([
|
||||
'ssl' => [
|
||||
'verify_peer' => false,
|
||||
'verify_peer_name' => false,
|
||||
'allow_self_signed' => true
|
||||
'verify_peer' => $this->smtpVerifySsl,
|
||||
'verify_peer_name' => $this->smtpVerifySsl,
|
||||
'allow_self_signed' => !$this->smtpVerifySsl
|
||||
]
|
||||
]);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue