summaryrefslogtreecommitdiffstats
path: root/usr/local/www
diff options
context:
space:
mode:
authorRenato Botelho <garga@FreeBSD.org>2015-05-30 10:26:39 -0300
committerRenato Botelho <garga@FreeBSD.org>2015-05-30 10:26:39 -0300
commitc92203a970b91aa51a9008942de4fa1ce253d127 (patch)
tree9b753c2bacc38e84fa525b7b7f5e35f8011ceff2 /usr/local/www
parent3ac0f8a1761200b6de3d8c27e3c5823a08ba8ca4 (diff)
parentd38bd8402862723dc03b4f27289cb6cc3c91c08e (diff)
downloadpfsense-c92203a970b91aa51a9008942de4fa1ce253d127.zip
pfsense-c92203a970b91aa51a9008942de4fa1ce253d127.tar.gz
Merge pull request #1700 from phil-davis/system-hr
Diffstat (limited to 'usr/local/www')
-rwxr-xr-xusr/local/www/system_hasync.php530
-rw-r--r--usr/local/www/system_routes.php61
-rw-r--r--usr/local/www/system_routes_edit.php112
3 files changed, 372 insertions, 331 deletions
diff --git a/usr/local/www/system_hasync.php b/usr/local/www/system_hasync.php
index 7816665..6455fe2 100755
--- a/usr/local/www/system_hasync.php
+++ b/usr/local/www/system_hasync.php
@@ -44,31 +44,33 @@ require("guiconfig.inc");
$referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/system_hasync.php');
-if (!is_array($config['hasync']))
+if (!is_array($config['hasync'])) {
$config['hasync'] = array();
+}
$a_hasync = &$config['hasync'];
-$checkbox_names = array('pfsyncenabled',
- 'synchronizeusers',
- 'synchronizeauthservers',
- 'synchronizecerts',
- 'synchronizerules',
- 'synchronizeschedules',
- 'synchronizealiases',
- 'synchronizenat',
- 'synchronizeipsec',
- 'synchronizeopenvpn',
- 'synchronizedhcpd',
- 'synchronizewol',
- 'synchronizestaticroutes',
- 'synchronizelb',
- 'synchronizevirtualip',
- 'synchronizetrafficshaper',
- 'synchronizetrafficshaperlimiter',
- 'synchronizetrafficshaperlayer7',
- 'synchronizednsforwarder',
- 'synchronizecaptiveportal');
+$checkbox_names = array(
+ 'pfsyncenabled',
+ 'synchronizeusers',
+ 'synchronizeauthservers',
+ 'synchronizecerts',
+ 'synchronizerules',
+ 'synchronizeschedules',
+ 'synchronizealiases',
+ 'synchronizenat',
+ 'synchronizeipsec',
+ 'synchronizeopenvpn',
+ 'synchronizedhcpd',
+ 'synchronizewol',
+ 'synchronizestaticroutes',
+ 'synchronizelb',
+ 'synchronizevirtualip',
+ 'synchronizetrafficshaper',
+ 'synchronizetrafficshaperlimiter',
+ 'synchronizetrafficshaperlayer7',
+ 'synchronizednsforwarder',
+ 'synchronizecaptiveportal');
if ($_POST) {
$pconfig = $_POST;
@@ -98,7 +100,7 @@ $pconfig['passwordfld'] = $a_hasync['password'];
$ifaces = get_configured_interface_with_descr();
$ifaces["lo0"] = "loopback";
-$pgtitle = array(gettext("System"),gettext("High Availability Sync"));
+$pgtitle = array(gettext("System"), gettext("High Availability Sync"));
$shortcut_section = "carp";
include("head.inc");
?>
@@ -107,252 +109,250 @@ include("head.inc");
<form action="system_hasync.php" method="post" name="iform" id="iform">
<table width="100%" border="0" cellspacing="0" cellpadding="0" summary="high availability sync">
-<tr>
-<td id="mainarea">
-<div class="tabcont">
-
- <table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0" summary="main area">
- <tr>
- <td colspan="2" class="listtopic">State Synchronization Settings (pfsync)</td>
- </tr>
- <tr valign="top">
- <td width="22%" class="vncell">Synchronize States</td>
- <td class="vtable">
- <input id='pfsyncenabled' type='checkbox' name='pfsyncenabled' value='on' <?php if ($pconfig['pfsyncenabled'] === "on") echo "checked='checked'"; ?> />
- <br />
- pfsync transfers state insertion, update, and deletion messages between firewalls. Each firewall sends these messages out via multicast on a specified interface, using the PFSYNC protocol (IP Protocol 240). It also listens on that interface for similar messages from other firewalls, and imports them into the local state table.<p>This setting should be enabled on all members of a failover group.</p><p>NOTE: Clicking save will force a configuration sync if it is enabled! (see Configuration Synchronization Settings below)</p>
- </td>
- </tr>
- <tr valign="top">
- <td width="22%" class="vncell">Synchronize Interface</td>
- <td class="vtable">
- <select id='pfsyncinterface' name="pfsyncinterface">
- <?php foreach ($ifaces as $ifname => $iface) { ?>
- <?php $selected = ($pconfig['pfsyncinterface'] === $ifname) ? 'selected="selected"' : ''; ?>
- <option value="<?= htmlentities($ifname); ?>" <?= $selected ?>><?= htmlentities($iface); ?></option>
- <?php } ?>
- </select>
- <br />
- If Synchronize States is enabled, it will utilize this interface for communication.<br />
- <b>NOTE:</b> We recommend setting this to a interface other than LAN! A dedicated interface works the best.<br />
- <b>NOTE:</b> You must define a IP on each machine participating in this failover group.<br />
- <b>NOTE:</b> You must have an IP assigned to the interface on any participating sync nodes.
- </td>
- </tr>
- <tr valign="top">
- <td width="22%" class="vncell">pfsync Synchronize Peer IP</td>
- <td class="vtable">
- <input id='pfsyncpeerip' name='pfsyncpeerip' class='formfld unknown' value='<?= htmlentities($pconfig['pfsyncpeerip']); ?>' />
- <br />
- Setting this option will force pfsync to synchronize its state table to this IP address. The default is directed multicast.
- </td>
- </tr>
- <tr>
- <td>&nbsp;</td>
- </tr>
<tr>
- <td colspan="2" class="listtopic">Configuration Synchronization Settings (XMLRPC Sync)</td>
- </tr>
- <tr valign="top">
- <td width="22%" class="vncell">Synchronize Config to IP</td>
- <td class="vtable">
- <input id='synchronizetoip' name='synchronizetoip' class='formfld unknown' value='<?= htmlentities($pconfig['synchronizetoip']); ?>' />
- <br />
- Enter the IP address of the firewall to which the selected configuration sections should be synchronized.<br />
- <br />
- NOTE: XMLRPC sync is currently only supported over connections using the same protocol and port as this system - make sure the remote system's port and protocol are set accordingly!<br />
- <br />
- NOTE: <b>Do not use the Synchronize Config to IP and password option on backup cluster members!</b>
- </td>
- </tr>
- <tr valign="top">
- <td width="22%" class="vncell">Remote System Username</td>
- <td class="vtable">
- <input id='username' name='username' class='formfld unknown' value='<?= htmlentities($pconfig['username']); ?>' />
- <br />
- Enter the webConfigurator username of the system entered above for synchronizing your configuration.<br />
- <br />
- NOTE: <b>Do not use the Synchronize Config to IP and username option on backup cluster members!</b>
- </td>
- </tr>
- <tr valign="top">
- <td width="22%" class="vncell">Remote System Password</td>
- <td class="vtable">
- <input id='passwordfld' type='password' name='passwordfld' class='formfld pwd' value='<?= htmlentities($pconfig['passwordfld']); ?>' />
- <br />
- Enter the webConfigurator password of the system entered above for synchronizing your configuration.<br />
- <br />
- NOTE: <b>Do not use the Synchronize Config to IP and password option on backup cluster members!</b>
- </td>
- </tr>
- <tr valign="top">
- <td width="22%" class="vncell">Synchronize Users and Groups</td>
- <td class="vtable">
- <input id='synchronizeusers' type='checkbox' name='synchronizeusers' value='on' <?php if ($pconfig['synchronizeusers'] === "on") echo "checked='checked'"; ?> />
- <br />
- When this option is enabled, this system will automatically sync the users and groups over to the other HA host when changes are made.
- </td>
- </tr>
- <tr valign="top">
- <td width="22%" class="vncell">Synchronize Auth Servers</td>
- <td class="vtable">
- <input id='synchronizeauthservers' type='checkbox' name='synchronizeauthservers' value='on' <?php if ($pconfig['synchronizeauthservers'] === "on") echo "checked='checked'"; ?> />
- <br />
- When this option is enabled, this system will automatically sync the authentication servers (e.g. LDAP, RADIUS) over to the other HA host when changes are made.
- </td>
- </tr>
- <tr valign="top">
- <td width="22%" class="vncell">Synchronize Certificates</td>
- <td class="vtable">
- <input id='synchronizecerts' type='checkbox' name='synchronizecerts' value='on' <?php if ($pconfig['synchronizecerts'] === "on") echo "checked='checked'"; ?> />
- <br />
- When this option is enabled, this system will automatically sync the Certificate Authorities, Certificates, and Certificate Revocation Lists over to the other HA host when changes are made.
- </td>
- </tr>
- <tr valign="top">
- <td width="22%" class="vncell">Synchronize rules</td>
- <td class="vtable">
- <input id='synchronizerules' type='checkbox' name='synchronizerules' value='on' <?php if ($pconfig['synchronizerules'] === "on") echo "checked='checked'"; ?> />
- <br />
- When this option is enabled, this system will automatically sync the firewall rules to the other HA host when changes are made.
- </td>
- </tr>
- <tr valign="top">
- <td width="22%" class="vncell">Synchronize Firewall Schedules</td>
- <td class="vtable">
- <input id='synchronizeschedules' type='checkbox' name='synchronizeschedules' value='on' <?php if ($pconfig['synchronizeschedules'] === "on") echo "checked='checked'"; ?> />
- <br />
- When this option is enabled, this system will automatically sync the firewall schedules to the other HA host when changes are made.
- </td>
- </tr>
- <tr valign="top">
- <td width="22%" class="vncell">Synchronize aliases</td>
- <td class="vtable">
- <input id='synchronizealiases' type='checkbox' name='synchronizealiases' value='on' <?php if ($pconfig['synchronizealiases'] === "on") echo "checked='checked'"; ?> />
- <br />
- When this option is enabled, this system will automatically sync the aliases over to the other HA host when changes are made.
- </td>
- </tr>
- <tr valign="top">
- <td width="22%" class="vncell">Synchronize NAT</td>
- <td class="vtable">
- <input id='synchronizenat' type='checkbox' name='synchronizenat' value='on' <?php if ($pconfig['synchronizenat'] === "on") echo "checked='checked'"; ?> />
- <br />
- When this option is enabled, this system will automatically sync the NAT rules over to the other HA host when changes are made.
+ <td id="mainarea">
+ <div class="tabcont">
+ <table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0" summary="main area">
+ <tr>
+ <td colspan="2" class="listtopic">State Synchronization Settings (pfsync)</td>
+ </tr>
+ <tr valign="top">
+ <td width="22%" class="vncell">Synchronize States</td>
+ <td class="vtable">
+ <input id='pfsyncenabled' type='checkbox' name='pfsyncenabled' value='on' <?php if ($pconfig['pfsyncenabled'] === "on") echo "checked='checked'"; ?> />
+ <br />
+ pfsync transfers state insertion, update, and deletion messages between firewalls. Each firewall sends these messages out via multicast on a specified interface, using the PFSYNC protocol (IP Protocol 240). It also listens on that interface for similar messages from other firewalls, and imports them into the local state table.<p>This setting should be enabled on all members of a failover group.</p><p>NOTE: Clicking save will force a configuration sync if it is enabled! (see Configuration Synchronization Settings below)</p>
+ </td>
+ </tr>
+ <tr valign="top">
+ <td width="22%" class="vncell">Synchronize Interface</td>
+ <td class="vtable">
+ <select id='pfsyncinterface' name="pfsyncinterface">
+ <?php foreach ($ifaces as $ifname => $iface) { ?>
+ <?php $selected = ($pconfig['pfsyncinterface'] === $ifname) ? 'selected="selected"' : ''; ?>
+ <option value="<?= htmlentities($ifname); ?>" <?= $selected ?>><?= htmlentities($iface); ?></option>
+ <?php } ?>
+ </select>
+ <br />
+ If Synchronize States is enabled, it will utilize this interface for communication.<br />
+ <b>NOTE:</b> We recommend setting this to a interface other than LAN! A dedicated interface works the best.<br />
+ <b>NOTE:</b> You must define a IP on each machine participating in this failover group.<br />
+ <b>NOTE:</b> You must have an IP assigned to the interface on any participating sync nodes.
+ </td>
+ </tr>
+ <tr valign="top">
+ <td width="22%" class="vncell">pfsync Synchronize Peer IP</td>
+ <td class="vtable">
+ <input id='pfsyncpeerip' name='pfsyncpeerip' class='formfld unknown' value='<?= htmlentities($pconfig['pfsyncpeerip']); ?>' />
+ <br />
+ Setting this option will force pfsync to synchronize its state table to this IP address. The default is directed multicast.
+ </td>
+ </tr>
+ <tr>
+ <td>&nbsp;</td>
+ </tr>
+ <tr>
+ <td colspan="2" class="listtopic">Configuration Synchronization Settings (XMLRPC Sync)</td>
+ </tr>
+ <tr valign="top">
+ <td width="22%" class="vncell">Synchronize Config to IP</td>
+ <td class="vtable">
+ <input id='synchronizetoip' name='synchronizetoip' class='formfld unknown' value='<?= htmlentities($pconfig['synchronizetoip']); ?>' />
+ <br />
+ Enter the IP address of the firewall to which the selected configuration sections should be synchronized.<br />
+ <br />
+ NOTE: XMLRPC sync is currently only supported over connections using the same protocol and port as this system - make sure the remote system's port and protocol are set accordingly!<br />
+ <br />
+ NOTE: <b>Do not use the Synchronize Config to IP and password option on backup cluster members!</b>
+ </td>
+ </tr>
+ <tr valign="top">
+ <td width="22%" class="vncell">Remote System Username</td>
+ <td class="vtable">
+ <input id='username' name='username' class='formfld unknown' value='<?= htmlentities($pconfig['username']); ?>' />
+ <br />
+ Enter the webConfigurator username of the system entered above for synchronizing your configuration.<br />
+ <br />
+ NOTE: <b>Do not use the Synchronize Config to IP and username option on backup cluster members!</b>
+ </td>
+ </tr>
+ <tr valign="top">
+ <td width="22%" class="vncell">Remote System Password</td>
+ <td class="vtable">
+ <input id='passwordfld' type='password' name='passwordfld' class='formfld pwd' value='<?= htmlentities($pconfig['passwordfld']); ?>' />
+ <br />
+ Enter the webConfigurator password of the system entered above for synchronizing your configuration.<br />
+ <br />
+ NOTE: <b>Do not use the Synchronize Config to IP and password option on backup cluster members!</b>
+ </td>
+ </tr>
+ <tr valign="top">
+ <td width="22%" class="vncell">Synchronize Users and Groups</td>
+ <td class="vtable">
+ <input id='synchronizeusers' type='checkbox' name='synchronizeusers' value='on' <?php if ($pconfig['synchronizeusers'] === "on") echo "checked='checked'"; ?> />
+ <br />
+ When this option is enabled, this system will automatically sync the users and groups over to the other HA host when changes are made.
+ </td>
+ </tr>
+ <tr valign="top">
+ <td width="22%" class="vncell">Synchronize Auth Servers</td>
+ <td class="vtable">
+ <input id='synchronizeauthservers' type='checkbox' name='synchronizeauthservers' value='on' <?php if ($pconfig['synchronizeauthservers'] === "on") echo "checked='checked'"; ?> />
+ <br />
+ When this option is enabled, this system will automatically sync the authentication servers (e.g. LDAP, RADIUS) over to the other HA host when changes are made.
+ </td>
+ </tr>
+ <tr valign="top">
+ <td width="22%" class="vncell">Synchronize Certificates</td>
+ <td class="vtable">
+ <input id='synchronizecerts' type='checkbox' name='synchronizecerts' value='on' <?php if ($pconfig['synchronizecerts'] === "on") echo "checked='checked'"; ?> />
+ <br />
+ When this option is enabled, this system will automatically sync the Certificate Authorities, Certificates, and Certificate Revocation Lists over to the other HA host when changes are made.
+ </td>
+ </tr>
+ <tr valign="top">
+ <td width="22%" class="vncell">Synchronize rules</td>
+ <td class="vtable">
+ <input id='synchronizerules' type='checkbox' name='synchronizerules' value='on' <?php if ($pconfig['synchronizerules'] === "on") echo "checked='checked'"; ?> />
+ <br />
+ When this option is enabled, this system will automatically sync the firewall rules to the other HA host when changes are made.
+ </td>
+ </tr>
+ <tr valign="top">
+ <td width="22%" class="vncell">Synchronize Firewall Schedules</td>
+ <td class="vtable">
+ <input id='synchronizeschedules' type='checkbox' name='synchronizeschedules' value='on' <?php if ($pconfig['synchronizeschedules'] === "on") echo "checked='checked'"; ?> />
+ <br />
+ When this option is enabled, this system will automatically sync the firewall schedules to the other HA host when changes are made.
+ </td>
+ </tr>
+ <tr valign="top">
+ <td width="22%" class="vncell">Synchronize aliases</td>
+ <td class="vtable">
+ <input id='synchronizealiases' type='checkbox' name='synchronizealiases' value='on' <?php if ($pconfig['synchronizealiases'] === "on") echo "checked='checked'"; ?> />
+ <br />
+ When this option is enabled, this system will automatically sync the aliases over to the other HA host when changes are made.
+ </td>
+ </tr>
+ <tr valign="top">
+ <td width="22%" class="vncell">Synchronize NAT</td>
+ <td class="vtable">
+ <input id='synchronizenat' type='checkbox' name='synchronizenat' value='on' <?php if ($pconfig['synchronizenat'] === "on") echo "checked='checked'"; ?> />
+ <br />
+ When this option is enabled, this system will automatically sync the NAT rules over to the other HA host when changes are made.
+ </td>
+ </tr>
+ <tr valign="top">
+ <td width="22%" class="vncell">Synchronize IPsec</td>
+ <td class="vtable">
+ <input id='synchronizeipsec' type='checkbox' name='synchronizeipsec' value='on' <?php if ($pconfig['synchronizeipsec'] === "on") echo "checked='checked'"; ?> />
+ <br />
+ When this option is enabled, this system will automatically sync the IPsec configuration to the other HA host when changes are made.
+ </td>
+ </tr>
+ <tr valign="top">
+ <td width="22%" class="vncell">Synchronize OpenVPN</td>
+ <td class="vtable">
+ <input id='synchronizeopenvpn' type='checkbox' name='synchronizeopenvpn' value='on' <?php if ($pconfig['synchronizeopenvpn'] === "on") echo "checked='checked'"; ?> />
+ <br />
+ When this option is enabled, this system will automatically sync the OpenVPN configuration to the other HA host when changes are made. Using this option implies "Synchronize Certificates" as they are required for OpenVPN.
+ </td>
+ </tr>
+ <tr valign="top">
+ <td width="22%" class="vncell">Synchronize DHCPD</td>
+ <td class="vtable">
+ <input id='synchronizedhcpd' type='checkbox' name='synchronizedhcpd' value='on' <?php if ($pconfig['synchronizedhcpd'] === "on") echo "checked='checked'"; ?> />
+ <br />
+ When this option is enabled, this system will automatically sync the DHCP Server settings over to the other HA host when changes are made. This only applies to DHCP for IPv4.
+ </td>
+ </tr>
+ <tr valign="top">
+ <td width="22%" class="vncell">Synchronize Wake on LAN</td>
+ <td class="vtable">
+ <input id='synchronizewol' type='checkbox' name='synchronizewol' value='on' <?php if ($pconfig['synchronizewol'] === "on") echo "checked='checked'"; ?> />
+ <br />
+ When this option is enabled, this system will automatically sync the WoL configuration to the other HA host when changes are made.
+ </td>
+ </tr>
+ <tr valign="top">
+ <td width="22%" class="vncell">Synchronize Static Routes</td>
+ <td class="vtable">
+ <input id='synchronizestaticroutes' type='checkbox' name='synchronizestaticroutes' value='on' <?php if ($pconfig['synchronizestaticroutes'] === "on") echo "checked='checked'"; ?> />
+ <br />
+ When this option is enabled, this system will automatically sync the Static Route configuration to the other HA host when changes are made.
+ </td>
+ </tr>
+ <tr valign="top">
+ <td width="22%" class="vncell">Synchronize Load Balancer</td>
+ <td class="vtable">
+ <input id='synchronizelb' type='checkbox' name='synchronizelb' value='on' <?php if ($pconfig['synchronizelb'] === "on") echo "checked='checked'"; ?> />
+ <br />
+ When this option is enabled, this system will automatically sync the Load Balancer configuration to the other HA host when changes are made.
+ </td>
+ </tr>
+ <tr valign="top">
+ <td width="22%" class="vncell">Synchronize Virtual IPs</td>
+ <td class="vtable">
+ <input id='synchronizevirtualip' type='checkbox' name='synchronizevirtualip' value='on' <?php if ($pconfig['synchronizevirtualip'] === "on") echo "checked='checked'"; ?> />
+ <br />
+ When this option is enabled, this system will automatically sync the CARP Virtual IPs to the other HA host when changes are made.
+ </td>
+ </tr>
+ <tr valign="top">
+ <td width="22%" class="vncell">Synchronize traffic shaper(queues)</td>
+ <td class="vtable">
+ <input id='synchronizetrafficshaper' type='checkbox' name='synchronizetrafficshaper' value='on' <?php if ($pconfig['synchronizetrafficshaper'] === "on") echo "checked='checked'"; ?> />
+ <br />
+ When this option is enabled, this system will automatically sync the traffic shaper configuration for queues to the other HA host when changes are made.
+ </td>
+ </tr>
+ <tr valign="top">
+ <td width="22%" class="vncell">Synchronize traffic shaper(limiter)</td>
+ <td class="vtable">
+ <input id='synchronizetrafficshaperlimiter' type='checkbox' name='synchronizetrafficshaperlimiter' value='on' <?php if ($pconfig['synchronizetrafficshaperlimiter'] === "on") echo "checked='checked'"; ?> />
+ <br />
+ When this option is enabled, this system will automatically sync the traffic shaper configuration for limiters to the other HA host when changes are made.
+ </td>
+ </tr>
+ <tr valign="top">
+ <td width="22%" class="vncell">Synchronize traffic shaper(layer7)</td>
+ <td class="vtable">
+ <input id='synchronizetrafficshaperlayer7' type='checkbox' name='synchronizetrafficshaperlayer7' value='on' <?php if ($pconfig['synchronizetrafficshaperlayer7'] === "on") echo "checked='checked'"; ?> />
+ <br />
+ When this option is enabled, this system will automatically sync the traffic shaper configuration for layer7 to the other HA host when changes are made.
+ </td>
+ </tr>
+ <tr valign="top">
+ <td width="22%" class="vncell">Synchronize DNS Forwarder / Resolver</td>
+ <td class="vtable">
+ <input id='synchronizednsforwarder' type='checkbox' name='synchronizednsforwarder' value='on' <?php if ($pconfig['synchronizednsforwarder'] === "on") echo "checked='checked'"; ?> />
+ <br />
+ When this option is enabled, this system will automatically sync the DNS Forwarder and DNS Resolver configuration to the other HA host when changes are made.
+ </td>
+ </tr>
+ <tr valign="top">
+ <td width="22%" class="vncell">Synchronize Captive Portal</td>
+ <td class="vtable">
+ <input id='synchronizecaptiveportal' type='checkbox' name='synchronizecaptiveportal' value='on' <?php if ($pconfig['synchronizecaptiveportal'] === "on") echo "checked='checked'"; ?> />
+ <br />
+ When this option is enabled, this system will automatically sync the Captive Portal configuration to the other HA host when changes are made.
+ </td>
+ </tr>
+ <tr>
+ <td>&nbsp;</td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top">&nbsp;</td>
+ <td width="78%">
+ <input name="id" type="hidden" value="0" />
+ <input name="Submit" type="submit" class="formbtn" value="Save" />
+ <input type="button" class="formbtn" value="<?=gettext("Cancel");?>" onclick="window.location.href='<?=$referer;?>'" />
+ </td>
+ </tr>
+ </table>
+ </div>
</td>
</tr>
- <tr valign="top">
- <td width="22%" class="vncell">Synchronize IPsec</td>
- <td class="vtable">
- <input id='synchronizeipsec' type='checkbox' name='synchronizeipsec' value='on' <?php if ($pconfig['synchronizeipsec'] === "on") echo "checked='checked'"; ?> />
- <br />
- When this option is enabled, this system will automatically sync the IPsec configuration to the other HA host when changes are made.
- </td>
- </tr>
- <tr valign="top">
- <td width="22%" class="vncell">Synchronize OpenVPN</td>
- <td class="vtable">
- <input id='synchronizeopenvpn' type='checkbox' name='synchronizeopenvpn' value='on' <?php if ($pconfig['synchronizeopenvpn'] === "on") echo "checked='checked'"; ?> />
- <br />
- When this option is enabled, this system will automatically sync the OpenVPN configuration to the other HA host when changes are made. Using this option implies "Synchronize Certificates" as they are required for OpenVPN.
- </td>
- </tr>
- <tr valign="top">
- <td width="22%" class="vncell">Synchronize DHCPD</td>
- <td class="vtable">
- <input id='synchronizedhcpd' type='checkbox' name='synchronizedhcpd' value='on' <?php if ($pconfig['synchronizedhcpd'] === "on") echo "checked='checked'"; ?> />
- <br />
- When this option is enabled, this system will automatically sync the DHCP Server settings over to the other HA host when changes are made. This only applies to DHCP for IPv4.
- </td>
- </tr>
- <tr valign="top">
- <td width="22%" class="vncell">Synchronize Wake on LAN</td>
- <td class="vtable">
- <input id='synchronizewol' type='checkbox' name='synchronizewol' value='on' <?php if ($pconfig['synchronizewol'] === "on") echo "checked='checked'"; ?> />
- <br />
- When this option is enabled, this system will automatically sync the WoL configuration to the other HA host when changes are made.
- </td>
- </tr>
- <tr valign="top">
- <td width="22%" class="vncell">Synchronize Static Routes</td>
- <td class="vtable">
- <input id='synchronizestaticroutes' type='checkbox' name='synchronizestaticroutes' value='on' <?php if ($pconfig['synchronizestaticroutes'] === "on") echo "checked='checked'"; ?> />
- <br />
- When this option is enabled, this system will automatically sync the Static Route configuration to the other HA host when changes are made.
- </td>
- </tr>
- <tr valign="top">
- <td width="22%" class="vncell">Synchronize Load Balancer</td>
- <td class="vtable">
- <input id='synchronizelb' type='checkbox' name='synchronizelb' value='on' <?php if ($pconfig['synchronizelb'] === "on") echo "checked='checked'"; ?> />
- <br />
- When this option is enabled, this system will automatically sync the Load Balancer configuration to the other HA host when changes are made.
- </td>
- </tr>
- <tr valign="top">
- <td width="22%" class="vncell">Synchronize Virtual IPs</td>
- <td class="vtable">
- <input id='synchronizevirtualip' type='checkbox' name='synchronizevirtualip' value='on' <?php if ($pconfig['synchronizevirtualip'] === "on") echo "checked='checked'"; ?> />
- <br />
- When this option is enabled, this system will automatically sync the CARP Virtual IPs to the other HA host when changes are made.
- </td>
- </tr>
- <tr valign="top">
- <td width="22%" class="vncell">Synchronize traffic shaper(queues)</td>
- <td class="vtable">
- <input id='synchronizetrafficshaper' type='checkbox' name='synchronizetrafficshaper' value='on' <?php if ($pconfig['synchronizetrafficshaper'] === "on") echo "checked='checked'"; ?> />
- <br />
- When this option is enabled, this system will automatically sync the traffic shaper configuration for queues to the other HA host when changes are made.
- </td>
- </tr>
- <tr valign="top">
- <td width="22%" class="vncell">Synchronize traffic shaper(limiter)</td>
- <td class="vtable">
- <input id='synchronizetrafficshaperlimiter' type='checkbox' name='synchronizetrafficshaperlimiter' value='on' <?php if ($pconfig['synchronizetrafficshaperlimiter'] === "on") echo "checked='checked'"; ?> />
- <br />
- When this option is enabled, this system will automatically sync the traffic shaper configuration for limiters to the other HA host when changes are made.
- </td>
- </tr>
- <tr valign="top">
- <td width="22%" class="vncell">Synchronize traffic shaper(layer7)</td>
- <td class="vtable">
- <input id='synchronizetrafficshaperlayer7' type='checkbox' name='synchronizetrafficshaperlayer7' value='on' <?php if ($pconfig['synchronizetrafficshaperlayer7'] === "on") echo "checked='checked'"; ?> />
- <br />
- When this option is enabled, this system will automatically sync the traffic shaper configuration for layer7 to the other HA host when changes are made.
- </td>
- </tr>
- <tr valign="top">
- <td width="22%" class="vncell">Synchronize DNS Forwarder / Resolver</td>
- <td class="vtable">
- <input id='synchronizednsforwarder' type='checkbox' name='synchronizednsforwarder' value='on' <?php if ($pconfig['synchronizednsforwarder'] === "on") echo "checked='checked'"; ?> />
- <br />
- When this option is enabled, this system will automatically sync the DNS Forwarder and DNS Resolver configuration to the other HA host when changes are made.
- </td>
- </tr>
- <tr valign="top">
- <td width="22%" class="vncell">Synchronize Captive Portal</td>
- <td class="vtable">
- <input id='synchronizecaptiveportal' type='checkbox' name='synchronizecaptiveportal' value='on' <?php if ($pconfig['synchronizecaptiveportal'] === "on") echo "checked='checked'"; ?> />
- <br />
- When this option is enabled, this system will automatically sync the Captive Portal configuration to the other HA host when changes are made.
- </td>
- </tr>
- <tr>
- <td>&nbsp;</td>
- </tr>
- <tr>
- <td width="22%" valign="top">&nbsp;</td>
- <td width="78%">
- <input name="id" type="hidden" value="0" />
- <input name="Submit" type="submit" class="formbtn" value="Save" />
- <input type="button" class="formbtn" value="<?=gettext("Cancel");?>" onclick="window.location.href='<?=$referer;?>'" />
- </td>
- </tr>
- </table>
-
-</div>
-</td>
-</tr>
</table>
</form>
<?php include("fend.inc"); ?>
diff --git a/usr/local/www/system_routes.php b/usr/local/www/system_routes.php
index 2e037cd..a001444 100644
--- a/usr/local/www/system_routes.php
+++ b/usr/local/www/system_routes.php
@@ -46,8 +46,9 @@ require_once("functions.inc");
require_once("filter.inc");
require_once("shaper.inc");
-if (!is_array($config['staticroutes']['route']))
+if (!is_array($config['staticroutes']['route'])) {
$config['staticroutes']['route'] = array();
+}
$a_routes = &$config['staticroutes']['route'];
$a_gateways = return_gateways_array(true, true, true);
@@ -63,8 +64,9 @@ if ($_POST) {
if (file_exists("{$g['tmp_path']}/.system_routes.apply")) {
$toapplylist = unserialize(file_get_contents("{$g['tmp_path']}/.system_routes.apply"));
- foreach ($toapplylist as $toapply)
+ foreach ($toapplylist as $toapply) {
mwexec("{$toapply}");
+ }
@unlink("{$g['tmp_path']}/.system_routes.apply");
}
@@ -75,26 +77,30 @@ if ($_POST) {
setup_gateways_monitor();
$savemsg = get_std_save_message($retval);
- if ($retval == 0)
+ if ($retval == 0) {
clear_subsystem_dirty('staticroutes');
+ }
}
}
function delete_static_route($id) {
global $config, $a_routes, $changedesc_prefix;
- if (!isset($a_routes[$id]))
+ if (!isset($a_routes[$id])) {
return;
+ }
$targets = array();
if (is_alias($a_routes[$id]['network'])) {
foreach (filter_expand_alias_array($a_routes[$id]['network']) as $tgt) {
- if (is_ipaddrv4($tgt))
+ if (is_ipaddrv4($tgt)) {
$tgt .= "/32";
- else if (is_ipaddrv6($tgt))
+ } else if (is_ipaddrv6($tgt)) {
$tgt .= "/128";
- if (!is_subnet($tgt))
+ }
+ if (!is_subnet($tgt)) {
continue;
+ }
$targets[] = $tgt;
}
} else {
@@ -136,7 +142,7 @@ if (isset($_POST['del_x'])) {
} else if ($_GET['act'] == "toggle") {
if ($a_routes[$_GET['id']]) {
- if(isset($a_routes[$_GET['id']]['disabled'])) {
+ if (isset($a_routes[$_GET['id']]['disabled'])) {
unset($a_routes[$_GET['id']]['disabled']);
$changedesc = $changedesc_prefix . gettext("enabled route to") . " " . $a_routes[$id]['network'];
} else {
@@ -145,8 +151,9 @@ if (isset($_POST['del_x'])) {
$changedesc = $changedesc_prefix . gettext("disabled route to") . " " . $a_routes[$id]['network'];
}
- if (write_config($changedesc))
+ if (write_config($changedesc)) {
mark_subsystem_dirty('staticroutes');
+ }
header("Location: system_routes.php");
exit;
}
@@ -165,38 +172,45 @@ if (isset($_POST['del_x'])) {
/* copy all routes < $movebtn and not selected */
for ($i = 0; $i < $movebtn; $i++) {
- if (!in_array($i, $_POST['route']))
+ if (!in_array($i, $_POST['route'])) {
$a_routes_new[] = $a_routes[$i];
+ }
}
/* copy all selected routes */
for ($i = 0; $i < count($a_routes); $i++) {
- if ($i == $movebtn)
+ if ($i == $movebtn) {
continue;
- if (in_array($i, $_POST['route']))
+ }
+ if (in_array($i, $_POST['route'])) {
$a_routes_new[] = $a_routes[$i];
+ }
}
/* copy $movebtn route */
- if ($movebtn < count($a_routes))
+ if ($movebtn < count($a_routes)) {
$a_routes_new[] = $a_routes[$movebtn];
+ }
/* copy all routes > $movebtn and not selected */
for ($i = $movebtn+1; $i < count($a_routes); $i++) {
- if (!in_array($i, $_POST['route']))
+ if (!in_array($i, $_POST['route'])) {
$a_routes_new[] = $a_routes[$i];
+ }
}
- if (count($a_routes_new) > 0)
+ if (count($a_routes_new) > 0) {
$a_routes = $a_routes_new;
+ }
- if (write_config())
+ if (write_config()) {
mark_subsystem_dirty('staticroutes');
+ }
header("Location: system_routes.php");
exit;
}
}
-$pgtitle = array(gettext("System"),gettext("Static Routes"));
+$pgtitle = array(gettext("System"), gettext("Static Routes"));
$shortcut_section = "routing";
include("head.inc");
@@ -244,7 +258,10 @@ include("head.inc");
</table>
</td>
</tr>
- <?php $i = 0; foreach ($a_routes as $route): ?>
+ <?php
+ $i = 0;
+ foreach ($a_routes as $route):
+ ?>
<tr valign="top" id="fr<?=$i;?>">
<?php
$iconfn = "pass";
@@ -252,8 +269,9 @@ include("head.inc");
$textss = "<span class=\"gray\">";
$textse = "</span>";
$iconfn .= "_d";
- } else
+ } else {
$textss = $textse = "";
+ }
?>
<td class="listt">
<input type="checkbox" id="frc<?=$i;?>" name="route[]" value="<?=$i;?>" onclick="fr_bgcolor('<?=$i;?>')" style="margin: 0; padding: 0; width: 15px; height: 15px;" />
@@ -314,7 +332,10 @@ include("head.inc");
</table>
</td>
</tr>
- <?php $i++; endforeach; ?>
+ <?php
+ $i++;
+ endforeach;
+ ?>
<tr>
<td class="list" colspan="6"></td>
<td class="list nowrap" valign="middle">
diff --git a/usr/local/www/system_routes_edit.php b/usr/local/www/system_routes_edit.php
index 43de326..81a821d 100644
--- a/usr/local/www/system_routes_edit.php
+++ b/usr/local/www/system_routes_edit.php
@@ -47,30 +47,35 @@ require_once("gwlb.inc");
$referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/system_routes.php');
-if (!is_array($config['staticroutes']['route']))
+if (!is_array($config['staticroutes']['route'])) {
$config['staticroutes']['route'] = array();
+}
$a_routes = &$config['staticroutes']['route'];
$a_gateways = return_gateways_array(true, true);
-if (is_numericint($_GET['id']))
+if (is_numericint($_GET['id'])) {
$id = $_GET['id'];
-if (isset($_POST['id']) && is_numericint($_POST['id']))
+}
+if (isset($_POST['id']) && is_numericint($_POST['id'])) {
$id = $_POST['id'];
+}
-if (isset($_GET['dup']) && is_numericint($_GET['dup']))
+if (isset($_GET['dup']) && is_numericint($_GET['dup'])) {
$id = $_GET['dup'];
+}
if (isset($id) && $a_routes[$id]) {
- list($pconfig['network'],$pconfig['network_subnet']) =
+ list($pconfig['network'], $pconfig['network_subnet']) =
explode('/', $a_routes[$id]['network']);
$pconfig['gateway'] = $a_routes[$id]['gateway'];
$pconfig['descr'] = $a_routes[$id]['descr'];
$pconfig['disabled'] = isset($a_routes[$id]['disabled']);
}
-if (isset($_GET['dup']) && is_numericint($_GET['dup']))
+if (isset($_GET['dup']) && is_numericint($_GET['dup'])) {
unset($id);
+}
if ($_POST) {
@@ -82,9 +87,9 @@ if ($_POST) {
/* input validation */
$reqdfields = explode(" ", "network network_subnet gateway");
$reqdfieldsn = explode(",",
- gettext("Destination network") . "," .
- gettext("Destination network bit count") . "," .
- gettext("Gateway"));
+ gettext("Destination network") . "," .
+ gettext("Destination network bit count") . "," .
+ gettext("Gateway"));
do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
@@ -95,53 +100,62 @@ if ($_POST) {
$input_errors[] = gettext("A valid destination network bit count must be specified.");
}
if (($_POST['gateway']) && is_ipaddr($_POST['network'])) {
- if (!isset($a_gateways[$_POST['gateway']]))
+ if (!isset($a_gateways[$_POST['gateway']])) {
$input_errors[] = gettext("A valid gateway must be specified.");
- if(!validate_address_family($_POST['network'], $_POST['gateway']))
+ }
+ if (!validate_address_family($_POST['network'], $_POST['gateway'])) {
$input_errors[] = gettext("The gateway '{$a_gateways[$_POST['gateway']]['gateway']}' is a different Address Family as network '{$_POST['network']}'.");
+ }
}
/* check for overlaps */
$current_targets = get_staticroutes(true);
$new_targets = array();
- if(is_ipaddrv6($_POST['network'])) {
+ if (is_ipaddrv6($_POST['network'])) {
$osn = gen_subnetv6($_POST['network'], $_POST['network_subnet']) . "/" . $_POST['network_subnet'];
$new_targets[] = $osn;
}
if (is_ipaddrv4($_POST['network'])) {
- if($_POST['network_subnet'] > 32)
+ if ($_POST['network_subnet'] > 32) {
$input_errors[] = gettext("A IPv4 subnet can not be over 32 bits.");
- else {
+ } else {
$osn = gen_subnet($_POST['network'], $_POST['network_subnet']) . "/" . $_POST['network_subnet'];
$new_targets[] = $osn;
}
} elseif (is_alias($_POST['network'])) {
$osn = $_POST['network'];
foreach (preg_split('/\s+/', $aliastable[$osn]) as $tgt) {
- if (is_ipaddrv4($tgt))
+ if (is_ipaddrv4($tgt)) {
$tgt .= "/32";
- if (is_ipaddrv6($tgt))
+ }
+ if (is_ipaddrv6($tgt)) {
$tgt .= "/128";
- if (!is_subnet($tgt))
+ }
+ if (!is_subnet($tgt)) {
continue;
- if (!is_subnetv6($tgt))
+ }
+ if (!is_subnetv6($tgt)) {
continue;
+ }
$new_targets[] = $tgt;
}
}
- if (!isset($id))
+ if (!isset($id)) {
$id = count($a_routes);
+ }
$oroute = $a_routes[$id];
$old_targets = array();
if (!empty($oroute)) {
if (is_alias($oroute['network'])) {
foreach (filter_expand_alias_array($oroute['network']) as $tgt) {
- if (is_ipaddrv4($tgt))
+ if (is_ipaddrv4($tgt)) {
$tgt .= "/32";
- else if (is_ipaddrv6($tgt))
+ } else if (is_ipaddrv6($tgt)) {
$tgt .= "/128";
- if (!is_subnet($tgt))
+ }
+ if (!is_subnet($tgt)) {
continue;
+ }
$old_targets[] = $tgt;
}
} else {
@@ -157,19 +171,19 @@ if ($_POST) {
if (is_array($config['interfaces'])) {
foreach ($config['interfaces'] as $if) {
- if (is_ipaddrv4($_POST['network'])
- && isset($if['ipaddr']) && isset($if['subnet'])
- && is_ipaddrv4($if['ipaddr']) && is_numeric($if['subnet'])
- && ($_POST['network_subnet'] == $if['subnet'])
- && (gen_subnet($_POST['network'], $_POST['network_subnet']) == gen_subnet($if['ipaddr'], $if['subnet'])))
+ if (is_ipaddrv4($_POST['network']) &&
+ isset($if['ipaddr']) && isset($if['subnet']) &&
+ is_ipaddrv4($if['ipaddr']) && is_numeric($if['subnet']) &&
+ ($_POST['network_subnet'] == $if['subnet']) &&
+ (gen_subnet($_POST['network'], $_POST['network_subnet']) == gen_subnet($if['ipaddr'], $if['subnet']))) {
$input_errors[] = sprintf(gettext("This network conflicts with address configured on interface %s."), $if['descr']);
-
- else if (is_ipaddrv6($_POST['network'])
- && isset($if['ipaddrv6']) && isset($if['subnetv6'])
- && is_ipaddrv6($if['ipaddrv6']) && is_numeric($if['subnetv6'])
- && ($_POST['network_subnet'] == $if['subnetv6'])
- && (gen_subnetv6($_POST['network'], $_POST['network_subnet']) == gen_subnetv6($if['ipaddrv6'], $if['subnetv6'])))
+ } else if (is_ipaddrv6($_POST['network']) &&
+ isset($if['ipaddrv6']) && isset($if['subnetv6']) &&
+ is_ipaddrv6($if['ipaddrv6']) && is_numeric($if['subnetv6']) &&
+ ($_POST['network_subnet'] == $if['subnetv6']) &&
+ (gen_subnetv6($_POST['network'], $_POST['network_subnet']) == gen_subnetv6($if['ipaddrv6'], $if['subnetv6']))) {
$input_errors[] = sprintf(gettext("This network conflicts with address configured on interface %s."), $if['descr']);
+ }
}
}
@@ -178,25 +192,29 @@ if ($_POST) {
$route['network'] = $osn;
$route['gateway'] = $_POST['gateway'];
$route['descr'] = $_POST['descr'];
- if ($_POST['disabled'])
+ if ($_POST['disabled']) {
$route['disabled'] = true;
- else
+ } else {
unset($route['disabled']);
+ }
- if (file_exists("{$g['tmp_path']}/.system_routes.apply"))
+ if (file_exists("{$g['tmp_path']}/.system_routes.apply")) {
$toapplylist = unserialize(file_get_contents("{$g['tmp_path']}/.system_routes.apply"));
- else
+ } else {
$toapplylist = array();
+ }
$a_routes[$id] = $route;
if (!empty($oroute)) {
$delete_targets = array_diff($old_targets, $new_targets);
- if (count($delete_targets))
+ if (count($delete_targets)) {
foreach ($delete_targets as $dts) {
- if(is_ipaddrv6($dts))
+ if (is_ipaddrv6($dts)) {
$family = "-inet6";
+ }
$toapplylist[] = "/sbin/route delete {$family} {$dts}";
}
+ }
}
file_put_contents("{$g['tmp_path']}/.system_routes.apply", serialize($toapplylist));
@@ -209,7 +227,7 @@ if ($_POST) {
}
}
-$pgtitle = array(gettext("System"),gettext("Static Routes"),gettext("Edit route"));
+$pgtitle = array(gettext("System"), gettext("Static Routes"), gettext("Edit route"));
$shortcut_section = "routing";
include("head.inc");
?>
@@ -247,8 +265,9 @@ include("head.inc");
<?php
foreach ($a_gateways as $gateway) {
echo "<option value='{$gateway['name']}' ";
- if ($gateway['name'] == $pconfig['gateway'])
+ if ($gateway['name'] == $pconfig['gateway']) {
echo "selected=\"selected\"";
+ }
echo ">" . htmlspecialchars($gateway['name']) . " - " . htmlspecialchars($gateway['gateway']) . "</option>\n";
}
?>
@@ -278,8 +297,9 @@ include("head.inc");
<td>
<select name="addinterfacegw" id="addinterfacegw">
<?php $gwifs = get_configured_interface_with_descr();
- foreach($gwifs as $fif => $dif)
+ foreach ($gwifs as $fif => $dif) {
echo "<option value=\"{$fif}\">{$dif}</option>\n";
+ }
?>
</select>
</td>
@@ -370,8 +390,9 @@ include("head.inc");
gatewayip = jQuery('#gatewayip').val();
addrtype = jQuery('#addrtype').val();
var defaultgw = '';
- if (jQuery('#defaultgw').checked)
+ if (jQuery('#defaultgw').checked) {
defaultgw = 'yes';
+ }
var url = "system_gateways_edit.php";
var pars = 'isAjax=true&defaultgw=' + escape(defaultgw) + '&interface=' + escape(iface) + '&name=' + escape(name) + '&descr=' + escape(descr) + '&gateway=' + escape(gatewayip) + '&type=' + escape(addrtype);
jQuery.ajax(
@@ -383,13 +404,12 @@ include("head.inc");
complete: save_callback
});
}
- function addOption(selectbox,text,value)
- {
+ function addOption(selectbox, text, value) {
var optn = document.createElement("OPTION");
optn.text = text;
optn.value = value;
selectbox.append(optn);
- selectbox.prop('selectedIndex',selectbox.children('option').length-1);
+ selectbox.prop('selectedIndex', selectbox.children('option').length-1);
jQuery('#notebox').html("<p><strong><?=gettext("NOTE:");?><\/strong> <?php printf(gettext("You can manage Gateways %shere%s."), "<a target='_blank' href='system_gateways.php'>", "<\/a>");?> <\/strong><\/p>");
}
function report_failure() {
OpenPOWER on IntegriCloud