system_advanced_firewall.php 35.8 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 39 40 41 42 43 44
function default_table_entries_size()
{
        $current = `pfctl -sm | grep table-entries | awk '{print $4};'`;

        return $current;
}


45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
if ($_SERVER['REQUEST_METHOD'] === 'GET') {
    $pconfig = array();
    $pconfig['disablefilter'] = !empty($config['system']['disablefilter']);
    $pconfig['scrubnodf'] = !empty($config['system']['scrubnodf']);
    $pconfig['scrubrnid'] = !empty($config['system']['scrubrnid']);
    $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['disablenegate'] = isset($config['system']['disablenegate']);
    $pconfig['bogonsinterval'] = !empty($config['system']['bogons']['interval']) ? $config['system']['bogons']['interval'] : null;
    if (!isset($config['system']['disablenatreflection']) && !isset($config['system']['enablenatreflectionpurenat'])) {
        $pconfig['natreflection'] = "proxy";
    } elseif (isset($config['system']['enablenatreflectionpurenat'])) {
        $pconfig['natreflection'] = "purenat";
    } else {
        $pconfig['natreflection'] = "disable";
    }
    $pconfig['enablebinatreflection'] = !empty($config['system']['enablebinatreflection']);
    $pconfig['enablenatreflectionhelper'] = isset($config['system']['enablenatreflectionhelper']) ? $config['system']['enablenatreflectionhelper'] : null;
    $pconfig['reflectiontimeout'] = !empty($config['system']['reflectiontimeout']) ? $config['system']['reflectiontimeout'] : null;
    $pconfig['bypassstaticroutes'] = isset($config['filter']['bypassstaticroutes']);
    $pconfig['disablescrub'] = isset($config['system']['disablescrub']);
    $pconfig['ftp-proxy-client'] = isset($config['system']['ftp-proxy']['client']);
    $pconfig['disablevpnrules'] = isset($config['system']['disablevpnrules']);
} elseif ($_SERVER['REQUEST_METHOD'] === 'POST') {
75
    $pconfig = $_POST;
76 77
    $old_aliasesresolveinterval = $config['system']['aliasesresolveinterval'];
    $input_errors = array();
78 79

    /* input validation */
80
    if ((empty($pconfig['adaptivestart']) && !empty($pconfig['adaptiveend'])) || (!empty($pconfig['adaptivestart']) && empty($pconfig['adaptiveend']))) {
81 82
        $input_errors[] = gettext("The Firewall Adaptive values must be set together.");
    }
83
    if (!empty($pconfig['adaptivestart']) && !is_numericint($pconfig['adaptivestart'])) {
84 85
        $input_errors[] = gettext("The Firewall Adaptive Start value must be an integer.");
    }
86
    if (!empty($pconfig['adaptiveend']) && !is_numericint($pconfig['adaptiveend'])) {
87 88
        $input_errors[] = gettext("The Firewall Adaptive End value must be an integer.");
    }
89
    if (!empty($pconfig['maximumstates']) && !is_numericint($pconfig['maximumstates'])) {
90 91
        $input_errors[] = gettext("The Firewall Maximum States value must be an integer.");
    }
92
    if (!empty($pconfig['aliasesresolveinterval']) && !is_numericint($pconfig['aliasesresolveinterval'])) {
93 94
        $input_errors[] = gettext("The Aliases Hostname Resolve Interval value must be an integer.");
    }
95
    if (!empty($pconfig['maximumtableentries']) && !is_numericint($pconfig['maximumtableentries'])) {
96 97
        $input_errors[] = gettext("The Firewall Maximum Table Entries value must be an integer.");
    }
98
    if (!empty($pconfig['reflectiontimeout']) && !is_numericint($pconfig['reflectiontimeout'])) {
99 100
        $input_errors[] = gettext("The Reflection timeout must be an integer.");
    }
101 102
    if (count($input_errors) == 0) {
        if (!empty($pconfig['disablefilter'])) {
103
            $config['system']['disablefilter'] = "enabled";
104
        } elseif (isset($config['system']['disablefilter'])) {
105 106 107
            unset($config['system']['disablefilter']);
        }

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

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

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

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
        if ($pconfig['natreflection'] == "proxy") {
144 145
            unset($config['system']['disablenatreflection']);
            unset($config['system']['enablenatreflectionpurenat']);
146
        } elseif ($pconfig['natreflection'] == "purenat") {
147 148 149 150
            unset($config['system']['disablenatreflection']);
            $config['system']['enablenatreflectionpurenat'] = "yes";
        } else {
            $config['system']['disablenatreflection'] = "yes";
151 152 153
            if (isset($config['system']['enablenatreflectionpurenat'])) {
                unset($config['system']['enablenatreflectionpurenat']);
            }
154 155
        }

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

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

168 169 170
        if (!empty($pconfig['disablenegate'])) {
            $config['system']['disablenegate'] = $pconfig['disablenegate'];
        } elseif (isset($config['system']['disablenegate'])) {
171 172 173
            unset($config['system']['disablenegate']);
        }

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

180 181 182 183 184
        $config['system']['optimization'] = $pconfig['optimization'];
        $config['system']['maximumstates'] = $pconfig['maximumstates'];
        $config['system']['aliasesresolveinterval'] = $pconfig['aliasesresolveinterval'];
        $config['system']['maximumtableentries'] = $pconfig['maximumtableentries'];
        $config['system']['reflectiontimeout'] = $pconfig['reflectiontimeout'];
185

186 187 188
        if (!empty($pconfig['bypassstaticroutes'])) {
            $config['filter']['bypassstaticroutes'] = $pconfig['bypassstaticroutes'];
        } elseif (isset($config['filter']['bypassstaticroutes'])) {
189
            unset($config['filter']['bypassstaticroutes']);
190
        }
191

192 193 194
        if (!empty($pconfig['disablescrub'])) {
            $config['system']['disablescrub'] = $pconfig['disablescrub'];
        } elseif (isset($config['system']['disablescrub'])) {
195 196 197
            unset($config['system']['disablescrub']);
        }

198
        if (!empty($pconfig['ftp-proxy-client'])) {
199
            $config['system']['ftp-proxy']['client'] = true;
200
        } elseif (isset($config['system']['ftp-proxy']['client'])) {
201 202 203
            unset($config['system']['ftp-proxy']['client']);
        }

204 205
        if ($pconfig['bogonsinterval'] != $config['system']['bogons']['interval']) {
            switch ($pconfig['bogonsinterval']) {
206 207 208 209 210 211 212 213 214 215 216
                case 'daily':
                    install_cron_job("/usr/local/etc/rc.update_bogons", true, "1", "3", "*", "*", "*");
                    break;
                case 'weekly':
                    install_cron_job("/usr/local/etc/rc.update_bogons", true, "1", "3", "*", "*", "0");
                    break;
                case 'monthly':
                    // fall through
                default:
                    install_cron_job("/usr/local/etc/rc.update_bogons", true, "1", "3", "1", "*", "*");
            }
217
            $config['system']['bogons']['interval'] = $pconfig['bogonsinterval'];
218 219 220 221 222 223 224 225 226 227 228 229
        }

        write_config();

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

        $retval = 0;
        $retval = filter_configure();
        if (stristr($retval, "error") <> true) {
230
            $savemsg = get_std_save_message();
231 232 233 234
        } else {
            $savemsg = $retval;
        }
    }
Ad Schellevis's avatar
Ad Schellevis committed
235 236
}

237 238
legacy_html_escape_form_data($pconfig);

Ad Schellevis's avatar
Ad Schellevis committed
239
include("head.inc");
240

Ad Schellevis's avatar
Ad Schellevis committed
241 242
?>

243
<body>
244 245
<?php include("fbegin.inc"); ?>
  <!-- row -->
246
<section class="page-content-main">
247 248 249 250 251 252 253 254 255
  <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);
        }
256
?>
257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 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 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589
      <section class="col-xs-12">
          <div class="content-box tab-content  table-responsive">
            <form action="system_advanced_firewall.php" method="post" name="iform" id="iform">
              <table class="table table-striped ">
                <tr>
                  <td width="22%"><strong><?=gettext("Firewall Advanced");?></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></a>
                  </td>
                </tr>
                <tr>
                  <td><a id="help_for_scrubnodf" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("IP Do-Not-Fragment");?></td>
                  <td>
                    <input name="scrubnodf" type="checkbox" value="yes" <?=!empty($pconfig['scrubnodf']) ? "checked=\"checked\"" : ""; ?>/>
                    <div class="hidden" for="help_for_scrubnodf">
                      <strong><?=gettext("Clear invalid DF bits instead of dropping the packets");?></strong><br />
                      <?=gettext("This allows for communications with hosts that generate fragmented " .
                                          "packets with the don't fragment (DF) bit set. Linux NFS is known to " .
                                          "do this. This will cause the filter to not drop such packets but " .
                                          "instead clear the don't fragment bit.");?>
                    </div>
                  </td>
                </tr>
                <tr>
                  <td><a id="help_for_scrubrnid" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("IP Random id");?></td>
                  <td>
                    <input name="scrubrnid" type="checkbox" value="yes" <?= !empty($pconfig['scrubrnid']) ? "checked=\"checked\"" : "";?> />
                    <div class="hidden" for="help_for_scrubrnid">
                      <strong><?=gettext("Insert a stronger id into IP header of packets passing through the filter.");?></strong><br />
                      <?=gettext("Replaces the IP identification field of packets with random values to " .
                                          "compensate for operating systems that use predictable values. " .
                                          "This option only applies to packets that are not fragmented after the " .
                                          "optional packet reassembly.");?>
                    </div>
                  </td>
                </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>
                          <td><?=gettext("as the name says, it is the normal optimization algorithm");?></td>
                        </tr>
                        <tr>
                          <td><strong><?=gettext("high-latency");?></strong></td>
                          <td><?=gettext("used for high latency links, such as satellite links.  Expires idle connections later than default");?></td>
                        </tr>
                        <tr>
                          <td><strong><?=gettext("aggressive");?></strong></td>
                          <td><?=gettext("expires idle connections quicker. More efficient use of CPU and memory but can drop legitimate idle connections");?></td>
                        </tr>
                        <tr>
                          <td><strong><?=gettext("conservative");?></strong></td>
                          <td><?=gettext("tries to avoid dropping any legitimate idle connections at the expense of increased memory usage and CPU utilization.");?></td>
                        </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\"" : "";?>/>
                    <div class="hidden" for="help_for_disablefilter">
                      <strong><?=gettext("Disable all packet filtering.");?></strong><br/>
                      <?php printf(gettext("Warning: This converts %s into a routing only platform!"), $g['product_name']);?>
                      <?=gettext("Warning: This will also turn off NAT!");?><br />
                      <?=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_disablescrub" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Disable Firewall Scrub");?></td>
                  <td>
                    <input name="disablescrub" type="checkbox" value="yes" <?=!empty($pconfig['disablescrub']) ? "checked=\"checked\"" : "";?>/>
                    <div class="hidden" for="help_for_disablescrub">
                      <?=gettext("Disables the PF scrubbing option which can sometimes interfere with NFS and PPTP traffic.");?>
                    </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>
                      <?=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/>
                      <strong><?=gettext("end");?></strong></br>
                      <?=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).");?>
                      <br/>
                      <strong><?=gettext("Note:  Leave this blank for the default(0).");?></strong>
                    </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 />
                      <?=gettext("Note:  Leave this blank for the default.  On your system the default size is:");?> <?= default_state_size() ?>
                    </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>
                    <input name="maximumtableentries" type="text" id="maximumtableentries" value="<?php echo $pconfig['maximumtableentries']; ?>" />
                    <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 />
                      <?=gettext("Note:  Leave this blank for the default.");?>
<?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\"" : "";?>/>
                    <div class="hidden" for="help_for_bypassstaticroutes">
                      <strong><?=gettext("Bypass firewall rules for traffic on the same interface");?></strong>
                      <br />
                      <?=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\"" :"";?> />
                    <div class="hidden" for="help_for_disablevpnrules">
                      <strong><?=gettext("Disable all auto-added VPN rules.");?></strong>
                      <br />
                      <?=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\"" : "";?> />
                    <div class="hidden" for="help_for_disablereplyto">
                      <strong><?=gettext("Disable reply-to on WAN rules");?></strong>
                      <br />
                      <?=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_disablenegate" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext('Disable Negate rules') ?></td>
                  <td>
                    <input name="disablenegate" type="checkbox" value="yes" <?=!empty($pconfig['disablenegate']) ? "checked=\"checked\"" : "";?> />
                    <div class="hidden" for="help_for_disablenegate">
                      <strong><?=gettext("Disable Negate rule on policy routing rules");?></strong>
                      <br />
                      <?=gettext("With Multi-WAN you generally want to ensure traffic reaches directly connected networks and VPN networks when using policy routing. You can disable this for special purposes but it requires manually creating rules for these networks");?>
                    </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 />
                      <?=gettext("Note:  Leave this blank for the default (300s).");?>
                    </div>
                  </td>
                </tr>
                <tr>
                  <td><a id="help_for_aliasesresolveinterval" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Check certificate of aliases URLs");?></td>
                  <td>
                    <input name="checkaliasesurlcert" type="checkbox" value="yes" <?=!empty($pconfig['checkaliasesurlcert']) ? "checked=\"checked\"" : "";?> />
                    <div class="hidden" for="help_for_aliasesresolveinterval">
                      <strong><?=gettext("Verify HTTPS certificates when downloading alias URLs");?></strong>
                      <br />
                      <?=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>
                  <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>
<?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="proxy" <?=$pconfig['natreflection'] == "proxy" ? "selected=\"selected\"" : "";?>>
                        <?=gettext("Enable (NAT + Proxy)"); ?>
                      </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 NAT + proxy mode uses a helper program to send packets to the target of the port forward.  It is useful in setups where the interface and/or gateway IP used for communication with the target cannot be accurately determined at the time the rules are loaded.  Reflection rules are not created for ranges larger than 500 ports and will not be used for more than 1000 ports total between all port forwards.  Only TCP and UDP protocols are supported.");?>
                      <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_reflectiontimeout" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Reflection Timeout");?></td>
                  <td>
                    <input name="reflectiontimeout" type="text" value="<?=$pconfig['reflectiontimeout']; ?>" />
                    <div class="hidden" for="help_for_reflectiontimeout">
                      <strong><?=gettext("Enter value for Reflection timeout in seconds.");?></strong>
                      <br /><br />
                      <?=gettext("Note: Only applies to Reflection on port forwards in NAT + proxy mode.");?>
                    </div>
                  </td>
                </tr>
                <tr>
                  <td><a id="help_for_enablebinatreflection" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Enable 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">
                      <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 /><br />
                      <?=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("Enable 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">
                      <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 />
                      <?=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>
                <tr>
                  <td><a id="help_for_ftp_proxy_client" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("FTP Proxy");?></td>
                  <td>
                    <input name="ftp-proxy-client" type="checkbox" value="yes" <?= !empty($pconfig['ftp-proxy-client']) ? "checked=\"checked\"" : "";?> />
                    <div class="hidden" for="help_for_ftp_proxy_client">
                      <strong><?=gettext("Enable FTP proxy for clients");?></strong>
                      <br />
                      <?=gettext("Configures the FTP proxy to allow for client connections behind the firewall using active file transfer mode.");?>
                    </div>
                  </td>
                </tr>

                  <?php
590
endif; ?>
591 592 593 594 595 596 597 598 599 600
                <tr>
                  <td></td>
                  <td><input name="Submit" type="submit" class="btn btn-primary" value="<?=gettext("Save");?>" /></td>
                </tr>
            </table>
          </form>
        </div>
      </section>
    </div>
  </div>
601
</section>
602
<?php include("foot.inc");