summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2004-12-05 19:31:44 +0000
committerScott Ullrich <sullrich@pfsense.org>2004-12-05 19:31:44 +0000
commit07bd3f83b401d8e9e9de3938e0a26c6e452660af (patch)
tree7f6913b347dc994dc57fa524f85a5436ff151f54
parent2ed803e736d9256aafae7a29ae0bb84aaf746c5f (diff)
downloadpfsense-07bd3f83b401d8e9e9de3938e0a26c6e452660af.zip
pfsense-07bd3f83b401d8e9e9de3938e0a26c6e452660af.tar.gz
Synchornize with m0n0wall 1.2b3. These files have not really been
modified too much so a straight copy works. 9 files remain to be patched by hand.
-rw-r--r--etc/inc/captiveportal.inc3
-rwxr-xr-xusr/local/captiveportal/index.php5
-rwxr-xr-xusr/local/www/diag_backup.php63
-rwxr-xr-xusr/local/www/firewall_rules.php239
-rwxr-xr-xusr/local/www/interfaces_wlan.inc4
-rwxr-xr-xusr/local/www/services_captiveportal.php126
-rwxr-xr-xusr/local/www/services_captiveportal_ip.php22
-rwxr-xr-xusr/local/www/services_captiveportal_mac.php14
-rwxr-xr-xusr/local/www/services_dhcp.php26
-rwxr-xr-xusr/local/www/services_dyndns.php146
-rwxr-xr-xusr/local/www/services_snmp.php14
-rwxr-xr-xusr/local/www/system.php7
12 files changed, 393 insertions, 276 deletions
diff --git a/etc/inc/captiveportal.inc b/etc/inc/captiveportal.inc
index d5d78b1..f12f1da 100644
--- a/etc/inc/captiveportal.inc
+++ b/etc/inc/captiveportal.inc
@@ -78,8 +78,9 @@ function captiveportal_configure() {
<body>
<h2>m0n0wall captive portal</h2>
<p>This is the default captive portal page. Please upload your own custom HTML file on the <em>Services: Captive portal</em> screen in the m0n0wall webGUI.</p>
-<form method="post" action="">
+<form method="post" action="\$PORTAL_ACTION\$">
<input name="accept" type="submit" value="Continue">
+ <input name="redirurl" type="hidden" value="\$PORTAL_REDIRURL\$">
</form>
</body>
</html>
diff --git a/usr/local/captiveportal/index.php b/usr/local/captiveportal/index.php
index af1e1bc..497e506 100755
--- a/usr/local/captiveportal/index.php
+++ b/usr/local/captiveportal/index.php
@@ -34,7 +34,6 @@ require("util.inc");
require("config.inc");
require("radius_authentication.inc") ;
require("radius_accounting.inc") ;
-require("portal_log.inc") ;
header("Expires: 0");
header("Cache-Control: no-store, no-cache, must-revalidate");
@@ -74,7 +73,6 @@ if ($clientmac && portal_mac_fixed($clientmac)) {
$radiusservers[0]['port'],
$radiusservers[0]['key']);
if ($auth_val == 2) {
- captiveportal_logportalauth($_POST['auth_user'],$clientmac,$clientip,TRUE);
$sessionid = portal_allow($clientip, $clientmac, $_POST['auth_user']);
if (isset($config['captiveportal']['radacct_enable']) && isset($radiusservers[0])) {
$auth_val = RADIUS_ACCOUNTING_START($_POST['auth_user'],
@@ -84,7 +82,6 @@ if ($clientmac && portal_mac_fixed($clientmac)) {
$radiusservers[0]['key']);
}
} else {
- captiveportal_logportalauth($_POST['auth_user'],$clientmac,$clientip,FALSE);
readfile("{$g['varetc_path']}/captiveportal-error.html");
}
} else {
@@ -122,7 +119,7 @@ EOD;
if (isset($config['captiveportal']['httpslogin']))
$htmltext = str_replace("\$PORTAL_ACTION\$", "https://{$config['captiveportal']['httpsname']}:8001/", $htmltext);
else
- $htmltext = str_replace("\$PORTAL_ACTION\$", "", $htmltext);
+ $htmltext = str_replace("\$PORTAL_ACTION\$", "http://{$config['interfaces'][$config['captiveportal']['interface']]['ipaddr']}:8000/", $htmltext);
if (preg_match("/redirurl=(.*)/", $orig_request, $matches))
$redirurl = urldecode($matches[1]);
diff --git a/usr/local/www/diag_backup.php b/usr/local/www/diag_backup.php
index b91cc6b..bc4d9d4 100755
--- a/usr/local/www/diag_backup.php
+++ b/usr/local/www/diag_backup.php
@@ -1,24 +1,22 @@
#!/usr/local/bin/php
-<?php
+<?php
/*
diag_backup.php
- Copyright (C) 2004 Scott Ullrich
- All rights reserved.
-
- originially part of m0n0wall (http://m0n0.ch/wall)
+ part of m0n0wall (http://m0n0.ch/wall)
+
Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
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
@@ -33,26 +31,26 @@
/* omit no-cache headers because it confuses IE with file downloads */
$omit_nocacheheaders = true;
-require("guiconfig.inc");
+require("guiconfig.inc");
if ($_POST) {
unset($input_errors);
-
+
if (stristr($_POST['Submit'], "Restore"))
$mode = "restore";
else if (stristr($_POST['Submit'], "Download"))
$mode = "download";
-
+
if ($mode) {
if ($mode == "download") {
config_lock();
-
- $fn = "config-" . $config['system']['hostname'] . "." .
+
+ $fn = "config-" . $config['system']['hostname'] . "." .
$config['system']['domain'] . "-" . date("YmdHis") . ".xml";
-
+
$fs = filesize($g['conf_path'] . "/config.xml");
- header("Content-Type: application/octet-stream");
+ header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename=$fn");
header("Content-Length: $fs");
readfile($g['conf_path'] . "/config.xml");
@@ -87,28 +85,28 @@ if ($_POST) {
<form action="diag_backup.php" method="post" enctype="multipart/form-data">
<?php if ($input_errors) print_input_errors($input_errors); ?>
<?php if ($savemsg) print_info_box($savemsg); ?>
- <table width="100%" border="0" cellspacing="0" cellpadding="0">
- <tr>
+ <table width="100%" border="0" cellspacing="0" cellpadding="6">
+ <tr>
<td colspan="2" class="listtopic">Backup configuration</td>
</tr>
- <tr>
- <td width="22%" valign="baseline">&nbsp;</td>
- <td width="78%" class="listn">
- <p> Click this button to download the system configuration
+ <tr>
+ <td width="22%" valign="baseline" class="vncell">&nbsp;</td>
+ <td width="78%" class="vtable">
+ <p> Click this button to download the system configuration
in XML format.<br>
<br>
- <input name="Submit" type="submit" class="formbtn" id="download" value="Download configuration">
- <br>
- &nbsp; <br>
- &nbsp; </p></td>
+ <input name="Submit" type="submit" class="formbtn" id="download" value="Download configuration"></td>
+ </tr>
+ <tr>
+ <td colspan="2" class="list" height="12"></td>
</tr>
- <tr>
+ <tr>
<td colspan="2" class="listtopic">Restore configuration</td>
</tr>
- <tr>
- <td width="22%" valign="baseline">&nbsp;</td>
- <td width="78%" class="listn">
- <p> Open a pfSense configuration XML file and click the button
+ <tr>
+ <td width="22%" valign="baseline" class="vncell">&nbsp;</td>
+ <td width="78%" class="vtable">
+ Open a m0n0wall configuration XML file and click the button
below to restore the configuration.<br>
<br>
<strong><span class="red">Note:</span></strong><br>
@@ -118,8 +116,7 @@ if ($_POST) {
<br>
<br>
<input name="Submit" type="submit" class="formbtn" id="restore" value="Restore configuration">
- </p>
- </td>
+ </td>
</tr>
</table>
</form>
diff --git a/usr/local/www/firewall_rules.php b/usr/local/www/firewall_rules.php
index 0659922..9e78e72 100755
--- a/usr/local/www/firewall_rules.php
+++ b/usr/local/www/firewall_rules.php
@@ -1,24 +1,22 @@
#!/usr/local/bin/php
-<?php
+<?php
/*
firewall_rules.php
- Copyright (C) 2004 Scott Ullrich
- All rights reserved.
-
- originally part of m0n0wall (http://m0n0.ch/wall)
+ part of m0n0wall (http://m0n0.ch/wall)
+
Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
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
@@ -39,6 +37,22 @@ if (!is_array($config['filter']['rule'])) {
filter_rules_sort();
$a_filter = &$config['filter']['rule'];
+$if = $_GET['if'];
+if ($_POST['if'])
+ $if = $_POST['if'];
+
+$iflist = array("lan" => "LAN", "wan" => "WAN");
+
+if ($config['pptpd']['mode'] == "server")
+ $iflist['pptp'] = "PPTP VPN";
+
+for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++) {
+ $iflist['opt' . $i] = $config['interfaces']['opt' . $i]['descr'];
+}
+
+if (!$if || !isset($iflist[$if]))
+ $if = "lan";
+
if ($_POST) {
$pconfig = $_POST;
@@ -60,40 +74,67 @@ if ($_POST) {
}
}
-if ($_GET['act'] == "del") {
- if ($a_filter[$_GET['id']]) {
- unset($a_filter[$_GET['id']]);
+if (isset($_POST['del_x'])) {
+ /* delete selected rules */
+ if (is_array($_POST['rule']) && count($_POST['rule'])) {
+ foreach ($_POST['rule'] as $rulei) {
+ unset($a_filter[$rulei]);
+ }
write_config();
touch($d_filterconfdirty_path);
- header("Location: firewall_rules.php");
+ header("Location: firewall_rules.php?if={$if}");
exit;
}
-} else if ($_GET['act'] == "down") {
- if ($a_filter[$_GET['id']] && $a_filter[$_GET['id']+1]) {
- $tmp = $a_filter[$_GET['id']+1];
- $a_filter[$_GET['id']+1] = $a_filter[$_GET['id']];
- $a_filter[$_GET['id']] = $tmp;
+} else if ($_GET['act'] == "toggle") {
+ if ($a_filter[$_GET['id']]) {
+ $a_filter[$_GET['id']]['disabled'] = !isset($a_filter[$_GET['id']]['disabled']);
write_config();
touch($d_filterconfdirty_path);
- header("Location: firewall_rules.php");
+ header("Location: firewall_rules.php?if={$if}");
exit;
}
-} else if ($_GET['act'] == "up") {
- if (($_GET['id'] > 0) && $a_filter[$_GET['id']]) {
- $tmp = $a_filter[$_GET['id']-1];
- $a_filter[$_GET['id']-1] = $a_filter[$_GET['id']];
- $a_filter[$_GET['id']] = $tmp;
- write_config();
- touch($d_filterconfdirty_path);
- header("Location: firewall_rules.php");
- exit;
+} else {
+ /* yuck - IE won't send value attributes for image buttons, while Mozilla does -
+ so we use .x/.y to fine move button clicks instead... */
+ unset($movebtn);
+ foreach ($_POST as $pn => $pd) {
+ if (preg_match("/move_(\d+)_x/", $pn, $matches)) {
+ $movebtn = $matches[1];
+ break;
+ }
}
-} else if ($_GET['act'] == "toggle") {
- if ($a_filter[$_GET['id']]) {
- $a_filter[$_GET['id']]['disabled'] = !isset($a_filter[$_GET['id']]['disabled']);
+ /* move selected rules before this rule */
+ if (isset($movebtn) && is_array($_POST['rule']) && count($_POST['rule'])) {
+ $a_filter_new = array();
+
+ /* copy all rules < $movebtn and not selected */
+ for ($i = 0; $i < $movebtn; $i++) {
+ if (!in_array($i, $_POST['rule']))
+ $a_filter_new[] = $a_filter[$i];
+ }
+
+ /* copy all selected rules */
+ for ($i = 0; $i < count($a_filter); $i++) {
+ if ($i == $movebtn)
+ continue;
+ if (in_array($i, $_POST['rule']))
+ $a_filter_new[] = $a_filter[$i];
+ }
+
+ /* copy $movebtn rule */
+ if ($movebtn < count($a_filter))
+ $a_filter_new[] = $a_filter[$movebtn];
+
+ /* copy all rules > $movebtn and not selected */
+ for ($i = $movebtn+1; $i < count($a_filter); $i++) {
+ if (!in_array($i, $_POST['rule']))
+ $a_filter_new[] = $a_filter[$i];
+ }
+
+ $a_filter = $a_filter_new;
write_config();
touch($d_filterconfdirty_path);
- header("Location: firewall_rules.php");
+ header("Location: firewall_rules.php?if={$if}");
exit;
}
}
@@ -116,36 +157,21 @@ if ($_GET['act'] == "del") {
<?php print_info_box_np("The firewall rule configuration has been changed.<br>You must apply the changes in order for them to take effect.");?><br>
<input name="apply" type="submit" class="formbtn" id="apply" value="Apply changes"></p>
<?php endif; ?>
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr><td>
+ <ul id="tabnav">
+<?php foreach ($iflist as $ifent => $ifname):
+ if ($ifent == $if): ?>
+ <li class="tabact"><?=htmlspecialchars($ifname);?></li>
+<?php else: ?>
+ <li class="tabinact"><a href="firewall_rules.php?if=<?=$ifent;?>"><?=htmlspecialchars($ifname);?></a></li>
+<?php endif; ?>
+<?php endforeach; ?>
+ </ul>
+ </td></tr>
+ <tr>
+ <td class="tabcont">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
-
- <tr><td colspan="9">
- <ul id="tabnav">
- <li class="tabact">Rules</li>
- <li class="tabinact"><a href="firewall_shaper_queues.php">Queues</a></li>
- </ul>
- </td></tr>
- <tr>
- <td class="tabcont">
- <table width="100%" border="0" cellpadding="0" cellspacing="0">
-
- <?php $lastif = ""; for ($i = 0; isset($a_filter[$i]); $i++):
- $filterent = $a_filter[$i];
- if ($filterent['interface'] != $lastif):
- if ($i):
- ?>
-
- <tr>
- <td colspan="8" class="list" height="12"></td>
- </tr>
- <?php endif; ?>
- <tr>
- <td colspan="7" class="listtopic"><?php
- $iflabels = array('lan' => 'LAN interface', 'wan' => 'WAN interface', 'pptp' => 'PPTP clients');
- for ($j = 1; isset($config['interfaces']['opt' . $j]); $j++)
- $iflabels['opt' . $j] = $config['interfaces']['opt' . $j]['name'] . " interface";
- echo htmlspecialchars($iflabels[$filterent['interface']]); ?></td>
- <td class="list"></td>
- </tr>
<tr>
<td width="5%" class="list">&nbsp;</td>
<td width="10%" class="listhdrr">Proto</td>
@@ -156,7 +182,11 @@ if ($_GET['act'] == "del") {
<td width="25%" class="listhdr">Description</td>
<td width="10%" class="list"></td>
</tr>
- <?php $lastif = $filterent['interface']; endif; ?>
+ <?php $nrules = 0; for ($i = 0; isset($a_filter[$i]); $i++):
+ $filterent = $a_filter[$i];
+ if ($filterent['interface'] != $if)
+ continue;
+ ?>
<tr valign="top">
<td class="listt">
<?php if ($filterent['type'] == "block")
@@ -176,7 +206,7 @@ if ($_GET['act'] == "del") {
$textss = $textse = "";
}
?>
- <a href="?act=toggle&id=<?=$i;?>"><img src="<?=$iconfn;?>.gif" width="11" height="11" border="0" title="click to toggle enabled/disabled status"></a>
+ <a href="?if=<?=$if;?>&act=toggle&id=<?=$i;?>"><img src="<?=$iconfn;?>.gif" width="11" height="11" border="0" title="click to toggle enabled/disabled status"></a>
<?php if (isset($filterent['log'])):
$iconfn = "log_s";
if (isset($filterent['disabled']))
@@ -185,7 +215,7 @@ if ($_GET['act'] == "del") {
<br><img src="<?=$iconfn;?>.gif" width="11" height="15" border="0">
<?php endif; ?>
</td>
- <td class="listlr">
+ <td class="listlr">
<?=$textss;?><?php if (isset($filterent['protocol'])) echo strtoupper($filterent['protocol']); else echo "*"; ?><?=$textse;?>
</td>
<td class="listr">
@@ -194,39 +224,57 @@ if ($_GET['act'] == "del") {
<td class="listr">
<?=$textss;?><?php echo htmlspecialchars(pprint_port($filterent['source']['port'])); ?><?=$textse;?>
</td>
- <td class="listr">
+ <td class="listr">
<?=$textss;?><?php echo htmlspecialchars(pprint_address($filterent['destination'])); ?><?=$textse;?>
</td>
- <td class="listr">
+ <td class="listr">
<?=$textss;?><?php echo htmlspecialchars(pprint_port($filterent['destination']['port'])); ?><?=$textse;?>
</td>
- <td class="listbg">
- <?=$textss;?><font color="#FFFFFF"><?=htmlspecialchars($filterent['descr']);?>&nbsp;<?=$textse;?>
+ <td class="listbg">
+ <?=$textss;?><?=htmlspecialchars($filterent['descr']);?>&nbsp;<?=$textse;?>
</td>
<td valign="middle" nowrap class="list">
- <a href="firewall_rules_edit.php?id=<?=$i;?>"><img src="e.gif" title="edit rule" width="17" height="17" border="0"></a>
- <?php if (($i > 0) && ($a_filter[$i-1]['interface'] == $filterent['interface'])): ?>
- <a href="firewall_rules.php?act=up&id=<?=$i;?>"><img src="up.gif" title="move up" width="17" height="17" border="0"></a>
- <?php else: ?>
- <img src="up_d.gif" width="17" height="17" border="0">
- <?php endif; ?><br>
- <a href="firewall_rules.php?act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this rule?')"><img src="x.gif" title="delete rule" width="17" height="17" border="0"></a>
- <?php if ($a_filter[$i+1]['interface'] == $filterent['interface']): ?>
- <a href="firewall_rules.php?act=down&id=<?=$i;?>"><img src="down.gif" title="move down" width="17" height="17" border="0"></a>
- <?php else: ?>
- <img src="down_d.gif" width="17" height="17" border="0">
- <?php endif; ?>
- <a href="firewall_rules_edit.php?dup=<?=$i;?>"><img src="plus.gif" title="add a new rule based on this one" width="17" height="17" border="0"></a>
+ <table border="0" cellspacing="0" cellpadding="1">
+ <tr>
+ <td><a href="firewall_rules_edit.php?id=<?=$i;?>"><img src="e.gif" title="edit rule" width="17" height="17" border="0"></a></td>
+ <td align="center" valign="middle"><input type="checkbox" name="rule[]" value="<?=$i;?>" style="margin: 0; padding: 0; width: 15px; height: 15px;"></td>
+ </tr>
+ <tr>
+ <td><input name="move_<?=$i;?>" type="image" src="left.gif" width="17" height="17" title="move selected rules before this rule"></td>
+ <td><a href="firewall_rules_edit.php?dup=<?=$i;?>"><img src="plus.gif" title="add a new rule based on this one" width="17" height="17" border="0"></a></td>
+ </tr>
+ </table>
</td>
</tr>
- <?php endfor; ?>
- <tr>
+ <?php $nrules++; endfor; ?>
+ <?php if ($nrules == 0): ?>
+ <td class="listt"></td>
+ <td class="listlr" colspan="6" align="center" valign="middle">
+ <span class="gray">
+ No rules are currently defined for this interface.<br>
+ All incoming connections on this interface will be blocked until you add pass rules.<br><br>
+ Click the <a href="firewall_rules_edit.php?if=<?=$if;?>"><img src="plus.gif" title="add new rule" border="0" width="17" height="17" align="absmiddle"></a> button to add a new rule.</span>
+ </td>
+ <?php endif; ?>
+ <tr>
<td class="list" colspan="7"></td>
- <td class="list"> <a href="firewall_rules_edit.php"><img src="plus.gif" title="add new rule" width="17" height="17" border="0"></a></td>
+ <td class="list">
+ <table border="0" cellspacing="0" cellpadding="1">
+ <tr>
+ <td>
+ <?php if ($nrules == 0): ?><img src="left_d.gif" width="17" height="17" title="move selected rules to end" border="0"><?php else: ?><input name="move_<?=$i;?>" type="image" src="left.gif" width="17" height="17" title="move selected rules to end"><?php endif; ?></td>
+ <td><a href="firewall_rules_edit.php?if=<?=$if;?>"><img src="plus.gif" title="add new rule" width="17" height="17" border="0"></a></td>
+ </tr>
+ <tr>
+ <td><?php if ($nrules == 0): ?><img src="x_d.gif" width="17" height="17" title="delete selected rules" border="0"><?php else: ?><input name="del" type="image" src="x.gif" width="17" height="17" title="delete selected rules" onclick="return confirm('Do you really want to delete the selected rules?')"><?php endif; ?></td>
+ <td></td>
+ </tr>
+ </table>
+ </td>
</tr>
</table>
<table border="0" cellspacing="0" cellpadding="0">
- <tr>
+ <tr>
<td width="16"><img src="pass.gif" width="11" height="11"></td>
<td>pass</td>
<td width="14"></td>
@@ -242,7 +290,7 @@ if ($_GET['act'] == "del") {
<tr>
<td colspan="5" height="4"></td>
</tr>
- <tr>
+ <tr>
<td><img src="pass_d.gif" width="11" height="11"></td>
<td>pass (disabled)</td>
<td></td>
@@ -256,15 +304,18 @@ if ($_GET['act'] == "del") {
<td>log (disabled)</td>
</tr>
</table>
- </tr></table>
- <p>
- <strong><span class="red">Hint:<br>
- </span></strong>rules are evaluated on a first-match basis (i.e.
- the action of the first rule to match a packet will be executed).
- This means that if you use block rules, you'll have to pay attention
- to the rule order. Everything that isn't explicitly passed is blocked
- by default.</p>
- </form>
+ </td>
+ </tr>
+</table>
+ <p>
+ <strong><span class="red">Hint:<br>
+ </span></strong>rules are evaluated on a first-match basis (i.e.
+ the action of the first rule to match a packet will be executed).
+ This means that if you use block rules, you'll have to pay attention
+ to the rule order. Everything that isn't explicitly passed is blocked
+ by default.</p>
+<input type="hidden" name="if" value="<?=$if;?>">
+</form>
<?php include("fend.inc"); ?>
</body>
</html>
diff --git a/usr/local/www/interfaces_wlan.inc b/usr/local/www/interfaces_wlan.inc
index 8861ce6..9b3c41c 100755
--- a/usr/local/www/interfaces_wlan.inc
+++ b/usr/local/www/interfaces_wlan.inc
@@ -98,7 +98,7 @@ function wireless_config_print() {
<td colspan="2" valign="top" height="16"></td>
</tr>
<tr>
- <td colspan="2" valign="top" class="vnsepcell">Wireless configuration</td>
+ <td colspan="2" valign="top" class="listtopic">Wireless configuration</td>
</tr>
<tr>
<td valign="top" class="vncellreq">Mode</td>
@@ -143,7 +143,7 @@ function wireless_config_print() {
</tr>
<tr>
<td valign="top" class="vncell">WEP</td>
- <td class="vtable"> <input name="wep_enable" type="checkbox" id="wep_enable" value="yes" <?php if ($pconfig['wep_enable'] == "yes") echo "checked"; ?>>
+ <td class="vtable"> <input name="wep_enable" type="checkbox" id="wep_enable" value="yes" <?php if ($pconfig['wep_enable']) echo "checked"; ?>>
<strong>Enable WEP</strong><br>
&nbsp; <table border="0" cellspacing="0" cellpadding="0">
<tr>
diff --git a/usr/local/www/services_captiveportal.php b/usr/local/www/services_captiveportal.php
index bdd161e..f2366c4 100755
--- a/usr/local/www/services_captiveportal.php
+++ b/usr/local/www/services_captiveportal.php
@@ -1,22 +1,22 @@
#!/usr/local/bin/php
-<?php
+<?php
/*
services_captiveportal.php
part of m0n0wall (http://m0n0.ch/wall)
-
+
Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
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
@@ -71,9 +71,9 @@ if ($_POST) {
if ($_POST['enable']) {
$reqdfields = explode(" ", "cinterface");
$reqdfieldsn = explode(",", "Interface");
-
+
do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
-
+
/* make sure no interfaces are bridged */
for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++) {
$coptif = &$config['interfaces']['opt' . $i];
@@ -82,7 +82,7 @@ if ($_POST) {
break;
}
}
-
+
if ($_POST['httpslogin_enable']) {
if (!$_POST['cert'] || !$_POST['key']) {
$input_errors[] = "Certificate and key must be specified for HTTPS login.";
@@ -92,13 +92,13 @@ if ($_POST) {
if (!strstr($_POST['key'], "BEGIN RSA PRIVATE KEY") || !strstr($_POST['key'], "END RSA PRIVATE KEY"))
$input_errors[] = "This key does not appear to be valid.";
}
-
+
if (!$_POST['httpsname'] || !is_domain($_POST['httpsname'])) {
$input_errors[] = "The HTTPS server name must be specified for HTTPS login.";
}
}
}
-
+
if ($_POST['timeout'] && (!is_numeric($_POST['timeout']) || ($_POST['timeout'] < 1))) {
$input_errors[] = "The timeout must be at least 1 minute.";
}
@@ -132,15 +132,15 @@ if ($_POST) {
$config['captiveportal']['radiusport'] = $_POST['radiusport'];
$config['captiveportal']['radiusacctport'] = $_POST['radiusacctport'];
$config['captiveportal']['radiuskey'] = $_POST['radiuskey'];
-
+
/* file upload? */
if (is_uploaded_file($_FILES['htmlfile']['tmp_name']))
$config['captiveportal']['page']['htmltext'] = base64_encode(file_get_contents($_FILES['htmlfile']['tmp_name']));
if (is_uploaded_file($_FILES['errfile']['tmp_name']))
$config['captiveportal']['page']['errtext'] = base64_encode(file_get_contents($_FILES['errfile']['tmp_name']));
-
+
write_config();
-
+
$retval = 0;
if (!file_exists($d_sysrebootreqd_path)) {
config_lock();
@@ -162,47 +162,30 @@ if ($_POST) {
function radacct_change() {
if (document.iform.radacct_enable.checked) {
document.iform.logoutwin_enable.checked = 1;
- }
+ }
}
function enable_change(enable_change) {
- if (document.iform.enable.checked || enable_change) {
- document.iform.radiusacctport.disabled = 0;
- document.iform.cinterface.disabled = 0;
- document.iform.idletimeout.disabled = 0;
- document.iform.timeout.disabled = 0;
- document.iform.redirurl.disabled = 0;
- document.iform.radiusip.disabled = 0;
- document.iform.radiusport.disabled = 0;
- document.iform.radiuskey.disabled = 0;
- document.iform.radacct_enable.disabled = 0;
- document.iform.httpslogin_enable.disabled = 0;
- document.iform.httpsname.disabled = 0;
- document.iform.cert.disabled = 0;
- document.iform.key.disabled = 0;
- document.iform.logoutwin_enable.disabled = 0;
- document.iform.nomacfilter.disabled = 0;
- document.iform.htmlfile.disabled = 0;
- document.iform.errfile.disabled = 0;
- } else {
- document.iform.radiusacctport.disabled = 1;
- document.iform.cinterface.disabled = 1;
- document.iform.idletimeout.disabled = 1;
- document.iform.timeout.disabled = 1;
- document.iform.redirurl.disabled = 1;
- document.iform.radiusip.disabled = 1;
- document.iform.radiusport.disabled = 1;
- document.iform.radiuskey.disabled = 1;
- document.iform.radacct_enable.disabled = 1;
- document.iform.httpslogin_enable.disabled = 1;
- document.iform.httpsname.disabled = 1;
- document.iform.cert.disabled = 1;
- document.iform.key.disabled = 1;
- document.iform.logoutwin_enable.disabled = 1;
- document.iform.nomacfilter.disabled = 1;
- document.iform.htmlfile.disabled = 1;
- document.iform.errfile.disabled = 1;
- }
+ var endis;
+ endis = !(document.iform.enable.checked || enable_change);
+
+ document.iform.cinterface.disabled = endis;
+ document.iform.idletimeout.disabled = endis;
+ document.iform.timeout.disabled = endis;
+ document.iform.redirurl.disabled = endis;
+ document.iform.radiusip.disabled = endis;
+ document.iform.radiusport.disabled = endis;
+ document.iform.radiuskey.disabled = endis;
+ document.iform.radacct_enable.disabled = endis;
+ document.iform.httpslogin_enable.disabled = endis;
+ document.iform.httpsname.disabled = endis;
+ document.iform.cert.disabled = endis;
+ document.iform.key.disabled = endis;
+ document.iform.logoutwin_enable.disabled = endis;
+ document.iform.nomacfilter.disabled = endis;
+ document.iform.htmlfile.disabled = endis;
+ document.iform.errfile.disabled = endis;
+
if (enable_change && document.iform.radacct_enable.checked) {
document.iform.logoutwin_enable.checked = 1;
}
@@ -228,13 +211,13 @@ function enable_change(enable_change) {
<tr>
<td class="tabcont">
<table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
+ <tr>
<td width="22%" valign="top" class="vtable">&nbsp;</td>
<td width="78%" class="vtable">
<input name="enable" type="checkbox" value="yes" <?php if ($pconfig['enable']) echo "checked"; ?> onClick="enable_change(false)">
<strong>Enable captive portal </strong></td>
</tr>
- <tr>
+ <tr>
<td width="22%" valign="top" class="vncellreq">Interface</td>
<td width="78%" class="vtable">
<select name="cinterface" class="formfld" id="cinterface">
@@ -244,7 +227,7 @@ function enable_change(enable_change) {
$interfaces['opt' . $i] = $config['interfaces']['opt' . $i]['descr'];
}
foreach ($interfaces as $iface => $ifacename): ?>
- <option value="<?=$iface;?>" <?php if ($iface == $pconfig['cinterface']) echo "selected"; ?>>
+ <option value="<?=$iface;?>" <?php if ($iface == $pconfig['cinterface']) echo "selected"; ?>>
<?=htmlspecialchars($ifacename);?>
</option>
<?php endforeach; ?>
@@ -258,16 +241,16 @@ function enable_change(enable_change) {
minutes<br>
Clients will be disconnected after this amount of inactivity. They may log in again immediately, though. Leave this field blank for no idle timeout.</td>
</tr>
- <tr>
+ <tr>
<td width="22%" valign="top" class="vncell">Hard timeout</td>
- <td width="78%" class="vtable">
- <input name="timeout" type="text" class="formfld" id="timeout" size="6" value="<?=htmlspecialchars($pconfig['timeout']);?>">
+ <td width="78%" class="vtable">
+ <input name="timeout" type="text" class="formfld" id="timeout" size="6" value="<?=htmlspecialchars($pconfig['timeout']);?>">
minutes<br>
Clients will be disconnected after this amount of time, regardless of activity. They may log in again immediately, though. Leave this field blank for no hard timeout (not recommended unless an idle timeout is set).</td>
</tr>
- <tr>
+ <tr>
<td width="22%" valign="top" class="vncell">Logout popup window</td>
- <td width="78%" class="vtable">
+ <td width="78%" class="vtable">
<input name="logoutwin_enable" type="checkbox" class="formfld" id="logoutwin_enable" value="yes" <?php if($pconfig['logoutwin_enable']) echo "checked"; ?>>
<strong>Enable logout popup window</strong><br>
If enabled, a popup window will appear when clients are allowed through the captive portal. This allows clients to explicitly disconnect themselves before the idle or hard timeout occurs. When RADIUS accounting is enabled, this option is implied.</td>
@@ -287,9 +270,9 @@ to access after they've authenticated.</td>
<strong>Disable MAC filtering</strong><br>
If this option is set, no attempts will be made to ensure that the MAC address of clients stays the same while they're logged in. This is required when the MAC address of cannot be determined (usually because there are routers between m0n0wall and the clients).</td>
</tr>
- <tr>
+ <tr>
<td width="22%" valign="top" class="vncell">RADIUS server</td>
- <td width="78%" class="vtable">
+ <td width="78%" class="vtable">
<table cellpadding="0" cellspacing="0">
<tr>
<td>IP address:</td>
@@ -339,18 +322,17 @@ to access after they've authenticated.</td>
<br>
Paste an RSA private key in PEM format here.</td>
</tr>
- <tr>
+ <tr>
<td width="22%" valign="top" class="vncellreq">Portal page contents</td>
- <td width="78%" class="vtable">
+ <td width="78%" class="vtable">
<input type="file" name="htmlfile" class="formfld" id="htmlfile"><br>
<?php if ($config['captiveportal']['page']['htmltext']): ?>
- <a href="?act=viewhtml" target="_blank">View current page</a>
+ <a href="?act=viewhtml" target="_blank">View current page</a>
<br>
<br>
<?php endif; ?>
Upload an HTML file for the portal page here (leave blank to keep the current one). Make sure to include a form (POST to &quot;$PORTAL_ACTION$&quot;)
-with a submit button (name=&quot;accept&quot;). Include the &quot;auth_user&quot; and &quot;auth_pass&quot; input elements if RADIUS authentication is enabled. If RADIUS is enabled and no &quot;auth_user&quot; is present, authentication will always fail. If RADIUS is not enabled, you can omit both these input elements.
-When using HTTPS login, a hidden field with name=&quot;redirurl&quot; and value=&quot;$PORTAL_REDIRURL$&quot; has to be included as well. Example code for the form:<br>
+with a submit button (name=&quot;accept&quot;) and a hidden field with name=&quot;redirurl&quot; and value=&quot;$PORTAL_REDIRURL$&quot;. Include the &quot;auth_user&quot; and &quot;auth_pass&quot; input elements if RADIUS authentication is enabled. If RADIUS is enabled and no &quot;auth_user&quot; is present, authentication will always fail. If RADIUS is not enabled, you can omit both of these input elements. Example code for the form:<br>
<br>
<tt>&lt;form method=&quot;post&quot; action=&quot;$PORTAL_ACTION$&quot;&gt;<br>
&nbsp;&nbsp;&nbsp;&lt;input name=&quot;auth_user&quot; type=&quot;text&quot;&gt;<br>
@@ -366,19 +348,19 @@ When using HTTPS login, a hidden field with name=&quot;redirurl&quot; and value=
<td class="vtable">
<input name="errfile" type="file" class="formfld" id="errfile"><br>
<?php if ($config['captiveportal']['page']['errtext']): ?>
- <a href="?act=viewerrhtml" target="_blank">View current page</a>
+ <a href="?act=viewerrhtml" target="_blank">View current page</a>
<br>
<br>
<?php endif; ?>
The contents of the HTML file that you upload here are displayed when a RADIUS authentication error occurs.</td>
</tr>
- <tr>
+ <tr>
<td width="22%" valign="top">&nbsp;</td>
- <td width="78%">
- <input name="Submit" type="submit" class="formbtn" value="Save" onClick="enable_change(true)">
+ <td width="78%">
+ <input name="Submit" type="submit" class="formbtn" value="Save" onClick="enable_change(true)">
</td>
</tr>
- <tr>
+ <tr>
<td width="22%" valign="top">&nbsp;</td>
<td width="78%"><span class="vexpl"><span class="red"><strong>Note:<br>
</strong></span>Changing any settings on this page will disconnect all clients! Don't forget to enable the DHCP server on your captive portal interface! Make sure that the default/maximum DHCP lease time is higher than the timeout entered on this page. Also, the DNS forwarder needs to be enabled for DNS lookups by unauthenticated clients to work. </span></td>
diff --git a/usr/local/www/services_captiveportal_ip.php b/usr/local/www/services_captiveportal_ip.php
index f1b6f96..b3d406a 100755
--- a/usr/local/www/services_captiveportal_ip.php
+++ b/usr/local/www/services_captiveportal_ip.php
@@ -3,20 +3,20 @@
/*
services_captiveportal_ip.php
part of m0n0wall (http://m0n0.ch/wall)
-
+
Copyright (C) 2004 Dinesh Nair <dinesh@alphaque.com>
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
@@ -103,22 +103,22 @@ if ($_GET['act'] == "del") {
<?php $i = 0; foreach ($a_allowedips as $ip): ?>
<tr>
<td class="listlr">
- <?php if($ip['dir'] == "to")
+ <?php if($ip['dir'] == "to")
echo "any <img src=\"in.gif\" width=\"11\" height=\"11\" align=\"absmiddle\">";
- ?>
+ ?>
<?=strtolower($ip['ip']);?>
- <?php if($ip['dir'] == "from")
+ <?php if($ip['dir'] == "from")
echo "<img src=\"in.gif\" width=\"11\" height=\"11\" align=\"absmiddle\"> any";
- ?>
+ ?>
</td>
<td class="listbg">
- <font color="#FFFFFF"><?=htmlspecialchars($ip['descr']);?>&nbsp;
+ <?=htmlspecialchars($ip['descr']);?>&nbsp;
</td>
<td valign="middle" nowrap class="list"> <a href="services_captiveportal_ip_edit.php?id=<?=$i;?>"><img src="e.gif" width="17" height="17" border="0"></a>
&nbsp;<a href="services_captiveportal_ip.php?act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this address?')"><img src="x.gif" width="17" height="17" border="0"></a></td>
</tr>
<?php $i++; endforeach; ?>
- <tr>
+ <tr>
<td class="list" colspan="2">&nbsp;</td>
<td class="list"> <a href="services_captiveportal_ip_edit.php"><img src="plus.gif" width="17" height="17" border="0"></a></td>
</tr>
diff --git a/usr/local/www/services_captiveportal_mac.php b/usr/local/www/services_captiveportal_mac.php
index 9edaf95..d38c58c 100755
--- a/usr/local/www/services_captiveportal_mac.php
+++ b/usr/local/www/services_captiveportal_mac.php
@@ -3,20 +3,20 @@
/*
services_captiveportal_mac.php
part of m0n0wall (http://m0n0.ch/wall)
-
+
Copyright (C) 2004 Dinesh Nair <dinesh@alphaque.com>
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
@@ -106,13 +106,13 @@ if ($_GET['act'] == "del") {
<?=strtolower($mac['mac']);?>
</td>
<td class="listbg">
- <font color="#FFFFFF"><?=htmlspecialchars($mac['descr']);?>&nbsp;
+ <?=htmlspecialchars($mac['descr']);?>&nbsp;
</td>
<td valign="middle" nowrap class="list"> <a href="services_captiveportal_mac_edit.php?id=<?=$i;?>"><img src="e.gif" width="17" height="17" border="0"></a>
&nbsp;<a href="services_captiveportal_mac.php?act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this host?')"><img src="x.gif" width="17" height="17" border="0"></a></td>
</tr>
<?php $i++; endforeach; ?>
- <tr>
+ <tr>
<td class="list" colspan="2">&nbsp;</td>
<td class="list"> <a href="services_captiveportal_mac_edit.php"><img src="plus.gif" width="17" height="17" border="0"></a></td>
</tr>
diff --git a/usr/local/www/services_dhcp.php b/usr/local/www/services_dhcp.php
index 5b35b6a..9a8614c 100755
--- a/usr/local/www/services_dhcp.php
+++ b/usr/local/www/services_dhcp.php
@@ -161,21 +161,15 @@ if ($_GET['act'] == "del") {
<script language="JavaScript">
<!--
function enable_change(enable_over) {
- if (document.iform.enable.checked || enable_over) {
- document.iform.range_from.disabled = 0;
- document.iform.range_to.disabled = 0;
- document.iform.wins1.disabled = 0;
- document.iform.wins2.disabled = 0;
- document.iform.deftime.disabled = 0;
- document.iform.maxtime.disabled = 0;
- } else {
- document.iform.range_from.disabled = 1;
- document.iform.range_to.disabled = 1;
- document.iform.wins1.disabled = 1;
- document.iform.wins2.disabled = 1;
- document.iform.deftime.disabled = 1;
- document.iform.maxtime.disabled = 1;
- }
+ var endis;
+ endis = !(document.iform.enable.checked || enable_over);
+
+ document.iform.range_from.disabled = endis;
+ document.iform.range_to.disabled = endis;
+ document.iform.wins1.disabled = endis;
+ document.iform.wins2.disabled = endis;
+ document.iform.deftime.disabled = endis;
+ document.iform.maxtime.disabled = endis;
}
//-->
</script>
@@ -204,7 +198,7 @@ function enable_change(enable_over) {
</ul>
</td></tr>
<tr>
- <td class="tabcont">
+ <td class="tabcont">
<table width="100%" border="0" cellpadding="6" cellspacing="0">
<tr>
<td width="22%" valign="top" class="vtable">&nbsp;</td>
diff --git a/usr/local/www/services_dyndns.php b/usr/local/www/services_dyndns.php
index e4864e6..20cdefd 100755
--- a/usr/local/www/services_dyndns.php
+++ b/usr/local/www/services_dyndns.php
@@ -31,6 +31,10 @@
require("guiconfig.inc");
+if (!is_array($config['dnsupdate'])) {
+ $config['dnsupdate'] = array();
+}
+
$pconfig['username'] = $config['dyndns']['username'];
$pconfig['password'] = $config['dyndns']['password'];
$pconfig['host'] = $config['dyndns']['host'];
@@ -39,18 +43,35 @@ $pconfig['type'] = $config['dyndns']['type'];
$pconfig['enable'] = isset($config['dyndns']['enable']);
$pconfig['wildcard'] = isset($config['dyndns']['wildcard']);
+$pconfig['dnsupdate_enable'] = isset($config['dnsupdate']['enable']);
+$pconfig['dnsupdate_host'] = $config['dnsupdate']['host'];
+$pconfig['dnsupdate_ttl'] = $config['dnsupdate']['ttl'];
+if (!$pconfig['dnsupdate_ttl'])
+ $pconfig['dnsupdate_ttl'] = 60;
+$pconfig['dnsupdate_keydata'] = $config['dnsupdate']['keydata'];
+$pconfig['dnsupdate_keyname'] = $config['dnsupdate']['keyname'];
+$pconfig['dnsupdate_keytype'] = $config['dnsupdate']['keytype'];
+if (!$pconfig['dnsupdate_keytype'])
+ $pconfig['dnsupdate_keytype'] = "zone";
+$pconfig['dnsupdate_usetcp'] = isset($config['dnsupdate']['usetcp']);
+
if ($_POST) {
unset($input_errors);
$pconfig = $_POST;
/* input validation */
+ $reqdfields = array();
+ $reqdfieldsn = array();
if ($_POST['enable']) {
- $reqdfields = explode(" ", "host username password type");
- $reqdfieldsn = explode(",", "Hostname,Username,Password,Service type");
-
- do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
+ $reqdfields = array_merge($reqdfields, explode(" ", "host username password type"));
+ $reqdfieldsn = array_merge($reqdfieldsn, explode(",", "Hostname,Username,Password,Service type"));
}
+ if ($_POST['dnsupdate_enable']) {
+ $reqdfields = array_merge($reqdfields, explode(" ", "dnsupdate_host dnsupdate_ttl dnsupdate_keyname dnsupdate_keydata"));
+ $reqdfieldsn = array_merge($reqdfieldsn, explode(",", "Hostname,TTL,Key name,Key"));
+ }
+ do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
if (($_POST['host'] && !is_domain($_POST['host']))) {
$input_errors[] = "The host name contains invalid characters.";
@@ -61,6 +82,16 @@ if ($_POST) {
if (($_POST['username'] && !is_dyndns_username($_POST['username']))) {
$input_errors[] = "The username contains invalid characters.";
}
+
+ if (($_POST['dnsupdate_host'] && !is_domain($_POST['dnsupdate_host']))) {
+ $input_errors[] = "The DNS update host name contains invalid characters.";
+ }
+ if (($_POST['dnsupdate_ttl'] && !is_numericint($_POST['dnsupdate_ttl']))) {
+ $input_errors[] = "The DNS update TTL must be an integer.";
+ }
+ if (($_POST['dnsupdate_keyname'] && !is_domain($_POST['dnsupdate_keyname']))) {
+ $input_errors[] = "The DNS update key name contains invalid characters.";
+ }
if (!$input_errors) {
$config['dyndns']['type'] = $_POST['type'];
@@ -70,6 +101,14 @@ if ($_POST) {
$config['dyndns']['mx'] = $_POST['mx'];
$config['dyndns']['wildcard'] = $_POST['wildcard'] ? true : false;
$config['dyndns']['enable'] = $_POST['enable'] ? true : false;
+
+ $config['dnsupdate']['enable'] = $_POST['dnsupdate_enable'] ? true : false;
+ $config['dnsupdate']['host'] = $_POST['dnsupdate_host'];
+ $config['dnsupdate']['ttl'] = $_POST['dnsupdate_ttl'];
+ $config['dnsupdate']['keyname'] = $_POST['dnsupdate_keyname'];
+ $config['dnsupdate']['keytype'] = $_POST['dnsupdate_keytype'];
+ $config['dnsupdate']['keydata'] = $_POST['dnsupdate_keydata'];
+ $config['dnsupdate']['usetcp'] = $_POST['dnsupdate_usetcp'] ? true : false;
write_config();
@@ -79,6 +118,7 @@ if ($_POST) {
config_lock();
services_dyndns_reset();
$retval = services_dyndns_configure();
+ $retval |= services_dnsupdate_process();
config_unlock();
}
$savemsg = get_std_save_message($retval);
@@ -94,21 +134,25 @@ if ($_POST) {
<script language="JavaScript">
<!--
function enable_change(enable_change) {
- if (document.iform.enable.checked || enable_change) {
- document.iform.host.disabled = 0;
- document.iform.mx.disabled = 0;
- document.iform.type.disabled = 0;
- document.iform.wildcard.disabled = 0;
- document.iform.username.disabled = 0;
- document.iform.password.disabled = 0;
- } else {
- document.iform.host.disabled = 1;
- document.iform.mx.disabled = 1;
- document.iform.type.disabled = 1;
- document.iform.wildcard.disabled = 1;
- document.iform.username.disabled = 1;
- document.iform.password.disabled = 1;
- }
+ var endis;
+
+ endis = !(document.iform.enable.checked || enable_change);
+ document.iform.host.disabled = endis;
+ document.iform.mx.disabled = endis;
+ document.iform.type.disabled = endis;
+ document.iform.wildcard.disabled = endis;
+ document.iform.username.disabled = endis;
+ document.iform.password.disabled = endis;
+
+ endis = !(document.iform.dnsupdate_enable.checked || enable_change);
+ document.iform.dnsupdate_host.disabled = endis;
+ document.iform.dnsupdate_ttl.disabled = endis;
+ document.iform.dnsupdate_keyname.disabled = endis;
+ document.iform.dnsupdate_keytype[0].disabled = endis;
+ document.iform.dnsupdate_keytype[1].disabled = endis;
+ document.iform.dnsupdate_keytype[2].disabled = endis;
+ document.iform.dnsupdate_keydata.disabled = endis;
+ document.iform.dnsupdate_usetcp.disabled = endis;
}
//-->
</script>
@@ -122,11 +166,12 @@ function enable_change(enable_change) {
<form action="services_dyndns.php" method="post" name="iform" id="iform">
<table width="100%" border="0" cellpadding="6" cellspacing="0">
<tr>
- <td width="22%" valign="top" class="vtable">&nbsp;</td>
- <td width="78%" class="vtable">
-<input name="enable" type="checkbox" value="yes" <?php if ($pconfig['enable']) echo "checked"; ?> onClick="enable_change(false)">
- <strong>Enable Dynamic DNS client</strong></td>
- </tr>
+ <td colspan="2" valign="top" class="optsect_t">
+ <table border="0" cellspacing="0" cellpadding="0" width="100%">
+ <tr><td class="optsect_s"><strong>Dynamic DNS client</strong></td>
+ <td align="right" class="optsect_s"><input name="enable" type="checkbox" value="yes" <?php if ($pconfig['enable']) echo "checked"; ?> onClick="enable_change(false)"> <strong>Enable</strong></td></tr>
+ </table></td>
+ </tr>
<tr>
<td width="22%" valign="top" class="vncellreq">Service type</td>
<td width="78%" class="vtable">
@@ -157,7 +202,7 @@ function enable_change(enable_change) {
<tr>
<td width="22%" valign="top" class="vncellreq">Wildcards</td>
<td width="78%" class="vtable">
- <input name="wildcard" type="checkbox" id="wildcard" value="yes" <?php if ($pconfig['wildcard'] == "yes") echo "checked"; ?>>
+ <input name="wildcard" type="checkbox" id="wildcard" value="yes" <?php if ($pconfig['wildcard']) echo "checked"; ?>>
Enable Wildcard</td>
</tr>
<tr>
@@ -173,6 +218,55 @@ function enable_change(enable_change) {
</td>
</tr>
<tr>
+ <td colspan="2" class="list" height="12"></td>
+ </tr>
+ <tr>
+ <td colspan="2" valign="top" class="optsect_t">
+ <table border="0" cellspacing="0" cellpadding="0" width="100%">
+ <tr><td class="optsect_s"><strong>RFC 2163 Dynamic DNS updates</strong></td>
+ <td align="right" class="optsect_s"><input name="dnsupdate_enable" type="checkbox" value="yes" <?php if ($pconfig['dnsupdate_enable']) echo "checked"; ?> onClick="enable_change(false)"> <strong>Enable</strong></td></tr>
+ </table></td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq">Hostname</td>
+ <td width="78%" class="vtable">
+ <input name="dnsupdate_host" type="text" class="formfld" id="dnsupdate_host" size="30" value="<?=htmlspecialchars($pconfig['dnsupdate_host']);?>">
+ </td>
+ </tr>
+ <tr>
+ <td valign="top" class="vncellreq">TTL</td>
+ <td class="vtable">
+ <input name="dnsupdate_ttl" type="text" class="formfld" id="dnsupdate_ttl" size="6" value="<?=htmlspecialchars($pconfig['dnsupdate_ttl']);?>">
+ seconds</td>
+ </tr>
+ <tr>
+ <td valign="top" class="vncellreq">Key name</td>
+ <td class="vtable">
+ <input name="dnsupdate_keyname" type="text" class="formfld" id="dnsupdate_keyname" size="30" value="<?=htmlspecialchars($pconfig['dnsupdate_keyname']);?>">
+ <br>
+ This must match the setting on the DNS server.</td>
+ </tr>
+ <tr>
+ <td valign="top" class="vncellreq">Key type </td>
+ <td class="vtable">
+ <input name="dnsupdate_keytype" type="radio" value="zone" <?php if ($pconfig['dnsupdate_keytype'] == "zone") echo "checked"; ?>> Zone &nbsp;
+ <input name="dnsupdate_keytype" type="radio" value="host" <?php if ($pconfig['dnsupdate_keytype'] == "host") echo "checked"; ?>> Host &nbsp;
+ <input name="dnsupdate_keytype" type="radio" value="user" <?php if ($pconfig['dnsupdate_keytype'] == "user") echo "checked"; ?>> User
+ </tr>
+ <tr>
+ <td valign="top" class="vncellreq">Key</td>
+ <td class="vtable">
+ <input name="dnsupdate_keydata" type="text" class="formfld" id="dnsupdate_keydata" size="70" value="<?=htmlspecialchars($pconfig['dnsupdate_keydata']);?>">
+ <br>
+ Paste an HMAC-MD5 key here.</td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq">Protocol</td>
+ <td width="78%" class="vtable">
+ <input name="dnsupdate_usetcp" type="checkbox" id="dnsupdate_usetcp" value="yes" <?php if ($pconfig['dnsupdate_usetcp']) echo "checked"; ?>>
+ <strong>Use TCP instead of UDP</strong></td>
+ </tr>
+ <tr>
<td width="22%" valign="top">&nbsp;</td>
<td width="78%">
<input name="Submit" type="submit" class="formbtn" value="Save" onClick="enable_change(true)">
@@ -183,7 +277,7 @@ function enable_change(enable_change) {
<td width="78%"><span class="vexpl"><span class="red"><strong>Note:<br>
</strong></span>You must configure a DNS server in <a href="system.php">System:
General setup</a> or allow the DNS server list to be overridden
- by DHCP/PPP on WAN for the DynDNS client to work.</span></td>
+ by DHCP/PPP on WAN for dynamic DNS updates to work.</span></td>
</tr>
</table>
</form>
diff --git a/usr/local/www/services_snmp.php b/usr/local/www/services_snmp.php
index e7c4464..125187b 100755
--- a/usr/local/www/services_snmp.php
+++ b/usr/local/www/services_snmp.php
@@ -81,15 +81,11 @@ if ($_POST) {
<script language="JavaScript">
<!--
function enable_change(enable_change) {
- if (document.iform.enable.checked || enable_change) {
- document.iform.syslocation.disabled = 0;
- document.iform.syscontact.disabled = 0;
- document.iform.rocommunity.disabled = 0;
- } else {
- document.iform.syslocation.disabled = 1;
- document.iform.syscontact.disabled = 1;
- document.iform.rocommunity.disabled = 1;
- }
+ var endis;
+ endis = !(document.iform.enable.checked || enable_change);
+ document.iform.syslocation.disabled = endis;
+ document.iform.syscontact.disabled = endis;
+ document.iform.rocommunity.disabled = endis;
}
//-->
</script>
diff --git a/usr/local/www/system.php b/usr/local/www/system.php
index 90e9502..bafb83d 100755
--- a/usr/local/www/system.php
+++ b/usr/local/www/system.php
@@ -120,6 +120,7 @@ if ($_POST) {
if ($_POST['dns2'])
$config['system']['dnsserver'][] = $_POST['dns2'];
+ $olddnsallowoverride = $config['system']['dnsallowoverride'];
$config['system']['dnsallowoverride'] = $_POST['dnsallowoverride'] ? true : false;
if ($_POST['password']) {
@@ -142,6 +143,10 @@ if ($_POST) {
$retval |= services_dnsmasq_configure();
$retval |= system_timezone_configure();
$retval |= system_ntp_configure();
+
+ if ($olddnsallowoverride != $config['system']['dnsallowoverride'])
+ $retval |= interfaces_wan_configure();
+
config_unlock();
}
@@ -186,7 +191,7 @@ if ($_POST) {
<span class="vexpl">IP addresses; these are also used for
the DHCP service, DNS forwarder and for PPTP VPN clients<br>
<br>
- <input name="dnsallowoverride" type="checkbox" id="dnsallowoverride" value="yes" <?php if ($pconfig['dnsallowoverride'] == "yes") echo "checked"; ?>>
+ <input name="dnsallowoverride" type="checkbox" id="dnsallowoverride" value="yes" <?php if ($pconfig['dnsallowoverride']) echo "checked"; ?>>
<strong>Allow DNS server list to be overridden by DHCP/PPP
on WAN</strong><br>
If this option is set, m0n0wall will use DNS servers assigned
OpenPOWER on IntegriCloud