Commit 25ad6c54 authored by Ad Schellevis's avatar Ad Schellevis

replace captive portal ipfw ruleset loading with configd template engine

parent 9261e580
......@@ -31,6 +31,7 @@ namespace OPNsense\CaptivePortal;
use \Phalcon\Logger\Adapter\Syslog;
use \Phalcon\DI\FactoryDefault;
use \OPNsense\Core;
use \OPNsense\Core\Backend;
/**
* Class CPClient main class for captive portal backend functionality
......@@ -92,10 +93,13 @@ class CPClient
{
if ($this->isEnabled()) {
$ruleset_filename = FactoryDefault::getDefault()->get('config')->globals->temp_path."/ipfw.rules";
$this->rules->generate($ruleset_filename);
$backend = new Backend();
$response = $backend->configdRun("template reload OPNsense.IPFW");
// load ruleset
$this->shell->exec("/sbin/ipfw -f ".$ruleset_filename);
if (trim($response) == "OK") {
// load ruleset when ruleset is successfully loaded
$this->shell->exec("/sbin/ipfw -f ".$ruleset_filename);
}
// update tables
$this->update();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment