Example #1
0
 *
 * MMC is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with MMC.  If not, see <http://www.gnu.org/licenses/>.
 */
/**
 * shorewall module declaration
 */
include 'modules/shorewall/includes/shorewall-xmlrpc.inc.php';
$zones_types = getZonesTypes();
$lan_zones = getShorewallZones($zones_types['internal']);
$wan_zones = getShorewallZones($zones_types['external']);
$mod = new Module("shorewall");
$mod->setVersion("2.4.3");
$mod->setRevision('');
$mod->setDescription(_T("Firewall management", "shorewall"));
$mod->setAPIVersion("0:0:0");
$mod->setPriority(60);
$submod = new SubModule("shorewall", _T("Firewall", "shorewall"));
$submod->setDefaultPage("shorewall/shorewall/internal_fw");
$submod->setImg('modules/shorewall/graph/navbar/shorewall');
$submod->setPriority(60);
/* Add the page to the module */
$page = new Page("internal_fw", _T("Internal &rarr; Server", "shorewall"));
$submod->addPage($page);
if (!$lan_zones) {
    $page->setOptions(array("visible" => False));
Example #2
0
 if (fromPOST('source') == "all") {
     foreach (getShorewallZones($src) as $zone) {
         $sources[] = $zone;
     }
 } else {
     $sources[] = fromPOST('source');
 }
 if (fromPOST('source_ip')) {
     foreach ($sources as $k => $v) {
         $sources[$k] = $v . ":" . fromPOST('source_ip');
     }
 }
 # Destination
 $destinations = array();
 if (fromPOST('destination') == "all") {
     foreach (getShorewallZones($dst) as $zone) {
         $destinations[] = $zone;
     }
 } else {
     $destinations[] = fromPOST('destination');
 }
 if ($_POST['destination_ip']) {
     foreach ($destinations as $k => $v) {
         $destinations[$k] = $v . ":" . fromPOST('destination_ip');
     }
 }
 # Add rules
 foreach ($sources as $final_src) {
     foreach ($destinations as $final_dst) {
         addRule($action, $final_src, $final_dst, $proto, $port);
     }
Example #3
0
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * MMC is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with MMC; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */
if (isset($_POST["bdelete"])) {
    $list = getRules("", $src, $dst, $filter);
    $rule = $list[$_POST['id']];
    foreach (getShorewallZones($src) as $zone) {
        delRule($rule[0], $rule[1], $rule[2], $rule[3], $rule[4]);
    }
    if (!isXMLRPCError()) {
        $n = new NotifyWidgetSuccess(_T("The rule has been deleted."));
        handleServicesModule($n, array("shorewall" => _T("Firewall")));
    }
    header("Location: " . urlStrRedirect("shorewall/shorewall/" . $_POST['page']));
    exit;
}
?>

<p><?php 
echo _T("Delete this rule ?");
?>
</p>