X-Git-Url: http://git.pjr.cc/?p=CBFWR.git;a=blobdiff_plain;f=libcbfwr%2Ffwui.php;h=63c6613b7530d6b285f391d152a7ef9d93d2e439;hp=4bcfed5513ae07cc14624e34daac0a8e76ef4963;hb=b571fcf2648a6d5a4893125cb97db4f3f73ee134;hpb=c6a0d901040bc483d89d8596661dcf0d5a48ffb2 diff --git a/libcbfwr/fwui.php b/libcbfwr/fwui.php index 4bcfed5..63c6613 100644 --- a/libcbfwr/fwui.php +++ b/libcbfwr/fwui.php @@ -58,15 +58,8 @@ function CBFWZonesPage($urls) case "delete": $zonetodelete = $urls[2]; - - $conf = $comms->getConfig(3); - $changes = $conf["status"]; - if($changes == "nochange") $conf["status"] = 1; - else $conf["status"] = $changes + 1; - $cnum = $conf["status"]; - - $conf[$cnum]["delete"] = "zone $zonetodelete"; - $comms->putConfig($conf, 3); + + addWebUserChange("delete zone name $zonetodelete"); header("Location: $BASE_URL/zones"); break; @@ -74,21 +67,16 @@ function CBFWZonesPage($urls) case "add": // UGLY - $cnum = 0; $nametoadd = $_REQUEST["toadd"]; $desc = $_REQUEST["desc"]; + $descbit = ""; if($desc != "") $descbit = " # $desc"; if($nametoadd == "" || $nametoadd == null) { return; } - $conf = $comms->getConfig(3); - $changes = $conf["status"]; - if($changes == "nochange") $conf["status"] = 1; - else $conf["status"] = $changes + 1; - $cnum = $conf["status"]; - $conf[$cnum]["add"] = "zone $nametoadd$descbit"; - $comms->putConfig($conf, 3); + + addWebUserChange("zone name $nametoadd $descbit"); header("Location: $BASE_URL/zones"); break; @@ -122,6 +110,28 @@ function CBFWZonesEditPage($urls) echo ""; } +function addWebUserChange($change) +{ + $comms = new Comms(); + $myconf = new Config(); + + $conf = $comms->getConfig(3); + + if(!isset($conf["status"])) { + $conf["status"] = "nochange"; + } + + $changes = $conf["status"]; + if($changes == "nochange") $conf["status"] = 1; + else $conf["status"] = $changes + 1; + $cnum = $conf["status"]; + + $conf["changes"][$cnum] = "$change"; + $comms->putConfig($conf, 3); + +} + +// TODO: we need to really sit and think about this one function getWebUserConfig() { $comms = new Comms(); @@ -140,13 +150,20 @@ function getWebUserConfig() } // it did not, do a new merge and cache - $config = $myconf->mergeConfig($comms->getConfig(), $conf2); + // TODO: need to do this part + $config = $comms->getConfig(); $reconfig = $config; + $myconf->setConfig($config); + if(isset($conf2["changes"])) foreach($conf2["changes"] as $key => $var) { + error_log("Adding config line $key, $var"); + $myconf->addConfigLine($var); + } + $reconfig = $myconf->getConfig(); $reconfig["status"] = $conf2["status"]; error_log("put pre-cache config"); $comms->putConfig($reconfig, 5); - return $config; + return $reconfig; } function CBFWZonesPageDisplay() @@ -334,11 +351,123 @@ function CBFWInterfacesPageDisplay() echo ""; } -function CBFWObjectsPage() +function CBFWObjectsPage($urls) { $comms = new Comms(); $config = $comms->getConfig(); + + CBFWpageBuilder(null, "CBFWObjectsDisplay"); +} + +function CBFWObjectsDisplay() +{ + global $BASE_URL, $MENU_ITEMS; + $config = getWebUserConfig(); + + echo "

Objects

"; + + if(isset($config["objects"])) { + echo ""; + echo ""; + echo "
NetworksHostsServicesNetwork GroupsHost GroupsService Groups
"; + foreach($config["objects"] as $key => $var) { + } + } else { + echo "No objects set\n"; + } + + echo "
"; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + + + echo "
"; + echo "

Create Network


"; + echo "
"; + echo "Name
"; + echo "IPv4 /
"; + echo "IPv6 /
"; + echo ""; + echo "
"; + echo "
"; + echo "

Create Host


"; + echo "
"; + echo "Name
"; + echo "IPv4
"; + echo "IPv6
"; + echo ""; + echo "
"; + echo "
"; + echo "

Service


"; + echo "
"; + echo "Name
"; + echo "Port "; + echo "
"; + echo ""; + echo "
"; + echo "
"; + echo "

Network Group

"; + echo "
"; + echo "Name
"; + echo "
"; + echo "
"; + echo "

Host Group

"; + echo "
"; + echo "Name
"; + echo "
"; + echo "
"; + echo "

Service Group

"; + echo "
"; + echo "Name
"; + echo "
"; + echo "
"; + +} + +function CBFWChangesPage($urls) +{ + global $BASE_URL, $MENU_ITEMS; + + if(isset($urls[1])) { + switch($urls[1]) { + case "show": + CBFWpageBuilder(null, "CBFWChangesDisplay"); + break; + case "delete": + $delete = $urls[2]; + error_log("would delete change $delete"); + header("Location: $BASE_URL/changes/show"); + break; + } + } +} + +function CBFWChangesDisplay() +{ + global $BASE_URL, $MENU_ITEMS; + $comms = new Comms(); + + $config = $comms->getConfig(3); + + echo "

Changes

"; + echo "This page shows the changes on the web from the currently running configuration
"; + if($config["status"] == "nochange") { + echo "There are currently no changes from the running configuraiton."; + } else { + echo ""; + echo ""; + foreach($config["changes"] as $key => $var) { + echo ""; + } + echo "
Change NoChangeControl
$key$varDelete
"; + } } function CBFWRulesPage() @@ -348,6 +477,58 @@ function CBFWRulesPage() $config = $comms->getConfig(); } +function CBFWAdminPage($urls) +{ + $comms = new Comms(); + + $config = $comms->getConfig(); + + CBFWpageBuilder(null, "CBFWAdminDisplay"); +} + +function CBFWAdminDisplay() +{ +?> +

Administration

+ + + + + +
+

Users

+ + + +
UsernameDescriptionEnabled?
AdminTwattleYes
+
+

Add User

+
+Username
+Password
+Description
+
+
+
+

Network Access

+ + + +
FromInterfaceType
Anytwaddlehttp,https,ssh
+
+

Add Access

+
+From either "any", an address (1.2.3.4) or a network (1.2.3.4/23)
+Interface +Protocols HTTP HTTPS SSH
+
+
+
+