diff options
author | bmeeks8 <bmeeks8@bellsouth.net> | 2014-10-03 21:28:43 -0400 |
---|---|---|
committer | bmeeks8 <bmeeks8@bellsouth.net> | 2014-12-15 12:04:38 -0500 |
commit | e3bf51ab665dd6551d3b71a777d506dcd8dd10b5 (patch) | |
tree | e8d172039258162376c663406622a4e21dd28ee9 /config/suricata/suricata_blocked.php | |
parent | 8f3b3b0c834eb5c3f7ff762ccaff24aead47a856 (diff) | |
download | pfsense-packages-e3bf51ab665dd6551d3b71a777d506dcd8dd10b5.tar.gz pfsense-packages-e3bf51ab665dd6551d3b71a777d506dcd8dd10b5.tar.bz2 pfsense-packages-e3bf51ab665dd6551d3b71a777d506dcd8dd10b5.zip |
Use system global instead of hard-coded /tmp path.
Diffstat (limited to 'config/suricata/suricata_blocked.php')
-rw-r--r-- | config/suricata/suricata_blocked.php | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/config/suricata/suricata_blocked.php b/config/suricata/suricata_blocked.php index 23e08fcd..61422b4d 100644 --- a/config/suricata/suricata_blocked.php +++ b/config/suricata/suricata_blocked.php @@ -42,6 +42,8 @@ require_once("guiconfig.inc"); require_once("/usr/local/pkg/suricata/suricata.inc"); +global $g, $config; + $suricatalogdir = SURICATALOGDIR; $suri_pf_table = SURICATA_PF_TABLE; @@ -96,20 +98,20 @@ if ($_POST['download']) if (is_array($blocked_ips_array_save) && count($blocked_ips_array_save) > 0) { $save_date = exec('/bin/date "+%Y-%m-%d-%H-%M-%S"'); $file_name = "suricata_blocked_{$save_date}.tar.gz"; - exec('/bin/mkdir -p /tmp/suricata_blocked'); - file_put_contents("/tmp/suricata_blocked/suricata_block.pf", ""); + exec("/bin/mkdir -p {$g['tmp_path']}/suricata_blocked"); + file_put_contents("{$g['tmp_path']}/suricata_blocked/suricata_block.pf", ""); foreach($blocked_ips_array_save as $counter => $fileline) { if (empty($fileline)) continue; $fileline = trim($fileline, " \n\t"); - file_put_contents("/tmp/suricata_blocked/suricata_block.pf", "{$fileline}\n", FILE_APPEND); + file_put_contents("{$g['tmp_path']}/suricata_blocked/suricata_block.pf", "{$fileline}\n", FILE_APPEND); } // Create a tar gzip archive of blocked host IP addresses - exec("/usr/bin/tar -czf /tmp/{$file_name} -C/tmp/suricata_blocked suricata_block.pf"); + exec("/usr/bin/tar -czf {$g['tmp_path']}/{$file_name} -C{$g['tmp_path']}/suricata_blocked suricata_block.pf"); // If we successfully created the archive, send it to the browser. - if(file_exists("/tmp/{$file_name}")) { + if(file_exists("{$g['tmp_path']}/{$file_name}")) { ob_start(); //important or other posts will fail if (isset($_SERVER['HTTPS'])) { header('Pragma: '); @@ -119,14 +121,14 @@ if ($_POST['download']) header("Cache-Control: private, must-revalidate"); } header("Content-Type: application/octet-stream"); - header("Content-length: " . filesize("/tmp/{$file_name}")); + header("Content-length: " . filesize("{$g['tmp_path']}/{$file_name}")); header("Content-disposition: attachment; filename = {$file_name}"); ob_end_clean(); //important or other post will fail - readfile("/tmp/{$file_name}"); + readfile("{$g['tmp_path']}/{$file_name}"); // Clean up the temp files and directory - unlink_if_exists("/tmp/{$file_name}"); - rmdir_recursive("/tmp/suricata_blocked"); + unlink_if_exists("{$g['tmp_path']}/{$file_name}"); + rmdir_recursive("{$g['tmp_path']}/suricata_blocked"); } else $savemsg = gettext("An error occurred while creating archive"); } else |