system_advanced_firewall.php 34.5 KB
Newer Older
Ad Schellevis's avatar
Ad Schellevis committed
1
<?php
2

Ad Schellevis's avatar
Ad Schellevis committed
3
/*
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
    Copyright (C) 2014-2015 Deciso B.V.
    Copyright (C) 2005-2007 Scott Ullrich
    Copyright (C) 2008 Shrew Soft Inc
    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
    AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
    OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
    SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
    INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
    CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
    ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
    POSSIBILITY OF SUCH DAMAGE.
Ad Schellevis's avatar
Ad Schellevis committed
30 31
*/

32
require_once("guiconfig.inc");
Ad Schellevis's avatar
Ad Schellevis committed
33
require_once("filter.inc");
34
require_once("services.inc");
35
require_once("system.inc");
Ad Schellevis's avatar
Ad Schellevis committed
36

37 38
function default_table_entries_size()
{
39 40
    $current = `pfctl -sm | grep table-entries | awk '{print $4};'`;
    return $current;
41 42
}

43 44
if ($_SERVER['REQUEST_METHOD'] === 'GET') {
    $pconfig = array();
45
    $pconfig['ipv6allow'] = isset($config['system']['ipv6allow']);
46 47 48 49 50 51 52 53 54 55
    $pconfig['disablefilter'] = !empty($config['system']['disablefilter']);
    $pconfig['optimization'] = isset($config['system']['optimization']) ? $config['system']['optimization'] : "normal";
    $pconfig['maximumstates'] = isset($config['system']['maximumstates']) ? $config['system']['maximumstates'] : null;
    $pconfig['adaptivestart'] = isset($config['system']['adaptivestart']) ? $config['system']['adaptivestart'] : null;
    $pconfig['adaptiveend'] = isset($config['system']['adaptiveend']) ? $config['system']['adaptiveend'] : null;
    $pconfig['aliasesresolveinterval'] = isset($config['system']['aliasesresolveinterval']) ? $config['system']['aliasesresolveinterval'] : null;
    $pconfig['checkaliasesurlcert'] = isset($config['system']['checkaliasesurlcert']);
    $pconfig['maximumtableentries'] = !empty($config['system']['maximumtableentries']) ? $config['system']['maximumtableentries'] : null ;
    $pconfig['disablereplyto'] = isset($config['system']['disablereplyto']);
    $pconfig['bogonsinterval'] = !empty($config['system']['bogons']['interval']) ? $config['system']['bogons']['interval'] : null;
56
    $pconfig['schedule_states'] = isset($config['system']['schedule_states']);
57 58
    $pconfig['kill_states'] = isset($config['system']['kill_states']);
    $pconfig['skip_rules_gw_down'] = isset($config['system']['skip_rules_gw_down']);
59 60
    $pconfig['lb_use_sticky'] = isset($config['system']['lb_use_sticky']);
    $pconfig['srctrack'] = !empty($config['system']['srctrack']) ? $config['system']['srctrack'] : null;
61
    if (!isset($config['system']['disablenatreflection'])) {
62 63 64 65 66 67 68 69 70
        $pconfig['natreflection'] = "purenat";
    } else {
        $pconfig['natreflection'] = "disable";
    }
    $pconfig['enablebinatreflection'] = !empty($config['system']['enablebinatreflection']);
    $pconfig['enablenatreflectionhelper'] = isset($config['system']['enablenatreflectionhelper']) ? $config['system']['enablenatreflectionhelper'] : null;
    $pconfig['bypassstaticroutes'] = isset($config['filter']['bypassstaticroutes']);
    $pconfig['disablevpnrules'] = isset($config['system']['disablevpnrules']);
} elseif ($_SERVER['REQUEST_METHOD'] === 'POST') {
71
    $pconfig = $_POST;
72 73
    $old_aliasesresolveinterval = $config['system']['aliasesresolveinterval'];
    $input_errors = array();
74 75

    /* input validation */
76
    if ((empty($pconfig['adaptivestart']) && !empty($pconfig['adaptiveend'])) || (!empty($pconfig['adaptivestart']) && empty($pconfig['adaptiveend']))) {
77 78
        $input_errors[] = gettext("The Firewall Adaptive values must be set together.");
    }
79
    if (!empty($pconfig['adaptivestart']) && !is_numericint($pconfig['adaptivestart'])) {
80 81
        $input_errors[] = gettext("The Firewall Adaptive Start value must be an integer.");
    }
82
    if (!empty($pconfig['adaptiveend']) && !is_numericint($pconfig['adaptiveend'])) {
83 84
        $input_errors[] = gettext("The Firewall Adaptive End value must be an integer.");
    }
85
    if (!empty($pconfig['maximumstates']) && !is_numericint($pconfig['maximumstates'])) {
86 87
        $input_errors[] = gettext("The Firewall Maximum States value must be an integer.");
    }
88
    if (!empty($pconfig['aliasesresolveinterval']) && !is_numericint($pconfig['aliasesresolveinterval'])) {
89 90
        $input_errors[] = gettext("The Aliases Hostname Resolve Interval value must be an integer.");
    }
91
    if (!empty($pconfig['maximumtableentries']) && !is_numericint($pconfig['maximumtableentries'])) {
92 93
        $input_errors[] = gettext("The Firewall Maximum Table Entries value must be an integer.");
    }
94
    if (count($input_errors) == 0) {
95 96

        if (!empty($pconfig['lb_use_sticky'])) {
97
            $config['system']['lb_use_sticky'] = true;
98 99 100 101 102 103 104 105 106 107
        } elseif (isset($config['system']['lb_use_sticky'])) {
            unset($config['system']['lb_use_sticky']);
        }

        if (!empty($pconfig['srctrack'])) {
            $config['system']['srctrack'] = $pconfig['srctrack'];
        } elseif (isset($config['system']['srctrack'])) {
            unset($config['system']['srctrack']);
        }

108 109 110 111 112 113
        if (!empty($pconfig['ipv6allow'])) {
            $config['system']['ipv6allow'] = true;
        } elseif (isset($config['system']['ipv6allow'])) {
            unset($config['system']['ipv6allow']);
        }

114
        if (!empty($pconfig['disablefilter'])) {
115
            $config['system']['disablefilter'] = "enabled";
116
        } elseif (isset($config['system']['disablefilter'])) {
117 118 119
            unset($config['system']['disablefilter']);
        }

120
        if (!empty($pconfig['disablevpnrules'])) {
121
            $config['system']['disablevpnrules'] = true;
122
        }  elseif (isset($config['system']['disablevpnrules'])) {
123 124 125
            unset($config['system']['disablevpnrules']);
        }

126 127 128
        if (!empty($pconfig['adaptiveend'])) {
            $config['system']['adaptiveend'] = $pconfig['adaptiveend'];
        } elseif (isset($config['system']['adaptiveend'])) {
129 130
            unset($config['system']['adaptiveend']);
        }
131 132 133
        if (!empty($pconfig['adaptivestart'])) {
            $config['system']['adaptivestart'] = $pconfig['adaptivestart'];
        } elseif (isset($config['system']['adaptivestart'])) {
134 135 136
            unset($config['system']['adaptivestart']);
        }

137
        if (!empty($pconfig['checkaliasesurlcert'])) {
138
            $config['system']['checkaliasesurlcert'] = true;
139
        } elseif (isset($config['system']['checkaliasesurlcert'])) {
140 141 142
            unset($config['system']['checkaliasesurlcert']);
        }

143 144 145 146
        if ($pconfig['natreflection'] == "purenat") {
            if (isset($config['system']['disablenatreflection'])) {
                unset($config['system']['disablenatreflection']);
            }
147 148 149 150
        } else {
            $config['system']['disablenatreflection'] = "yes";
        }

151
        if (!empty($pconfig['enablebinatreflection'])) {
152
            $config['system']['enablebinatreflection'] = "yes";
153
        } elseif (isset($config['system']['enablebinatreflection'])) {
154 155 156
            unset($config['system']['enablebinatreflection']);
        }

157 158 159
        if (!empty($pconfig['disablereplyto'])) {
            $config['system']['disablereplyto'] = $pconfig['disablereplyto'];
        } elseif (isset($config['system']['disablereplyto'])) {
160 161 162
            unset($config['system']['disablereplyto']);
        }

163
        if (!empty($pconfig['enablenatreflectionhelper'])) {
164
            $config['system']['enablenatreflectionhelper'] = "yes";
165
        } elseif (isset($config['system']['enablenatreflectionhelper']))  {
166 167 168
            unset($config['system']['enablenatreflectionhelper']);
        }

169 170 171 172
        $config['system']['optimization'] = $pconfig['optimization'];
        $config['system']['maximumstates'] = $pconfig['maximumstates'];
        $config['system']['aliasesresolveinterval'] = $pconfig['aliasesresolveinterval'];
        $config['system']['maximumtableentries'] = $pconfig['maximumtableentries'];
173

174 175 176
        if (!empty($pconfig['bypassstaticroutes'])) {
            $config['filter']['bypassstaticroutes'] = $pconfig['bypassstaticroutes'];
        } elseif (isset($config['filter']['bypassstaticroutes'])) {
177
            unset($config['filter']['bypassstaticroutes']);
178
        }
179

180 181
        if ($pconfig['bogonsinterval'] != $config['system']['bogons']['interval']) {
            $config['system']['bogons']['interval'] = $pconfig['bogonsinterval'];
182 183
        }

184 185 186 187 188 189
        if (!empty($pconfig['schedule_states'])) {
            $config['system']['schedule_states'] = true;
        } elseif (isset($config['system']['schedule_states'])) {
            unset($config['system']['schedule_states']);
        }

190 191 192 193 194 195 196 197 198 199 200 201
        if (!empty($pconfig['kill_states'])) {
            $config['system']['kill_states'] = true;
        } elseif (isset($config['system']['kill_states'])) {
            unset($config['system']['kill_states']);
        }

        if (!empty($pconfig['skip_rules_gw_down'])) {
            $config['system']['skip_rules_gw_down'] = true;
        } elseif (isset($config['system']['skip_rules_gw_down'])) {
            unset($config['system']['skip_rules_gw_down']);
        }

202 203 204 205 206 207 208
        write_config();

        // Kill filterdns when value changes, filter_configure() will restart it
        if ($old_aliasesresolveinterval != $config['system']['aliasesresolveinterval']) {
            killbypid('/var/run/filterdns.pid');
        }

209 210
        $savemsg = get_std_save_message();

211
        configure_cron();
212
        filter_configure();
213
    }
Ad Schellevis's avatar
Ad Schellevis committed
214 215
}

216 217
legacy_html_escape_form_data($pconfig);

Ad Schellevis's avatar
Ad Schellevis committed
218 219 220
include("head.inc");
?>

221
<body>
222 223
<?php include("fbegin.inc"); ?>
  <!-- row -->
224
<section class="page-content-main">
225 226 227 228 229 230 231 232 233
  <div class="container-fluid">
    <div class="row">
<?php
        if (isset($input_errors) && count($input_errors) > 0) {
            print_input_errors($input_errors);
        }
        if (isset($savemsg)) {
            print_info_box($savemsg);
        }
234
?>
235 236
      <section class="col-xs-12">
          <div class="content-box tab-content  table-responsive">
237
            <form method="post" name="iform" id="iform">
238
              <table class="table table-striped opnsense_standard_table_form">
239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256
                <tr>
                  <td width="22%"><strong><?=gettext("IPv6 Options");?></strong></td>
                  <td  width="78%" align="right">
                    <small><?=gettext("full help"); ?> </small>
                    <i class="fa fa-toggle-off text-danger"  style="cursor: pointer;" id="show_all_help_page" type="button"></i>
                  </td>
                </tr>
                <tr>
                  <td><a id="help_for_ipv6allow" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Allow IPv6"); ?></td>
                  <td>
                    <input name="ipv6allow" type="checkbox" value="yes" <?= !empty($pconfig['ipv6allow']) ? "checked=\"checked\"" :"";?> onclick="enable_change(false)" />
                    <strong><?=gettext("Allow IPv6"); ?></strong>
                    <div class="hidden" for="help_for_ipv6allow">
                      <?=gettext("All IPv6 traffic will be blocked by the firewall unless this box is checked."); ?><br />
                      <?=gettext("NOTE: This does not disable any IPv6 features on the firewall, it only blocks traffic."); ?><br />
                    </div>
                  </td>
                </tr>
257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285
<?php           if (count($config['interfaces']) > 1): ?>
                <tr>
                  <th colspan="2" valign="top" class="listtopic"><?=gettext("Network Address Translation");?></th>
                </tr>
                <tr>
                  <td><a id="help_for_natreflection" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Reflection for port forwards");?></td>
                  <td>
                    <select name="natreflection" class="formselect selectpicker" data-style="btn-default">
                      <option value="disable" <?=$pconfig['natreflection'] == "disable" ? "selected=\"selected\"" : "";?>>
                        <?=gettext("Disable"); ?>
                      </option>
                      <option value="purenat" <?=$pconfig['natreflection'] == "purenat" ? "selected=\"selected\"" : "";?>>
                        <?=gettext("Enable (Pure NAT)"); ?>
                      </option>
                    </select>
                    <div class="hidden" for="help_for_natreflection">
                      <strong><?=gettext("When enabled, this automatically creates additional NAT redirect rules for access to port forwards on your external IP addresses from within your internal networks.");?></strong>
                      <br /><br />
                      <?=gettext("The pure NAT mode uses a set of NAT rules to direct packets to the target of the port forward. It has better scalability, but it must be possible to accurately determine the interface and gateway IP used for communication with the target at the time the rules are loaded. There are no inherent limits to the number of ports other than the limits of the protocols. All protocols available for port forwards are supported.");?>
                      <br /><br />
                      <?=gettext("Individual rules may be configured to override this system setting on a per-rule basis.");?>
                    </div>
                  </td>
                </tr>
                <tr>
                  <td><a id="help_for_enablebinatreflection" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Reflection for 1:1");?></td>
                  <td>
                    <input name="enablebinatreflection" type="checkbox" id="enablebinatreflection" value="yes" <?=!empty($pconfig['enablebinatreflection']) ? "checked=\"checked\"" : "";?>/>
                    <div class="hidden" for="help_for_enablebinatreflection">
286
                      <strong><?=gettext("Enables the automatic creation of additional NAT redirect rules for access to 1:1 mappings of your external IP addresses from within your internal networks.");?></strong><br />
287 288 289 290 291 292 293 294 295 296 297
                      <?=gettext("Note: Reflection on 1:1 mappings is only for the inbound component of the 1:1 mappings. This functions the same as the pure NAT mode for port forwards. For more details, refer to the pure NAT mode description above.");?>
                      <br /><br />
                      <?=gettext("Individual rules may be configured to override this system setting on a per-rule basis.");?>
                    </div>
                  </td>
                </tr>
                <tr>
                  <td><a id="help_for_enablenatreflectionhelper" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Automatic outbound NAT for Reflection");?></td>
                  <td>
                    <input name="enablenatreflectionhelper" type="checkbox" id="enablenatreflectionhelper" value="yes" <?=!empty($pconfig['enablenatreflectionhelper']) ? "checked=\"checked\"" : "";?> />
                    <div class="hidden" for="help_for_enablenatreflectionhelper">
298
                      <strong><?=gettext("Automatically create outbound NAT rules which assist inbound NAT rules that direct traffic back out to the same subnet it originated from.");?></strong><br />
299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327
                      <?=gettext("Required for full functionality of the pure NAT mode of NAT Reflection for port forwards or NAT Reflection for 1:1 NAT.");?>
                      <br /><br />
                      <?=gettext("Note: This only works for assigned interfaces. Other interfaces require manually creating the outbound NAT rules that direct the reply packets back through the router.");?>
                    </div>
                  </td>
                </tr>
<?php           endif; ?>
                <tr>
                  <th colspan="2" valign="top" class="listtopic"><?=gettext("Bogon Networks");?></th>
                </tr>
                <tr>
                  <td><a id="help_for_bogonsinterval" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Update Frequency");?></td>
                  <td>
                    <select name="bogonsinterval" class="formselect selectpicker" data-style="btn-default">
                    <option value="monthly" <?=empty($pconfig['bogonsinterval']) || $pconfig['bogonsinterval'] == 'monthly' ? "selected=\"selected\"" : "";?>>
                      <?=gettext("Monthly"); ?>
                    </option>
                    <option value="weekly" <?=$pconfig['bogonsinterval'] == 'weekly' ? "selected=\"selected\"" :"";?>>
                      <?=gettext("Weekly"); ?>
                    </option>
                    <option value="daily" <?=$pconfig['bogonsinterval'] == 'daily' ? "selected=\"selected\"" : "";?>>
                      <?=gettext("Daily"); ?>
                    </option>
                    </select>
                    <div class="hidden" for="help_for_bogonsinterval">
                      <?=gettext("The frequency of updating the lists of IP addresses that are reserved (but not RFC 1918) or not yet assigned by IANA.");?>
                    </div>
                  </td>
                </tr>
328 329 330 331 332 333 334
                <tr>
                  <th colspan="2" valign="top" class="listtopic"><?=gettext("Gateway Monitoring"); ?></th>
                </tr>
                <tr>
                  <td><a id="help_for_kill_states" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Kill states");?> </td>
                  <td>
                    <input name="kill_states" type="checkbox" id="kill_states" value="yes" <?= !empty($pconfig['kill_states']) ? "checked=\"checked\"" : "";?> />
335
                    <strong><?=gettext("Disable State Killing on Gateway Failure"); ?></strong>
336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352
                    <div class="hidden" for="help_for_kill_states">
                      <?=gettext("The monitoring process will flush states for a gateway that goes down if this box is not checked. Check this box to disable this behavior."); ?>
                    </div>
                  </td>
                </tr>
                <tr>
                  <td><a id="help_for_skip_rules_gw_down" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Skip rules");?> </td>
                  <td>
                    <input name="skip_rules_gw_down" type="checkbox" id="skip_rules_gw_down" value="yes" <?=!empty($pconfig['skip_rules_gw_down']) ? "checked=\"checked\"" : "";?> />
                    <strong><?=gettext("Skip rules when gateway is down"); ?></strong>
                    <div class="hidden" for="help_for_skip_rules_gw_down">
                      <?=gettext("By default, when a rule has a specific gateway set, and this gateway is down, ".
                                          "rule is created and traffic is sent to default gateway.This option overrides that behavior ".
                                          "and the rule is not created when gateway is down"); ?>
                    </div>
                  </td>
                </tr>
353
                <tr>
354
                  <th colspan="2" valign="top" class="listtopic"><?= gettext('Multi-WAN') ?></th>
355 356 357 358 359 360 361 362 363
                </tr>
                <tr>
                  <td><a id="help_for_lb_use_sticky" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Sticky connections");?> </td>
                  <td>
                    <input name="lb_use_sticky" type="checkbox" id="lb_use_sticky" value="yes" <?= !empty($pconfig['lb_use_sticky']) ? 'checked="checked"' : '';?>/>
                    <strong><?=gettext("Use sticky connections"); ?></strong><br />
                    <div class="hidden" for="help_for_lb_use_sticky">
                      <?=gettext("Successive connections will be redirected to the servers " .
                                          "in a round-robin manner with connections from the same " .
364
                                          "source being sent to the same gateway. This 'sticky " .
365 366 367
                                          "connection' will exist as long as there are states that " .
                                          "refer to this connection. Once the states expire, so will " .
                                          "the sticky connection. Further connections from that host " .
368
                                          "will be redirected to the next gateway in the round-robin."); ?>
369 370 371
                    </div><br/>
                    <input placeholder="<?=gettext("Source tracking timeout");?>" title="<?=gettext("Source tracking timeout");?>" name="srctrack" id="srctrack" type="text" value="<?= !empty($pconfig['srctrack']) ? $pconfig['srctrack'] : "";?>"/>
                    <div class="hidden" for="help_for_lb_use_sticky">
372
                      <?=gettext("Set the source tracking timeout for sticky connections in seconds. " .
373 374 375 376 377
                                          "By default this is 0, so source tracking is removed as soon as the state expires. " .
                                          "Setting this timeout higher will cause the source/destination relationship to persist for longer periods of time."); ?>
                    </div>
                  </td>
                </tr>
378 379 380 381 382 383 384 385 386 387 388 389 390
                <tr>
                  <th colspan="2" valign="top" class="listtopic"><?=gettext("Schedules"); ?></th>
                </tr>
                <tr>
                  <td><a id="help_for_schedule_states" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Schedule States"); ?></td>
                  <td>
                    <input name="schedule_states" type="checkbox" value="yes" <?=!empty($pconfig['schedule_states']) ? "checked=\"checked\"" :"";?> />
                    <div class="hidden" for="help_for_schedule_states">
                      <?=gettext("By default schedules clear the states of existing connections when the expiration time has come. ".
                                          "This option overrides that behavior by not clearing states for existing connections."); ?>
                    </div>
                  </td>
                </tr>
391
                <tr>
392
                  <th colspan="2" valign="top" class="listtopic"><?=gettext("Miscellaneous");?></th>
393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415
                </tr>
                <tr>
                  <td><a id="help_for_optimization" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Firewall Optimization");?></td>
                  <td>
                    <select onchange="update_description(this.selectedIndex);" name="optimization" id="optimization" class="selectpicker" data-style="btn-default">
                      <option value="normal"<?=$pconfig['optimization']=="normal" ? " selected=\"selected\"" : ""; ?>>
                        <?=gettext("normal");?>
                      </option>
                      <option value="high-latency"<?=$pconfig['optimization']=="high-latency" ? " selected=\"selected\"" : ""; ?>>
                        <?=gettext("high-latency");?>
                      </option>
                      <option value="aggressive"<?=$pconfig['optimization']=="aggressive" ? " selected=\"selected\"" : ""; ?>>
                        <?=gettext("aggressive");?>
                      </option>
                      <option value="conservative"<?=$pconfig['optimization']=="conservative" ? " selected=\"selected\"" : ""; ?>>
                        <?=gettext("conservative");?>
                      </option>
                    </select>
                    <div class="hidden" for="help_for_optimization">
                      <?=gettext("Select the type of state table optimization to use");?>
                      <table class="table table-condensed">
                        <tr>
                          <td><strong><?=gettext("normal");?></strong></td>
Fabian Franz's avatar
Fabian Franz committed
416
                          <td><?=gettext("As the name says, it is the normal optimization algorithm");?></td>
417 418 419
                        </tr>
                        <tr>
                          <td><strong><?=gettext("high-latency");?></strong></td>
Fabian Franz's avatar
Fabian Franz committed
420
                          <td><?=gettext("Used for high latency links, such as satellite links. Expires idle connections later than default");?></td>
421 422 423
                        </tr>
                        <tr>
                          <td><strong><?=gettext("aggressive");?></strong></td>
Fabian Franz's avatar
Fabian Franz committed
424
                          <td><?=gettext("Expires idle connections quicker. More efficient use of CPU and memory but can drop legitimate idle connections");?></td>
425 426 427
                        </tr>
                        <tr>
                          <td><strong><?=gettext("conservative");?></strong></td>
Fabian Franz's avatar
Fabian Franz committed
428
                          <td><?=gettext("Tries to avoid dropping any legitimate idle connections at the expense of increased memory usage and CPU utilization.");?></td>
429 430 431 432 433 434 435 436 437 438
                        </tr>
                      </table>
                      <hr/>
                    </div>
                  </td>
                </tr>
                <tr>
                  <td><a id="help_for_disablefilter" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Disable Firewall");?></td>
                  <td>
                    <input name="disablefilter" type="checkbox" value="yes" <?= !empty($pconfig['disablefilter']) ? "checked=\"checked\"" : "";?>/>
439
                    <strong><?=gettext("Disable all packet filtering.");?></strong>
440
                    <div class="hidden" for="help_for_disablefilter">
441 442
                      <?= gettext('Warning: This will convert into a routing-only platform!') ?><br />
                      <?= gettext('Warning: This will also turn off NAT!') ?><br />
443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474
                      <?=sprintf(
                        gettext('If you only want to disable NAT, and not firewall rules, visit the %sOutbound NAT%s page.'),
                        '<a href="/firewall_nat_out.php">', '</a>'
                      )?>
                    </div>
                  </td>
                </tr>
                <tr>
                  <td><a id="help_for_adaptive" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Firewall Adaptive Timeouts");?></td>
                  <td>
                    <table class="table table-condensed">
                      <thead>
                        <tr>
                          <td><?=gettext("start");?></td>
                          <td><?=gettext("end");?></td>
                        </tr>
                      </thead>
                      <tbody>
                        <tr>
                          <td>
                            <input name="adaptivestart" type="text" value="<?=$pconfig['adaptivestart']; ?>" />
                          </td>
                          <td>
                            <input name="adaptiveend" type="text" value="<?=$pconfig['adaptiveend']; ?>" />
                          </td>
                        </tr>
                      </tbody>
                    </table>
                    <div class="hidden" for="help_for_adaptive">
                      <strong><?=gettext("Timeouts for states can be scaled adaptively as the number of state table entries grows.");?></strong>
                      <br />
                      <strong><?=gettext("start");?></strong></br>
Fabian Franz's avatar
Fabian Franz committed
475
                      <?=gettext("When the number of state entries exceeds this value, adaptive scaling begins. All timeout values are scaled linearly with factor (adaptive.end - number of states) / (adaptive.end - adaptive.start).");?><br/>
476
                      <strong><?=gettext("end");?></strong></br>
Fabian Franz's avatar
Fabian Franz committed
477
                      <?=gettext("When reaching this number of state entries, all timeout values become zero, effectively purging all state entries immediately. This value is used to define the scale factor, it should not actually be reached (set a lower state limit, see below).");?>
478
                      <br/>
Fabian Franz's avatar
Fabian Franz committed
479
                      <strong><?=gettext("Note: Leave this blank for the default(0).");?></strong>
480 481 482 483 484 485 486 487 488 489
                    </div>
                  </td>
                </tr>
                <tr>
                  <td><a id="help_for_maximumstates" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Firewall Maximum States");?></td>
                  <td>
                    <input name="maximumstates" type="text" id="maximumstates" value="<?=$pconfig['maximumstates'];?>" />
                    <div class="hidden" for="help_for_maximumstates">
                      <strong><?=gettext("Maximum number of connections to hold in the firewall state table.");?></strong>
                      <br />
Fabian Franz's avatar
Fabian Franz committed
490
                      <?=gettext("Note: Leave this blank for the default. On your system the default size is:");?> <?= default_state_size() ?>
491 492 493 494 495 496
                    </div>
                  </td>
                </tr>
                <tr>
                  <td><a id="help_for_maximumtableentries" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Firewall Maximum Table Entries");?></td>
                  <td>
497
                    <input name="maximumtableentries" type="text" id="maximumtableentries" value="<?= html_safe($pconfig['maximumtableentries']) ?>"/>
498 499 500
                    <div class="hidden" for="help_for_maximumtableentries">
                      <strong><?=gettext("Maximum number of table entries for systems such as aliases, sshlockout, snort, etc, combined.");?></strong>
                      <br />
Fabian Franz's avatar
Fabian Franz committed
501
                      <?=gettext("Note: Leave this blank for the default.");?>
502 503 504 505 506 507 508 509 510 511 512 513
<?php
                      if (empty($pconfig['maximumtableentries'])) :?>
                        <?= gettext("On your system the default size is:");?> <?= default_table_entries_size(); ?>
<?php
                      endif;?>
                    </div>
                  </td>
                </tr>
                <tr>
                  <td><a id="help_for_bypassstaticroutes" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Static route filtering");?></td>
                  <td>
                    <input name="bypassstaticroutes" type="checkbox" value="yes" <?=!empty($pconfig['bypassstaticroutes']) ? "checked=\"checked\"" : "";?>/>
514
                    <strong><?=gettext("Bypass firewall rules for traffic on the same interface");?></strong>
515 516 517 518 519 520 521 522 523 524 525
                    <div class="hidden" for="help_for_bypassstaticroutes">
                      <?=gettext("This option only applies if you have defined one or more static routes. If it is enabled, traffic that enters and " .
                                          "leaves through the same interface will not be checked by the firewall. This may be desirable in some situations where " .
                                          "multiple subnets are connected to the same interface.");?>
                    </div>
                  </td>
                </tr>
                <tr>
                  <td><a id="help_for_disablevpnrules" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext('Disable Auto-added VPN rules') ?></td>
                  <td>
                    <input name="disablevpnrules" type="checkbox" value="yes" <?=!empty($pconfig['disablevpnrules']) ? "checked=\"checked\"" :"";?> />
526
                    <strong><?=gettext("Disable all auto-added VPN rules.");?></strong>
527 528 529 530 531 532 533 534 535
                    <div class="hidden" for="help_for_disablevpnrules">
                      <?=gettext("Note: This disables automatically added rules for IPsec, PPTP.");?>
                    </div>
                  </td>
                </tr>
                <tr>
                  <td><a id="help_for_disablereplyto" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext('Disable reply-to') ?></td>
                  <td>
                    <input name="disablereplyto" type="checkbox" value="yes" <?=!empty($pconfig['disablereplyto']) ? "checked=\"checked\"" : "";?> />
536
                    <strong><?=gettext("Disable reply-to on WAN rules");?></strong>
537 538 539 540 541 542 543 544 545 546 547 548 549
                    <div class="hidden" for="help_for_disablereplyto">
                      <?=gettext("With Multi-WAN you generally want to ensure traffic leaves the same interface it arrives on, hence reply-to is added automatically by default. " .
                                          "When using bridging, you must disable this behavior if the WAN gateway IP is different from the gateway IP of the hosts behind the bridged interface.");?>
                    </div>
                  </td>
                </tr>
                <tr>
                  <td><a id="help_for_aliasesresolveinterval" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Aliases Resolve Interval");?></td>
                  <td>
                    <input name="aliasesresolveinterval" type="text" value="<?=$pconfig['aliasesresolveinterval']; ?>" />
                    <div class="hidden" for="help_for_aliasesresolveinterval">
                      <strong><?=gettext("Interval, in seconds, that will be used to resolve hostnames configured on aliases.");?></strong>
                      <br />
Fabian Franz's avatar
Fabian Franz committed
550
                      <?=gettext("Note: Leave this blank for the default (300s).");?>
551 552 553 554
                    </div>
                  </td>
                </tr>
                <tr>
555
                  <td><a id="help_for_checkaliasesurlcert" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Check certificate of aliases URLs");?></td>
556 557
                  <td>
                    <input name="checkaliasesurlcert" type="checkbox" value="yes" <?=!empty($pconfig['checkaliasesurlcert']) ? "checked=\"checked\"" : "";?> />
558 559
                    <strong><?=gettext("Verify HTTPS certificates when downloading alias URLs");?></strong>
                    <div class="hidden" for="help_for_checkaliasesurlcert">
560 561 562 563 564 565 566 567 568 569 570 571 572 573
                      <?=gettext("Make sure the certificate is valid for all HTTPS addresses on aliases. If it's not valid or is revoked, do not download it.");?>
                    </div>
                  </td>
                </tr>
                <tr>
                  <td></td>
                  <td><input name="Submit" type="submit" class="btn btn-primary" value="<?=gettext("Save");?>" /></td>
                </tr>
            </table>
          </form>
        </div>
      </section>
    </div>
  </div>
574
</section>
575
<?php include("foot.inc");