Location: PHPKode > projects > SCOP Heartbeat Administration interface > scop-2.0/html/scop/config/uploadfirewall.php

<?
include ("../inc/header.inc");
include ("../inc/functions.inc");

# This page allows you to upload a new firewall script...
# The firewall script is /etc/rc.d/rc.firewall
$trans="18c";
$a18c = "${$l.$trans}";
$trans="4";
$a4 = "${$l.$trans}";
//echo "<center><h2>$a18c</h2>";
?>
<div id="contentArea">
<h1><a href="/scop/index.php?menu=maint&l=<?=$l?>"><?=$a4?></a> &gt; <?=$a18c?></h1>
<div class="border">			
<?

//echo "This form allows you to change the firewall script  /etc/rc.d/rc.firewall</br>";
//echo "<h3>WARNING: Don't change this unless you know what you are doing !</h3>";
//echo "<i>NB. Obviously you can always change this using SCP if you prefer.</i></br>";

#echo "An interesting feature of this script is the ability to  apply 'firewall marks' to create multiple port services,</br>";
#echo "for example if you wanted to link HTTP & HTTPS as a single persistent virtual server.";




if ($action=="update") {
		SCOP_log("Config : New Firewall script installed");
		$mainfirewall = $_POST['mainfirewall'];
		$mainfirewall = str_replace("\r","",$mainfirewall);
		$mainfirewall = stripslashes($mainfirewall);
		# . addlinebr($mainfirewall);
		# Open a file and write the contents of the field to it !
		exec ("sudo chmod 777 /etc/rc.d/rc.firewall");
		if ($file=fopen("/etc/rc.d/rc.firewall","w")) {

				fputs($file,$mainfirewall,strlen($mainfirewall));
				fclose($file);
				`sudo /etc/rc.d/rc.firewall`;
				echo "</br></br><center><p>The firewall script has now been updated. </p></br></br></center>";
				#Copy settings to slave
			flush();
			exec ("sudo scp /etc/rc.d/rc.firewall hide@address.com:/etc/rc.d/rc.firewall > /dev/null 2>&1 &");
		} else {

			draw_no_access ("/etc/rc.d/rc.firewall");
		}
} else

{

	if ($file=fopen("/etc/rc.d/rc.firewall","r")) {
		while (!feof ($file)) {
			$mainfirewall = $mainfirewall . fgets($file);
		}
			fclose($file);

	} else {
  		draw_no_access ("/etc/rc.d/rc.firewall");
	}

	echo "<FORM method=\"post\" action=\"?action=update&t=$t\">";
	echo "<table>";
	echo "<tr><td>";
	echo "<textarea  name=\"mainfirewall\" cols=\"90\" rows=\"15\">$mainfirewall</textarea></td></tr>";
	echo "</table>";
	echo "<center><INPUT type=\"submit\" value=\"$a18c\" name=\"go\" >";
	echo "</FORM></center>";
}
?>
</div>
<div class="bottom"><span>-----</span></div>
</div>
<?

// echo "<a href=\"/index.html\"></br>View the current maintenance page</a></br>";
//echo "</br><b>Securtity Tip :</b> <i>It is important that you use your main network firewall to lock down the SCOP.</i></br>";
//echo "<i>Using a firewall here is for people who like the 'belt & braces' approach to security.</i></br>";


include ("../inc/footer.inc");

?>


Return current item: SCOP Heartbeat Administration interface