Project

General

Profile

« Previous | Next » 

Revision 7da466e1

Added by Jim Pingle over 6 years ago

Add checkbox to disable SMTP SSL cert verification. Implements #9001

The default action is to validate the certificate. If the user knows the
server does not have a valid certificate (e.g. self-signed), this option
will allow encryption to be used without validating the identity of the
server.

View differences:

src/etc/inc/notices.inc
396 396
		'persist' => false
397 397
	);
398 398

  
399
	if ($config['notifications']['smtp']['sslvalidate'] == "disabled") {
400
		$params['socket_options'] = array('ssl' => array('verify_peer_name' => false));
401
	}
402

  
399 403
	if ($config['notifications']['smtp']['fromaddress']) {
400 404
		$from = $config['notifications']['smtp']['fromaddress'];
401 405
	} else {
src/usr/local/www/system_advanced_notifications.php
30 30
require_once("notices.inc");
31 31
require_once("pfsense-utils.inc");
32 32

  
33
$pconfig = array();
34
init_config_arr(array('notifications', 'smtp'));
35
init_config_arr(array('notifications', 'growl'));
36

  
33 37
// Growl
34 38
$pconfig['disable_growl'] = isset($config['notifications']['growl']['disable']);
35 39
if ($config['notifications']['growl']['password']) {
......
63 67
if (isset($config['notifications']['smtp']['ssl'])) {
64 68
	$pconfig['smtpssl'] = true;
65 69
}
70
$pconfig['sslvalidate'] = ($config['notifications']['smtp']['sslvalidate'] != "disabled");
66 71
if (!empty($config['notifications']['smtp']['timeout'])) {
67 72
	$pconfig['smtptimeout'] = $config['notifications']['smtp']['timeout'];
68 73
}
......
124 129
			unset($config['notifications']['smtp']['ssl']);
125 130
		}
126 131

  
132
		if (isset($_POST['sslvalidate'])) {
133
			$config['notifications']['smtp']['sslvalidate'] = "enabled";
134
		} else {
135
			$config['notifications']['smtp']['sslvalidate'] = "disabled";
136
		}
137

  
127 138
		$config['notifications']['smtp']['timeout'] = $_POST['smtptimeout'];
128 139
		$config['notifications']['smtp']['notifyemailaddress'] = $_POST['smtpnotifyemailaddress'];
129 140
		$config['notifications']['smtp']['username'] = $_POST['smtpusername'];
......
261 272

  
262 273
$section->add($group);
263 274

  
275
$section->addInput(new Form_Checkbox(
276
	'sslvalidate',
277
	'Validate SSL/TLS',
278
	'Validate the SSL/TLS certificate presented by the server',
279
	$pconfig['sslvalidate']
280
))->setHelp('When disabled, the server certificate will not be validated. ' .
281
	'Encryption will still be used if available, but the identity of the server will not be confirmed.');
282

  
264 283
$section->addInput(new Form_Input(
265 284
	'smtpfromaddress',
266 285
	'From e-mail address',

Also available in: Unified diff