issue #128: adding SSL/TLS support forr SMTP

This commit is contained in:
Pepijn Over 2014-11-06 14:29:11 +01:00
parent 54f5dbf8f3
commit 391701721b
20 changed files with 647 additions and 595 deletions

View File

@ -14,6 +14,7 @@ not yet released
* #144: Updated Brazilian translation. * #144: Updated Brazilian translation.
* #146: Updated Russian translation. * #146: Updated Russian translation.
* #147: Updated Spanish translation. * #147: Updated Spanish translation.
* #128: Added SSL/TLS option for SMTP config.
* #131: Allow URL and timeout to be passed as argument to the cronjob. * #131: Allow URL and timeout to be passed as argument to the cronjob.
* #135: Uptime percentage above 100%. * #135: Uptime percentage above 100%.
* #151: Links in install results were stripped automatically from template. * #151: Links in install results were stripped automatically from template.

View File

@ -394,6 +394,7 @@ function psm_build_mail($from_name = null, $from_email = null) {
$phpmailer->IsSMTP(); $phpmailer->IsSMTP();
$phpmailer->Host = psm_get_conf('email_smtp_host'); $phpmailer->Host = psm_get_conf('email_smtp_host');
$phpmailer->Port = psm_get_conf('email_smtp_port'); $phpmailer->Port = psm_get_conf('email_smtp_port');
$phpmailer->SMTPSecure = psm_get_conf('email_smtp_security');
$smtp_user = psm_get_conf('email_smtp_username'); $smtp_user = psm_get_conf('email_smtp_username');
$smtp_pass = psm_get_conf('email_smtp_password'); $smtp_pass = psm_get_conf('email_smtp_password');

View File

@ -180,6 +180,8 @@ $sm_lang = array(
'email_smtp' => 'Активиране на SMTP', 'email_smtp' => 'Активиране на SMTP',
'email_smtp_host' => 'SMTP сървър', 'email_smtp_host' => 'SMTP сървър',
'email_smtp_port' => 'SMTP порт', 'email_smtp_port' => 'SMTP порт',
'email_smtp_security' => 'SMTP security',
'email_smtp_security_none' => 'None',
'email_smtp_username' => 'SMTP потребителско име', 'email_smtp_username' => 'SMTP потребителско име',
'email_smtp_password' => 'SMTP парола', 'email_smtp_password' => 'SMTP парола',
'email_smtp_noauth' => 'Оставете празно за "без аутентикация"', 'email_smtp_noauth' => 'Оставете празно за "без аутентикация"',

View File

@ -180,6 +180,8 @@ $sm_lang = array(
'email_smtp' => 'Zapnout SMTP', 'email_smtp' => 'Zapnout SMTP',
'email_smtp_host' => 'SMTP host', 'email_smtp_host' => 'SMTP host',
'email_smtp_port' => 'SMTP port', 'email_smtp_port' => 'SMTP port',
'email_smtp_security' => 'SMTP security',
'email_smtp_security_none' => 'None',
'email_smtp_username' => 'SMTP uživatelské jméno', 'email_smtp_username' => 'SMTP uživatelské jméno',
'email_smtp_password' => 'SMTP heslo', 'email_smtp_password' => 'SMTP heslo',
'email_smtp_noauth' => 'Ponechte prázdné pro použití SMTP bez hesla', 'email_smtp_noauth' => 'Ponechte prázdné pro použití SMTP bez hesla',

View File

@ -180,6 +180,8 @@ $sm_lang = array(
'email_smtp' => 'Aktiver SMTP', 'email_smtp' => 'Aktiver SMTP',
'email_smtp_host' => 'SMTP vært', 'email_smtp_host' => 'SMTP vært',
'email_smtp_port' => 'SMTP port', 'email_smtp_port' => 'SMTP port',
'email_smtp_security' => 'SMTP security',
'email_smtp_security_none' => 'None',
'email_smtp_username' => 'SMTP brugernavn', 'email_smtp_username' => 'SMTP brugernavn',
'email_smtp_password' => 'SMTP adgangskode', 'email_smtp_password' => 'SMTP adgangskode',
'email_smtp_noauth' => 'Efterladt blank hvis det ikke er opkrævet', 'email_smtp_noauth' => 'Efterladt blank hvis det ikke er opkrævet',

View File

@ -180,6 +180,8 @@ $sm_lang = array(
'email_smtp' => 'SMTP-Versand aktivieren', 'email_smtp' => 'SMTP-Versand aktivieren',
'email_smtp_host' => 'SMTP Server/Host', 'email_smtp_host' => 'SMTP Server/Host',
'email_smtp_port' => 'SMTP Port', 'email_smtp_port' => 'SMTP Port',
'email_smtp_security' => 'SMTP security',
'email_smtp_security_none' => 'None',
'email_smtp_username' => 'SMTP Benutzername', 'email_smtp_username' => 'SMTP Benutzername',
'email_smtp_password' => 'SMTP Passwort', 'email_smtp_password' => 'SMTP Passwort',
'email_smtp_noauth' => 'Feld leer lassen, bei fehlender Authentifizierung', 'email_smtp_noauth' => 'Feld leer lassen, bei fehlender Authentifizierung',

View File

@ -180,6 +180,8 @@ $sm_lang = array(
'email_smtp' => 'Enable SMTP', 'email_smtp' => 'Enable SMTP',
'email_smtp_host' => 'SMTP host', 'email_smtp_host' => 'SMTP host',
'email_smtp_port' => 'SMTP port', 'email_smtp_port' => 'SMTP port',
'email_smtp_security' => 'SMTP security',
'email_smtp_security_none' => 'None',
'email_smtp_username' => 'SMTP username', 'email_smtp_username' => 'SMTP username',
'email_smtp_password' => 'SMTP password', 'email_smtp_password' => 'SMTP password',
'email_smtp_noauth' => 'Leave blank for no authentication', 'email_smtp_noauth' => 'Leave blank for no authentication',

View File

@ -181,6 +181,8 @@ $sm_lang = array(
'email_smtp' => 'Habilitar SMTP', 'email_smtp' => 'Habilitar SMTP',
'email_smtp_host' => 'SMTP host', 'email_smtp_host' => 'SMTP host',
'email_smtp_port' => 'SMTP port', 'email_smtp_port' => 'SMTP port',
'email_smtp_security' => 'SMTP security',
'email_smtp_security_none' => 'None',
'email_smtp_username' => 'SMTP username', 'email_smtp_username' => 'SMTP username',
'email_smtp_password' => 'SMTP contraseña', 'email_smtp_password' => 'SMTP contraseña',
'email_smtp_noauth' => 'Deja en blanco para ninguna autenticación', 'email_smtp_noauth' => 'Deja en blanco para ninguna autenticación',

View File

@ -181,6 +181,8 @@ $sm_lang = array(
'email_smtp' => 'Utiliser un serveur SMTP', 'email_smtp' => 'Utiliser un serveur SMTP',
'email_smtp_host' => 'Adresse serveur SMTP', 'email_smtp_host' => 'Adresse serveur SMTP',
'email_smtp_port' => 'Port SMTP', 'email_smtp_port' => 'Port SMTP',
'email_smtp_security' => 'SMTP security',
'email_smtp_security_none' => 'None',
'email_smtp_username' => 'Nom utilisateur SMTP', 'email_smtp_username' => 'Nom utilisateur SMTP',
'email_smtp_password' => 'Mot de passe SMTP', 'email_smtp_password' => 'Mot de passe SMTP',
'email_smtp_noauth' => 'Laisser vide si pas d\'authentication', 'email_smtp_noauth' => 'Laisser vide si pas d\'authentication',

View File

@ -180,6 +180,8 @@ $sm_lang = array(
'email_smtp' => 'Enable SMTP', 'email_smtp' => 'Enable SMTP',
'email_smtp_host' => 'SMTP host', 'email_smtp_host' => 'SMTP host',
'email_smtp_port' => 'SMTP port', 'email_smtp_port' => 'SMTP port',
'email_smtp_security' => 'SMTP security',
'email_smtp_security_none' => 'None',
'email_smtp_username' => 'SMTP username', 'email_smtp_username' => 'SMTP username',
'email_smtp_password' => 'SMTP password', 'email_smtp_password' => 'SMTP password',
'email_smtp_noauth' => 'Leave blank for no authentication', 'email_smtp_noauth' => 'Leave blank for no authentication',

View File

@ -180,6 +180,8 @@ $sm_lang = array(
'email_smtp' => 'Enable SMTP', 'email_smtp' => 'Enable SMTP',
'email_smtp_host' => 'SMTP host', 'email_smtp_host' => 'SMTP host',
'email_smtp_port' => 'SMTP port', 'email_smtp_port' => 'SMTP port',
'email_smtp_security' => 'SMTP security',
'email_smtp_security_none' => 'None',
'email_smtp_username' => 'SMTP username', 'email_smtp_username' => 'SMTP username',
'email_smtp_password' => 'SMTP password', 'email_smtp_password' => 'SMTP password',
'email_smtp_noauth' => 'Leave blank for no authentication', 'email_smtp_noauth' => 'Leave blank for no authentication',

View File

@ -180,6 +180,8 @@ $sm_lang = array(
'email_smtp' => 'SMTP gebruiken', 'email_smtp' => 'SMTP gebruiken',
'email_smtp_host' => 'SMTP host', 'email_smtp_host' => 'SMTP host',
'email_smtp_port' => 'SMTP poort', 'email_smtp_port' => 'SMTP poort',
'email_smtp_security' => 'SMTP beveiliging',
'email_smtp_security_none' => 'Geen',
'email_smtp_username' => 'SMTP gebruikersnaam', 'email_smtp_username' => 'SMTP gebruikersnaam',
'email_smtp_password' => 'SMTP wachtwoord', 'email_smtp_password' => 'SMTP wachtwoord',
'email_smtp_noauth' => 'Laat leeg voor geen authenticatie', 'email_smtp_noauth' => 'Laat leeg voor geen authenticatie',

View File

@ -180,6 +180,8 @@ $sm_lang = array(
'email_smtp' => 'Włącz SMTP', 'email_smtp' => 'Włącz SMTP',
'email_smtp_host' => 'SMTP host', 'email_smtp_host' => 'SMTP host',
'email_smtp_port' => 'SMTP port', 'email_smtp_port' => 'SMTP port',
'email_smtp_security' => 'SMTP security',
'email_smtp_security_none' => 'None',
'email_smtp_username' => 'SMTP login', 'email_smtp_username' => 'SMTP login',
'email_smtp_password' => 'SMTP hasło', 'email_smtp_password' => 'SMTP hasło',
'email_smtp_noauth' => 'Pozostaw puste dla braku autentykacji', 'email_smtp_noauth' => 'Pozostaw puste dla braku autentykacji',

View File

@ -180,6 +180,8 @@ $sm_lang = array(
'email_smtp' => 'Enable SMTP', 'email_smtp' => 'Enable SMTP',
'email_smtp_host' => 'SMTP host', 'email_smtp_host' => 'SMTP host',
'email_smtp_port' => 'SMTP port', 'email_smtp_port' => 'SMTP port',
'email_smtp_security' => 'SMTP security',
'email_smtp_security_none' => 'None',
'email_smtp_username' => 'SMTP username', 'email_smtp_username' => 'SMTP username',
'email_smtp_password' => 'SMTP password', 'email_smtp_password' => 'SMTP password',
'email_smtp_noauth' => 'Deixe em branco para nenhuma autenticação', 'email_smtp_noauth' => 'Deixe em branco para nenhuma autenticação',

View File

@ -180,6 +180,8 @@ $sm_lang = array(
'email_smtp' => 'Включить SMTP', 'email_smtp' => 'Включить SMTP',
'email_smtp_host' => 'SMTP сервер', 'email_smtp_host' => 'SMTP сервер',
'email_smtp_port' => 'SMTP порт', 'email_smtp_port' => 'SMTP порт',
'email_smtp_security' => 'SMTP security',
'email_smtp_security_none' => 'None',
'email_smtp_username' => 'SMTP пользователь', 'email_smtp_username' => 'SMTP пользователь',
'email_smtp_password' => 'SMTP пароль', 'email_smtp_password' => 'SMTP пароль',
'email_smtp_noauth' => 'Оставить пустым, если без аутентификации', 'email_smtp_noauth' => 'Оставить пустым, если без аутентификации',

View File

@ -180,6 +180,8 @@ $sm_lang = array(
'email_smtp' => 'SMTP\'yi aktif et', 'email_smtp' => 'SMTP\'yi aktif et',
'email_smtp_host' => 'SMTP sunucusu', 'email_smtp_host' => 'SMTP sunucusu',
'email_smtp_port' => 'SMTP port', 'email_smtp_port' => 'SMTP port',
'email_smtp_security' => 'SMTP security',
'email_smtp_security_none' => 'None',
'email_smtp_username' => 'SMTP kullanıcı adı', 'email_smtp_username' => 'SMTP kullanıcı adı',
'email_smtp_password' => 'SMTP şifre', 'email_smtp_password' => 'SMTP şifre',
'email_smtp_noauth' => 'Doğrulama yapmamak için boş bırakın', 'email_smtp_noauth' => 'Doğrulama yapmamak için boş bırakın',

View File

@ -180,6 +180,8 @@ $sm_lang = array(
'email_smtp' => '使用SMTP发送', 'email_smtp' => '使用SMTP发送',
'email_smtp_host' => 'SMTP主机', 'email_smtp_host' => 'SMTP主机',
'email_smtp_port' => 'SMTP端口', 'email_smtp_port' => 'SMTP端口',
'email_smtp_security' => 'SMTP security',
'email_smtp_security_none' => 'None',
'email_smtp_username' => 'SMTP用户名', 'email_smtp_username' => 'SMTP用户名',
'email_smtp_password' => 'SMTP密码', 'email_smtp_password' => 'SMTP密码',
'email_smtp_noauth' => '留空为无验证', 'email_smtp_noauth' => '留空为无验证',

View File

@ -109,8 +109,11 @@ class ConfigController extends AbstractController {
); );
} }
// @todo these selected values can easily be rewritten in the template using twig
$tpl_data['sms_selected_' . $config['sms_gateway']] = 'selected="selected"'; $tpl_data['sms_selected_' . $config['sms_gateway']] = 'selected="selected"';
$tpl_data['alert_type_selected_' . $config['alert_type']] = 'selected="selected"'; $tpl_data['alert_type_selected_' . $config['alert_type']] = 'selected="selected"';
$smtp_sec = isset($config['email_smtp_security']) ? $config['email_smtp_security'] : '';
$tpl_data['email_smtp_security_selected_' . $smtp_sec] = 'selected="selected"';
$tpl_data['auto_refresh_servers'] = (isset($config['auto_refresh_servers'])) ? $config['auto_refresh_servers'] : '0'; $tpl_data['auto_refresh_servers'] = (isset($config['auto_refresh_servers'])) ? $config['auto_refresh_servers'] : '0';
$tpl_data['log_retention_period'] = (isset($config['log_retention_period'])) ? $config['log_retention_period'] : '365'; $tpl_data['log_retention_period'] = (isset($config['log_retention_period'])) ? $config['log_retention_period'] : '365';
@ -149,6 +152,10 @@ class ConfigController extends AbstractController {
'language' => $_POST['language'], 'language' => $_POST['language'],
'sms_gateway' => $_POST['sms_gateway'], 'sms_gateway' => $_POST['sms_gateway'],
'alert_type' => $_POST['alert_type'], 'alert_type' => $_POST['alert_type'],
'email_smtp_security' =>
in_array($_POST['email_smtp_security'], array('', 'ssl', 'tls'))
? $_POST['email_smtp_security']
: '',
'auto_refresh_servers' => intval(psm_POST('auto_refresh_servers', 0)), 'auto_refresh_servers' => intval(psm_POST('auto_refresh_servers', 0)),
'log_retention_period' => intval(psm_POST('log_retention_period', 365)), 'log_retention_period' => intval(psm_POST('log_retention_period', 365)),
); );
@ -292,6 +299,8 @@ class ConfigController extends AbstractController {
'label_email_smtp' => psm_get_lang('config', 'email_smtp'), 'label_email_smtp' => psm_get_lang('config', 'email_smtp'),
'label_email_smtp_host' => psm_get_lang('config', 'email_smtp_host'), 'label_email_smtp_host' => psm_get_lang('config', 'email_smtp_host'),
'label_email_smtp_port' => psm_get_lang('config', 'email_smtp_port'), 'label_email_smtp_port' => psm_get_lang('config', 'email_smtp_port'),
'label_email_smtp_security' => psm_get_lang('config', 'email_smtp_security'),
'label_email_smtp_security_none' => psm_get_lang('config', 'email_smtp_security_none'),
'label_email_smtp_username' => psm_get_lang('config', 'email_smtp_username'), 'label_email_smtp_username' => psm_get_lang('config', 'email_smtp_username'),
'label_email_smtp_password' => psm_get_lang('config', 'email_smtp_password'), 'label_email_smtp_password' => psm_get_lang('config', 'email_smtp_password'),
'label_email_smtp_noauth' => psm_get_lang('config', 'email_smtp_noauth'), 'label_email_smtp_noauth' => psm_get_lang('config', 'email_smtp_noauth'),

View File

@ -136,6 +136,7 @@ class Installer {
('email_smtp', ''), ('email_smtp', ''),
('email_smtp_host', ''), ('email_smtp_host', ''),
('email_smtp_port', ''), ('email_smtp_port', ''),
('email_smtp_security', ''),
('email_smtp_username', ''), ('email_smtp_username', ''),
('email_smtp_password', ''), ('email_smtp_password', ''),
('sms_status', '0'), ('sms_status', '0'),

View File

@ -100,6 +100,16 @@
<input type="text" class="input-small" id="email_smtp_port" name="email_smtp_port" value="{{ email_smtp_port }}" maxlength="10" placeholder="{{ label_email_smtp_port }}" /> <input type="text" class="input-small" id="email_smtp_port" name="email_smtp_port" value="{{ email_smtp_port }}" maxlength="10" placeholder="{{ label_email_smtp_port }}" />
</div> </div>
</div> </div>
<div class="control-group">
<label class="control-label" for="email_smtp_security">{{ label_email_smtp_security }}</label>
<div class="controls">
<select id="email_smtp_security" name="email_smtp_security">
<option value="" {{ email_smtp_security_selected_|raw }}>{{ label_email_smtp_security_none }}</option>
<option value="ssl" {{ email_smtp_security_selected_ssl|raw }}>SSL</option>
<option value="tls" {{ email_smtp_security_selected_tls|raw }}>TLS</option>
</select>
</div>
</div>
<div class="control-group"> <div class="control-group">
<label class="control-label" for="email_smtp_username">{{ label_email_smtp_username }}</label> <label class="control-label" for="email_smtp_username">{{ label_email_smtp_username }}</label>
<div class="controls"> <div class="controls">