⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 firewall.php

📁 phpbased firewall for linux.
💻 PHP
字号:
<? 
require("firewallFunctions.php");
$feedback="";
 
switch ($_REQUEST["action"]) {
	case "insert": insertRule();break;
	case "delete": deleteRule();break;
	case "modifySave": modifySaveRule();break;
	case "deleteChain": deleteChain();break;
	case "cleanAll": cleanAll();break;
	case "xmlBackup": XMLbackup();break;
	case "iptablesSave": iptablesSave();break;
	case "insertChain": insertChain();break;
	default: break;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title><?=$titleOfPage?></title>
<script type="text/javascript" src="lib/js/tabpane.js"></script>
<link id="luna-tab-style-sheet" type="text/css" rel="stylesheet" href="lib/css/luna/tab.css"/>
<link rel="stylesheet" type="text/css" href="templates/<?=$theme?>/style.css" />
<script type="text/javascript" src="modules/firewall/checkRule.js"></script>
</head>

<body>
<? 
backToIndex(); ?>
<h2>Firewall Administrator</h2>
<div class="tab-pane" id="tab-pane-1">
	<div class="tab-page">
      <h2 class="tab">List</h2>
	  <?
		switch ($_REQUEST["action"]) {
			case "modify": modifyRule(); break;
			default: break;
		}
?>
	  <? iptablesList(); ?>
	 </div>
	 	<div class="tab-page">
      <h2 class="tab">Insert Rule</h2>
<h3>Insert a new rule <img src="images/info.png" border="0" alt="Insert a new iptables filter rule" title="Insert a new iptables filter rule" align="baseline" style="cursor:help"/></h3>

<form method="post" action="index.php?modules=firewall">
<input type="hidden" name="action" value="insert" />
<table width="500" class="tableBorder" border="0" cellpadding="3" cellspacing="0">
<tr><td class="lineBest" width="150"><strong>Chain</strong></td>
<td class="oddrowbg"><select name="chain"><?php echo getChains(); ?></select></td></tr>
<tr><td class="lineBest"><strong>Source Ip</strong></td>
<td class="evenrowbg"><?php writeEqDif("saddr");?><input id="saddr" type="text" name="saddr" size="15" /></td></tr>
<tr><td class="lineBest" width="150"><strong>Destination Ip</strong></td>
<td class="oddrowbg"><?php writeEqDif("daddr");?><input id="daddr" type="text" name="daddr" size="15" /></td></tr>
<tr><td class="lineBest" width="150"><strong>Protocol</strong></td>
<td class="evenrowbg"><select name="protocol"><option value="tcp">TCP</option><option value="udp">UDP</option><option value="icmp">ICMP</option><option value="" selected="selected">ALL</option></select></td></tr>
<tr><td class="lineBest" width="150"><strong>Source Port</strong></td>
<td class="oddrowbg"><?php writeEqDif("sport");?><input id="sport" type="text" name="sport" size="4"/></td></tr>
<tr><td class="lineBest" width="150"><strong>Destination Port</strong></td>
<td class="evenrowbg"><?php writeEqDif("dport");?><input id="dport" type="text" name="dport" size="4"/></td></tr>
<tr><td class="lineBest" width="150"><strong>Target</strong></td>
<td class="oddrowbg"><select name="target"><option>ACCEPT</option><option>DROP</option><option>REJECT</option></select> <input type="checkbox" id="log" name="log"/><label for="log">Log</label></td></tr>
<tr><td class="lineBest" width="150"><strong>Input Interface</strong></td>
<td class="evenrowbg"><?php writeEqDif("i");?><select name="i"><? writeSelectEth(); ?></select></td></tr>
<tr><td class="lineBest" width="150"><strong>Output Interface</strong></td>
<td class="oddrowbg"><?php writeEqDif("o");?><select name="o"><? writeSelectEth(); ?></select></td></tr>
<tr class="trback"><td colspan="2" align="center"><input type="button" value="Add" onClick="control();" /></td></tr>
</table>
</form>
</div>
<div class="tab-page">
      <h2 class="tab">Insert Chain</h2>
<h3>Insert a new chain <img src="images/info.png" border="0" alt="What is a chain?" title="What is a chain?" align="baseline" style="cursor:help" /></h3>
<form method="post" action="index.php?modules=firewall">
<input type="hidden" name="action" value="insertChain" />
<input type="text" name="chain" /> <input type="submit" value="Add" />
</form>
</div>
<div class="tab-page">
      <h2 class="tab">Operations</h2>
<h3>General Operations</h3>
<table width="600" class="tableBorder" border="0" cellpadding="3" cellspacing="0">
<tr class="evenrowbg">
	<td width="150" align="center">
	<form method="post" action="index.php?modules=firewall">
	<input type="hidden" name="action" value="xmlBackup" />
	<input type="image" src="modules/firewall/backup.png" border="0" class="buttonImage">
	</form>
	XML Backup of Filter Rules</td>
	<td width="150" align="center">
	<form method="post" action="index.php?modules=firewall">
	<input type="hidden" name="action" value="iptablesSave" />
	<input type="image" src="modules/firewall/iptablesSave.png" border="0" class="buttonImage">
	</form>
	Save your rules <strong>permanently</strong></td>
	<td width="150" align="center">
	<form method="post" action="index.php?modules=firewall">
	<input type="hidden" name="action" value="cleanAll" />
	<input type="image" src="modules/firewall/cleanAll.png" border="0" class="buttonImage" onClick="return confirm('Are you sure?');">
	</form>
	Clean <strong>ALL</strong> Filter Rules!</td>
		<td width="150" align="center">
	<form method="post" action="index.php?modules=firewall">
	<input type="hidden" name="action" value="" />
	<input type="image" src="modules/firewall/reload.png" border="0" class="buttonImage">
	</form>
	Reload this page</td>
</tr>
</table>
	 </div>
</div>
<script type="text/javascript">
setupAllTabs();
</script>
<br />
<? if (!empty($feedback)) echo "<div id=\"feedback\" class=\"info\">$feedback</div><br />\n"; ?>
<br /><br />
<? author(); ?>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -