1 |
facd2d76
|
Scott Ullrich
|
<?php
|
2 |
|
|
/* $Id$ */
|
3 |
|
|
/*
|
4 |
|
|
system_advanced_notifications.php
|
5 |
|
|
part of pfSense
|
6 |
|
|
Copyright (C) 2009 Scott Ullrich <sullrich@gmail.com>
|
7 |
|
|
|
8 |
|
|
Redistribution and use in source and binary forms, with or without
|
9 |
|
|
modification, are permitted provided that the following conditions are met:
|
10 |
|
|
|
11 |
|
|
1. Redistributions of source code must retain the above copyright notice,
|
12 |
|
|
this list of conditions and the following disclaimer.
|
13 |
|
|
|
14 |
|
|
2. Redistributions in binary form must reproduce the above copyright
|
15 |
|
|
notice, this list of conditions and the following disclaimer in the
|
16 |
|
|
documentation and/or other materials provided with the distribution.
|
17 |
|
|
|
18 |
|
|
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
19 |
|
|
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
20 |
|
|
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
21 |
|
|
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
22 |
|
|
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
23 |
|
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
24 |
|
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
25 |
|
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
26 |
|
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
27 |
|
|
POSSIBILITY OF SUCH DAMAGE.
|
28 |
|
|
*/
|
29 |
1d333258
|
Scott Ullrich
|
/*
|
30 |
|
|
pfSense_MODULE: system
|
31 |
|
|
*/
|
32 |
facd2d76
|
Scott Ullrich
|
|
33 |
|
|
##|+PRIV
|
34 |
|
|
##|*IDENT=page-system-advanced-notifications
|
35 |
|
|
##|*NAME=System: Advanced: Tunables page
|
36 |
|
|
##|*DESCR=Allow access to the 'System: Advanced: Tunables' page.
|
37 |
|
|
##|*MATCH=system_advanced-sysctrl.php*
|
38 |
|
|
##|-PRIV
|
39 |
|
|
|
40 |
|
|
require("guiconfig.inc");
|
41 |
f804b689
|
Scott Ullrich
|
require("notices.inc");
|
42 |
facd2d76
|
Scott Ullrich
|
|
43 |
b19369b7
|
Scott Ullrich
|
// Growl
|
44 |
66184513
|
Scott Ullrich
|
if($config['notifications']['growl']['password'])
|
45 |
|
|
$pconfig['password'] = $config['notifications']['growl']['password'];
|
46 |
|
|
if($config['notifications']['growl']['ipaddress'])
|
47 |
|
|
$pconfig['ipaddress'] = $config['notifications']['growl']['ipaddress'];
|
48 |
d9252b1f
|
Scott Ullrich
|
|
49 |
b19369b7
|
Scott Ullrich
|
// SMTP
|
50 |
4090c90f
|
Scott Ullrich
|
if($config['notifications']['smtp']['ipaddress'])
|
51 |
|
|
$pconfig['smtpipaddress'] = $config['notifications']['smtp']['ipaddress'];
|
52 |
b19369b7
|
Scott Ullrich
|
if($config['notifications']['smtp']['notifyemailaddress'])
|
53 |
|
|
$pconfig['smtpnotifyemailaddress'] = $config['notifications']['smtp']['notifyemailaddress'];
|
54 |
72306d5a
|
Scott Ullrich
|
if($config['notifications']['smtp']['username'])
|
55 |
|
|
$pconfig['smtpusername'] = $config['notifications']['smtp']['username'];
|
56 |
|
|
if($config['notifications']['smtp']['password'])
|
57 |
|
|
$pconfig['smtppassword'] = $config['notifications']['smtp']['password'];
|
58 |
|
|
if($config['notifications']['smtp']['fromaddress'])
|
59 |
|
|
$pconfig['smtpfromaddress'] = $config['notifications']['smtp']['fromaddress'];
|
60 |
b19369b7
|
Scott Ullrich
|
|
61 |
facd2d76
|
Scott Ullrich
|
if ($_POST) {
|
62 |
|
|
|
63 |
|
|
unset($input_errors);
|
64 |
|
|
$pconfig = $_POST;
|
65 |
|
|
|
66 |
|
|
/* if this is an AJAX caller then handle via JSON */
|
67 |
|
|
if (isAjax() && is_array($input_errors)) {
|
68 |
|
|
input_errors2Ajax($input_errors);
|
69 |
|
|
exit;
|
70 |
|
|
}
|
71 |
|
|
|
72 |
|
|
if ($_POST['apply']) {
|
73 |
|
|
$retval = 0;
|
74 |
|
|
system_setup_sysctl();
|
75 |
|
|
$savemsg = get_std_save_message($retval);
|
76 |
|
|
}
|
77 |
|
|
|
78 |
|
|
if ($_POST['Submit'] == "Save") {
|
79 |
|
|
$tunableent = array();
|
80 |
|
|
|
81 |
b19369b7
|
Scott Ullrich
|
// Growl
|
82 |
1afa87e5
|
Scott Ullrich
|
$config['notifications']['growl']['ipaddress'] = $_POST['ipaddress'];
|
83 |
|
|
$config['notifications']['growl']['password'] = $_POST['password'];
|
84 |
facd2d76
|
Scott Ullrich
|
|
85 |
b19369b7
|
Scott Ullrich
|
// SMTP
|
86 |
|
|
$config['notifications']['smtp']['ipaddress'] = $_POST['smtpipaddress'];
|
87 |
|
|
$config['notifications']['smtp']['notifyemailaddress'] = $_POST['smtpnotifyemailaddress'];
|
88 |
72306d5a
|
Scott Ullrich
|
$config['notifications']['smtp']['username'] = $_POST['smtpusername'];
|
89 |
|
|
$config['notifications']['smtp']['password'] = $_POST['smtppassword'];
|
90 |
|
|
$config['notifications']['smtp']['fromaddress'] = $_POST['smtpfromaddress'];
|
91 |
b19369b7
|
Scott Ullrich
|
|
92 |
facd2d76
|
Scott Ullrich
|
write_config();
|
93 |
|
|
|
94 |
b19369b7
|
Scott Ullrich
|
// Send test message via growl
|
95 |
72306d5a
|
Scott Ullrich
|
if($config['notifications']['growl']['ipaddress'] &&
|
96 |
|
|
$config['notifications']['growl']['password'] = $_POST['password']) {
|
97 |
|
|
register_via_growl();
|
98 |
|
|
notify_via_growl("This is a test message form pfSense. It is safe to ignore this message.");
|
99 |
|
|
}
|
100 |
b19369b7
|
Scott Ullrich
|
|
101 |
|
|
// Send test message via smtp
|
102 |
8b0d920e
|
Scott Ullrich
|
if(file_exists("/var/db/notices_lastmsg.txt"))
|
103 |
|
|
unlink("/var/db/notices_lastmsg.txt");
|
104 |
f9fb2569
|
Scott Ullrich
|
$savemsg = notify_via_smtp("This is a test message form pfSense. It is safe to ignore this message.");
|
105 |
b19369b7
|
Scott Ullrich
|
|
106 |
facd2d76
|
Scott Ullrich
|
pfSenseHeader("system_advanced_notifications.php");
|
107 |
|
|
exit;
|
108 |
|
|
}
|
109 |
|
|
}
|
110 |
|
|
|
111 |
|
|
$pgtitle = array("System","Advanced: Notifications");
|
112 |
|
|
include("head.inc");
|
113 |
|
|
|
114 |
|
|
?>
|
115 |
|
|
|
116 |
|
|
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
|
117 |
|
|
<?php include("fbegin.inc"); ?>
|
118 |
|
|
<form action="system_advanced_notifications.php" method="post">
|
119 |
|
|
<?php
|
120 |
|
|
if ($input_errors)
|
121 |
|
|
print_input_errors($input_errors);
|
122 |
|
|
if ($savemsg)
|
123 |
|
|
print_info_box($savemsg);
|
124 |
|
|
?>
|
125 |
|
|
</form>
|
126 |
|
|
<table width="100%" border="0" cellpadding="0" cellspacing="0">
|
127 |
|
|
<tr>
|
128 |
|
|
<td>
|
129 |
|
|
<?php
|
130 |
|
|
$tab_array = array();
|
131 |
|
|
$tab_array[] = array("Admin Access", false, "system_advanced_admin.php");
|
132 |
|
|
$tab_array[] = array("Firewall / NAT", false, "system_advanced_firewall.php");
|
133 |
|
|
$tab_array[] = array("Networking", false, "system_advanced_network.php");
|
134 |
9308e4c1
|
Scott Ullrich
|
$tab_array[] = array("Miscellaneous", false, "system_advanced_misc.php");
|
135 |
facd2d76
|
Scott Ullrich
|
$tab_array[] = array("System Tunables", false, "system_advanced_sysctl.php");
|
136 |
|
|
$tab_array[] = array("Notifications", true, "system_advanced_notifications.php");
|
137 |
|
|
display_top_tabs($tab_array);
|
138 |
|
|
?>
|
139 |
|
|
</td>
|
140 |
|
|
</tr>
|
141 |
|
|
<tr>
|
142 |
|
|
<td id="mainarea">
|
143 |
|
|
<div class="tabcont">
|
144 |
|
|
<form action="system_advanced_notifications.php" method="post" name="iform">
|
145 |
|
|
<table width="100%" border="0" cellpadding="6" cellspacing="0">
|
146 |
b19369b7
|
Scott Ullrich
|
<!-- GROWL -->
|
147 |
facd2d76
|
Scott Ullrich
|
<tr>
|
148 |
|
|
<td colspan="2" valign="top" class="listtopic">Growl</td>
|
149 |
|
|
</tr>
|
150 |
|
|
<tr>
|
151 |
|
|
<td width="22%" valign="top" class="vncell">IP Address</td>
|
152 |
|
|
<td width="78%" class="vtable">
|
153 |
d0e705e1
|
Scott Ullrich
|
<input name='ipaddress' value='<?php echo $pconfig['ipaddress']; ?>'><br/>
|
154 |
facd2d76
|
Scott Ullrich
|
This is the IP address that you would like to send growl notifications to.
|
155 |
|
|
</td>
|
156 |
|
|
</tr>
|
157 |
|
|
<tr>
|
158 |
|
|
<td width="22%" valign="top" class="vncell">Password</td>
|
159 |
|
|
<td width="78%" class="vtable">
|
160 |
d0e705e1
|
Scott Ullrich
|
<input name='password' type='password' value='<?php echo $pconfig['password']; ?>'><br/>
|
161 |
facd2d76
|
Scott Ullrich
|
Enter the password of the remote growl notification device.
|
162 |
|
|
</td>
|
163 |
|
|
</tr>
|
164 |
7d8c8a28
|
Scott Ullrich
|
<tr>
|
165 |
|
|
<td colspan="2" class="list" height="12"> </td>
|
166 |
|
|
</tr>
|
167 |
b19369b7
|
Scott Ullrich
|
<!-- SMTP -->
|
168 |
|
|
<tr>
|
169 |
|
|
<td colspan="2" valign="top" class="listtopic">SMTP E-Mail</td>
|
170 |
|
|
</tr>
|
171 |
|
|
<tr>
|
172 |
|
|
<td width="22%" valign="top" class="vncell">IP Address of E-Mail server</td>
|
173 |
|
|
<td width="78%" class="vtable">
|
174 |
|
|
<input name='smtpipaddress' value='<?php echo $pconfig['smtpipaddress']; ?>'><br/>
|
175 |
b9ab1f26
|
Scott Ullrich
|
This is the IP address of the SMTP E-Mail server that will be used to send notifications to.
|
176 |
b19369b7
|
Scott Ullrich
|
</td>
|
177 |
|
|
</tr>
|
178 |
72306d5a
|
Scott Ullrich
|
<tr>
|
179 |
|
|
<td width="22%" valign="top" class="vncell">From e-mail address</td>
|
180 |
|
|
<td width="78%" class="vtable">
|
181 |
|
|
<input name='smtpfromaddress' type='input' value='<?php echo $pconfig['smtpfromaddress']; ?>'><br/>
|
182 |
|
|
This is the e-mail address that will appear in the from field.
|
183 |
|
|
</td>
|
184 |
|
|
</tr>
|
185 |
b19369b7
|
Scott Ullrich
|
<tr>
|
186 |
|
|
<td width="22%" valign="top" class="vncell">Notification E-Mail address</td>
|
187 |
|
|
<td width="78%" class="vtable">
|
188 |
|
|
<input name='smtpnotifyemailaddress' type='input' value='<?php echo $pconfig['smtpnotifyemailaddress']; ?>'><br/>
|
189 |
|
|
Enter the e-mail address that you would like email notifications sent to.
|
190 |
|
|
</td>
|
191 |
|
|
</tr>
|
192 |
72306d5a
|
Scott Ullrich
|
<tr>
|
193 |
|
|
<td width="22%" valign="top" class="vncell">Notification E-Mail auth username (optional)</td>
|
194 |
|
|
<td width="78%" class="vtable">
|
195 |
|
|
<input name='smtpusername' type='input' value='<?php echo $pconfig['smtpusername']; ?>'><br/>
|
196 |
|
|
Enter the e-mail address username for SMTP authentication.
|
197 |
|
|
</td>
|
198 |
|
|
</tr>
|
199 |
|
|
<tr>
|
200 |
|
|
<td width="22%" valign="top" class="vncell">Notification E-Mail auth password</td>
|
201 |
|
|
<td width="78%" class="vtable">
|
202 |
|
|
<input name='smtppassword' type='password' value='<?php echo $pconfig['smtppassword']; ?>'><br/>
|
203 |
|
|
Enter the e-mail address password for SMTP authentication.
|
204 |
|
|
</td>
|
205 |
|
|
</tr>
|
206 |
facd2d76
|
Scott Ullrich
|
<tr>
|
207 |
|
|
<td valign="top" class="">
|
208 |
|
|
|
209 |
|
|
</td>
|
210 |
|
|
<td>
|
211 |
|
|
<br/>
|
212 |
d9252b1f
|
Scott Ullrich
|
<input type='submit' id='Submit' name='Submit' value='Save'></form>
|
213 |
facd2d76
|
Scott Ullrich
|
</td>
|
214 |
|
|
</tr>
|
215 |
|
|
</table>
|
216 |
|
|
</div>
|
217 |
|
|
</td>
|
218 |
|
|
</tr>
|
219 |
|
|
</table>
|
220 |
|
|
<?php include("fend.inc"); ?>
|
221 |
|
|
</body>
|
222 |
|
|
</html>
|