summaryrefslogtreecommitdiffstats
path: root/usr/local/www/services_unbound_advanced.php
blob: d0aece9d547e7f92925e22ca516bbba30ca7789f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
<?php
/* $Id$ */
/*
	services_unbound_advanced.php
	part of the pfSense project (http://www.pfsense.com)
	Copyright (C) 2011	Warren Baker (warren@pfsense.org)
	All rights reserved.

    Redistribution and use in source and binary forms, with or without
    modification, are permitted provided that the following conditions are met:

    1. Redistributions of source code must retain the above copyright notice,
       this list of conditions and the following disclaimer.

    2. Redistributions in binary form must reproduce the above copyright
       notice, this list of conditions and the following disclaimer in the
       documentation and/or other materials provided with the distribution.

    THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
    INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
    AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
    AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
    OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
    SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
    INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
    CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
    ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
    POSSIBILITY OF SUCH DAMAGE.
*/
/*
	pfSense_MODULE:	dnscache
*/

##|+PRIV
##|*IDENT=page-services-unbound
##|*NAME=Services: Unbound DNS page
##|*DESCR=Allow access to the 'Services: Unbound DNS' page.
##|*MATCH=services_unbound.php*
##|-PRIV

require_once("guiconfig.inc");
require_once("unbound.inc");

if (!is_array($config['unbound']['hosts']))
	$config['unbound']['hosts'] = array();

if (!is_array($config['unbound']['domainoverrides']))
	$config['unbound']['domainoverrides'] = array();

if ($_POST) {

	unset($input_errors);

	$config['unbound']['enable'] = ($_POST['enable']) ? true : false;
	$config['unbound']['custom_options'] = str_replace("\r\n", "\n", $_POST['custom_options']);

	if (!$input_errors) {
		write_config("Unbound DNS configured.");

		$retval = 0;
		$retval = services_unbound_configure();
		$savemsg = get_std_save_message($retval);

		// Relaod filter (we might need to sync to CARP hosts)
		filter_configure();
	}
} else {
	$pconfig = array();
	$pconfig['websec'] = $settings['websec'];
	$pconfig['active_interface'] = $settings['active_interface'];
	$pconfig['allow_interface'] = $settings['allow_interface'];
	$pconfig['sslscan'] = $settings['sslscan'];
	$pconfig['admin_email'] = $settings['admin_email'];
	$pconfig['caref'] = $settings['caref'];
	$pconfig['certref'] = $settings['certref'];
	$pconfig['crlref'] = $settings['crlref'];
	$pconfig['fwalias'] = $settings['fwalias'];
	$pconfig['auth_prompt'] = $settings['auth_prompt'];
	$pconfig['auth_ttl'] = $settings['auth_ttl'];
}

$pgtitle = array(gettext("Services"),gettext("Unbound DNS"));
include_once("head.inc");

?>

<script language="JavaScript">
<!--
function enable_change(enable_over) {
	var endis;
	endis = !(document.iform.enable.checked || enable_over);
	document.iform.regdhcp.disabled = endis;
	document.iform.regdhcpstatic.disabled = endis;
	document.iform.dhcpfirst.disabled = endis;
}
function show_advanced_dns() {
	document.getElementById("showadvbox").innerHTML='';
	aodiv = document.getElementById('showadv');
	aodiv.style.display = "block";
}
//-->
</script>
	
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
<?php include("fbegin.inc"); ?>
<form action="services_dnsmasq.php" method="post" name="iform" id="iform">
<?php if ($input_errors) print_input_errors($input_errors); ?>
<?php if ($savemsg) print_info_box($savemsg); ?>
<?php if (is_subsystem_dirty('hosts')): ?><p>
<?php print_info_box_np(gettext("The configuration for Unbound DNS, has been changed") . ".<br>" . gettext("You must apply the changes in order for them to take effect."));?><br>
<?php endif; ?>
<table width="100%" border="0" cellpadding="6" cellspacing="0">
  <tr><td class="tabnavtbl">
<?php
	$tab_array = array();
	$tab_array[] = array(gettext("General settings"), true, "services_unbound.php");
	$tab_array[] = array(gettext("Advanced settings"), false, "services_unbound_advanced.php");
	display_top_tabs($tab_array, true);
?>
</td></tr>
</table>
<div id="mainarea">
<table width="100%" border="0" cellpadding="6" cellspacing="0">
	<tr>
		<td colspan="2" valign="top" class="listtopic"><?=gettext("General Unbound DNS Options");?></td>
	</tr>
	<tr>
		<td width="22%" valign="top" class="vncellreq"><?=gettext("Enable");?></td>
		<td width="78%" class="vtable"><p>
			<input name="enable" type="checkbox" id="enable" value="yes" <?php if ($pconfig['enable'] == "yes") echo "checked";?> onClick="enable_change(false)">
			<strong><?=gettext("Enable Unbound DNS");?><br>
			</strong></p></td>
	</tr>
	<tr>
		<td width="22%" valign="top" class="vncellreq"><?=gettext("Network interfaces");?></td>
		<td width="78%" class="vtable">
			<select name="active_interface[]" id="active_interface" multiple="true" size="3">
			<?php $iflist = get_configured_interface_with_descr();
				$active_iface = explode(",", $pconfig['active_interface']);
				$iflist['localhost'] = "Localhost";
				foreach ($iflist as $iface => $ifdescr) {
					echo "<option value='{$iface}' ";
					if (in_array($iface, $active_iface))
						echo "selected";
					echo ">{$ifdescr}</option>\n";
				}
			?>
			</select>
			<br/><span class="vexpl">
					<?=gettext("The Unbound DNS Server will listen on the selected interfaces. To add an interface click inside the interface box and select the interface from the drop down.");?> <br/>
				</span>
		</td>
	</tr>
	<tr>
		<td width="22%" valign="top" class="vncellreq"><?=gettext("Query interfaces");?></td>
		<td width="78%" class="vtable">
			<select name="query_interface[]" id="query_interface" multiple="true" size="3">
			<?php $iflist = get_configured_interface_with_descr();
				$active_iface = explode(",", $pconfig['query_interface']);
				$iflist['localhost'] = "Localhost";
				foreach ($iflist as $iface => $ifdescr) {
					echo "<option value='{$iface}' ";
					if (in_array($iface, $active_iface))
						echo "selected";
					echo ">{$ifdescr}</option>\n";
				}
			?>
			</select>
			<br/><span class="vexpl">
					<?=gettext("Utilize different network interface(s) that Unbound DNS server will use to send queries to authoritative servers and receive their replies.");?> <br/>
				</span>
		</td>
	</tr>
	<tr>
		<td width="22%" valign="top" class="vncellreq"><?=gettext("DNSSEC");?></td>
		<td width="78%" class="vtable"><p>
			<input name="dnssec" type="checkbox" id="enable" value="yes" <?php if ($pconfig['dnssec'] == "yes") echo "checked";?>/>
			<strong><?=gettext("Enable DNSSEC Support");?><br>
			</strong></p></td>
	</tr>
	<tr>
		<td width="22%" valign="top" class="vncellreq"><?=gettext("Forwarding");?></td>
		<td width="78%" class="vtable"><p>
			<input name="dnssec" type="checkbox" id="enable" value="yes" <?php if ($pconfig['dnssec'] == "yes") echo "checked";?>/>
			<strong><?=gettext("Enable Forwarding Mode");?><br>
			</strong></p></td>
	</tr>
	<tr>
		<td width="22%" valign="top" class="vncellreq"><?=gettext("Static DHCP");?></td>
		<td width="78%" class="vtable"><p>
			<input name="dnssec" type="checkbox" id="enable" value="yes" <?php if ($pconfig['dnssec'] == "yes") echo "checked";?>/>
			<strong><?=gettext("Enable Forwarding Mode");?><br>
			</strong></p></td>
	</tr>
	<tr>
		<td width="22%" valign="top" class="vncellreq"><?=gettext("Forwarding");?></td>
		<td width="78%" class="vtable"><p>
			<input name="dnssec" type="checkbox" id="enable" value="yes" <?php if ($pconfig['dnssec'] == "yes") echo "checked";?>/>
			<strong><?=gettext("Enable Forwarding Mode");?><br>
			</strong></p></td>
	</tr>	
<tr>
	<td width="22%" valign="top" class="vncell"><?=gettext("Allow access from selected network interface");?></td>
	<td width="78%" class="vtable">
		<input type="checkbox" name="allow_interface" id="allow_interface" class="formfld unknown" value="on" <?php if (isset($pconfig['allow_interface'])) echo "checked"; ?> />
	<br/><span class="vexpl">
		<?=gettext("If this field is enabled, the network connected to the interface selected in the 'Network interface' field will be allowed to use the proxy, therefore there will be no need to add the interface's subnet to the list of ");?>  <a href='web_settings_access.php'>Access Control Lists</a>. It will automatically be added. <br/>
	</span>
	</td>
</tr>
<tr>
	<td width="22%" valign="top" class="vncell"><?=gettext("Administrator email");?></td>
	<td width="78%" class="vtable">
		<input name="admin_email" id="admin_email" class="formfld unknown" size="60" value="<?php if ($pconfig['admin_email']) echo $pconfig['admin_email']; else echo "admin@localhost"; ?>" />
	<br/><span class="vexpl">
		<?=gettext("This is the email address displayed in error messages to the users.");?> <br/>
	</span>
	</td>
</tr>
<tr>
	<td colspan="2" class="listtopic">HTTPS MITM setttings<br></td>
</tr>
<tr class="on_off">
  <td width="30%" valign="top" class="vncellreq">HTTPS Scanning</td>
  <td width="70%" class="vtable">
    <input type="checkbox" id="on_off" name="sslscan"<?php if(isset($pconfig['sslscan'])) echo " CHECKED"; ?>/><br />
	Enable this to perform content scanning on HTTPS web traffic.
  </td>
</tr>
<tr>
	<td width="22%" valign="top" class="vncell"><?=gettext("Certificate Authority"); ?></td>
	<td width="78%" class="vtable">
		<div>
		<select id="caref" title="Select Certificate Authority" name="caref" size="5" style="width:150px;" class="chzn-select">
	<?php
	      if (is_array($config['ca']) && count($config['ca']) > 0):
			echo "<option value=''>None</option>\n";
			foreach ($config['ca'] as $ca):
				$selected = "";
				if ($pconfig['caref'] == $ca['refid'])
					$selected = "selected";
	?>
		<option value="<?=$ca['refid'];?>" <?=$selected;?>><?=$ca['descr'];?></option>
			<?php endforeach; ?>
		</select>
		</div>
	<?php else: ?>
		<b>No Certificate Authorities defined.</b> <br/>Create one under <a href="system_camanager.php">System &gt; Cert Manager</a>.
	<?php endif; ?>
	</td>
</tr>
<tr>
	<td width="22%" valign="top" class="vncell"><?=gettext("Certificate Revocation List"); ?></td>
	<td width="78%" class="vtable">
	<?php if (is_array($config['crl']) && count($config['crl']) > 0): ?>
		<select id="crlref" title="Select Certificate Revocation List" name="crlref" size="5" style="width:150px;" class="chzn-select">
		<option value="">None</option>
	<?php
		foreach ($config['crl'] as $crl):
			$selected = "";
			$caname = "";
			$ca = lookup_ca($crl['caref']);
			if ($ca) {
				$caname = " (CA: {$ca['descr']})";
				if ($pconfig['crlref'] == $crl['refid'])
					$selected = "selected";
			}
	?>
		<option value="<?=$crl['refid'];?>" <?=$selected;?>><?php echo "{$crl['descr']} {$caname}";?></option>
		<?php endforeach; ?>
		</select>
	<?php else: ?>
		<b>No Certificate Revocation Lists (CRLs) defined.</b> <br/>Create one under <a href="system_crlmanager.php">System &gt; Cert Manager</a>.
	<?php endif; ?>
	</td>
</tr>
<tr>
	<td width="22%" valign="top" class="vncell"><?=gettext("Server Certificate"); ?></td>
	<td width="78%" class="vtable">
	<?php if (is_array($config['cert']) && count($config['cert']) > 0): ?>
		<select id="certref" title="Select Server Certificate" name="certref" size="5" style="width:200px;" class="chzn-select">
	<?php
		foreach ($config['cert'] as $cert):
			$selected = "";
			$caname = "";
			$inuse = "";
			$revoked = "";
			$ca = lookup_ca($cert['caref']);
			if ($ca)
				$caname = " (CA: {$ca['descr']})";
			if ($pconfig['certref'] == $cert['refid'])
				$selected = "selected";
			if (cert_in_use($cert['refid']))
				$inuse = " *In Use";
			if (is_cert_revoked($cert))
				$revoked = " *Revoked";
	?>
		<option value="<?=$cert['refid'];?>" <?=$selected;?>><?php echo "{$cert['descr']} {$caname} {$inuse} {$revoked}";?></option>
		<?php endforeach; ?>
		</select>
	<?php else: ?>
		<b>No Certificates defined.</b> <br/>Create one under <a href="system_certmanager.php">System &gt; Cert Manager</a>.
	<?php endif; ?>
	</td>
</tr>
<tr>
	<td colspan="2" class="listtopic">Authentication Settings<br></td>
</tr>
<tr>
        <td width="22%" valign="top" class="vncell"><?=gettext("Authentication Server"); ?></td>
        <td width="78%" class="vtable">
			<div>
                <select name='auth_method[]' id='auth_method' multiple="true" data-placeholder="Select the Authentication types" size="3" style="width:150px;" class="chzn-select">
                <?php
                         $auth_servers = auth_get_authserver_list();
                         foreach ($auth_servers as $auth_server):
                                $selected = "";
                                if ($auth_server['name'] == $pconfig['auth_method'])
                                        $selected = "selected";
                                if (!isset($pconfig['auth_method']) && $auth_server['name'] == "none")
                                        $selected = "selected";

                ?>
                        <option value="<?=$auth_server['name'];?>" <?=$selected;?>><?=$auth_server['name'];?></option>
                        <?php   endforeach; ?>
                </select>
			</div>
        </td>
</tr>
<tr >
        <td width="22%" class="vncell">Authentication prompt</td>
        <td class="vtable">
                <input id="auth_prompt" name="auth_prompt" value="<?=$pconfig['auth_prompt'];?>" size="50" class="formfld unknown">
                <br/>
                This string will be displayed at the top of the authentication request window.
        </td>
</tr>
<tr valign="top">
        <td width="22%" class="vncell">Authentication TTL</td>
        <td class="vtable">
                <input id="auth_ttl" name="auth_ttl" value="<?=$pconfig['auth_ttl'];?>" class="formfld unknown">
                <br/>
                This specifies for how long (in minutes) the server assumes an externally validated username and password combination is valid (Time To Live). When the TTL expires, the user will be prompted f
or credentials again.
        </td>
</tr>
<tr>
	<td>&nbsp;</td>
</tr>
<tr>
	<td width="22%"></td>
	<td width="78%">
		<input type="submit" name="Save" class="formbtn" id="save" value="Save" />
	</td>
</tr>
</table>
</div>
</td></tr>
</table>
</form>
<?php include("fend.inc"); ?>
</body>
</html>
OpenPOWER on IntegriCloud