From 2f813641d14c2bd5fdc7a8b789ac61f83ba0857a Mon Sep 17 00:00:00 2001 From: Tom Schaefer Date: Wed, 6 Oct 2010 01:50:20 -0400 Subject: ver1.8 email notifications and new cron script --- config/countryblock/email.tmp | 282 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 282 insertions(+) create mode 100644 config/countryblock/email.tmp (limited to 'config/countryblock/email.tmp') diff --git a/config/countryblock/email.tmp b/config/countryblock/email.tmp new file mode 100644 index 00000000..3b5aa3f2 --- /dev/null +++ b/config/countryblock/email.tmp @@ -0,0 +1,282 @@ +IsSMTP();\n\$mail->SMTPAuth = ") or die("Couldn't write values to file!"); + fwrite($fp, $smtp_auth) or die("Couldn't write values to file!"); + fwrite($fp, ";\n\$mail->SMTPSecure = \"") or die("Couldn't write values to file!"); + fwrite($fp, $smtp_secure) or die("Couldn't write values to file!"); + fwrite($fp, "\";\n\$mail->Host = \"") or die("Couldn't write values to file!"); + fwrite($fp, $host) or die("Couldn't write values to file!"); + fwrite($fp, "\";\n\$mail->Port = ") or die("Couldn't write values to file!"); + fwrite($fp, $port) or die("Couldn't write values to file!"); + fwrite($fp, ";\n\$mail->Username = \"") or die("Couldn't write values to file!"); + fwrite($fp, $user) or die("Couldn't write values to file!"); + fwrite($fp, "\";\n\$mail->Password = \"") or die("Couldn't write values to file!"); + fwrite($fp, $pass) or die("Couldn't write values to file!"); + fwrite($fp, "\";\n\$mail->AddReplyTo(\"") or die("Couldn't write values to file!"); + fwrite($fp, $from) or die("Couldn't write values to file!"); + fwrite($fp, "\",\"pfsense countryblock\");\n\$mail->From = \"") or die("Couldn't write values to file!"); + fwrite($fp, $from) or die("Couldn't write values to file!"); + fwrite($fp, "\";\n\$mail->Subject = \"Countryblock - pfsense\";\n\$mail->AltBody = \"To view the message, please use an HTML compatible email viewer!\";\n\$mail->WordWrap = 50;\n\$body = \"Countryblock encountered an event. A system log entry was made with details of event\";\n\$body .= \"

\" . date('l jS \of F Y h:i:s A') . \"

Current Status = \";\nob_start();\n\$results = exec(\"pfctl -s rules | grep -c countryblock\");\nob_end_clean();\nif (\$results > '0')\n\$body .= \"Running\";\nelse\n\$body .= \"Restarting\";\nob_start();\n\$results = exec(\"tail -r /usr/local/www/packages/countryblock/errorOUT.txt\");\nob_end_clean();\n\$body .= \"
\";\n\$body .= \$results;\n\$body .= \"\";\n\$body .= \"
You are blocking \";\nob_start();\n\$results = exec(\"pfctl -T show -t countryblock |grep -v -c Z\");\nob_end_clean();\n\$body .= \$results;\n\$body .= \" Networks\";\n\n\$mail->MsgHTML(\$body);\n\$mail->AddAddress(\"") or die("Couldn't write values to file!"); + fwrite($fp, $to) or die("Couldn't write values to file!"); + fwrite($fp, "\");\n\$mail->IsHTML(") or die("Couldn't write values to file!"); + fwrite($fp, $html) or die("Couldn't write values to file!"); + fwrite($fp, ");\n\nif(!\$mail->Send()) {\n echo \"Mailer Error: \" . \$mail->ErrorInfo;\n} else {\n echo \"Message sent! - Go Back\";\n}\n?>") or die("Couldn't write values to file!"); + fclose($fp); + //echo "Saved successfully!"; + + exec("rm email_config.html"); + exec("touch email_config.html"); + $file2 = "email_config.html"; + $fp2 = fopen($file2, "w") or die("Couldn't open $file for writing!"); + fwrite($fp2, " + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
SMTP Auth
SMTP Security
Host
Port
Username
Password
Use HTML formatting
From email address
To email address
Subject
+
+ +") or die("Couldn't write values to file!"); + fclose($fp2); +} +if (isset($_GET['test'])) { + echo ''; +} +if (isset($_GET['reset'])) { + exec ("rm email_send.php"); + exec ("rm email_config.html"); + echo ''; +} +?> + + + + + + + + +

+ + + + + + + + + + + + +
+ +
+
+ + + + + + + + + +
Email Settings for SMTP mail
+ + + + + +Your settings have already been set. Would you like to overwrite your email settings?

\n"; + $content = file_get_contents('email_config.html'); + echo $content; + echo "

\n"; + echo "\n"; + echo "

\n"; + echo "\n"; +} else { + echo "
\n"; +echo " \n"; +echo " \n"; +echo " \n"; +echo " \n"; +echo " \n"; +echo " \n"; +echo " \n"; +echo " \n"; +echo " \n"; +echo " \n"; +echo " \n"; +echo " \n"; +echo " \n"; +echo " \n"; +echo " \n"; +echo " \n"; +echo " \n"; +echo " \n"; +echo " \n"; +echo " \n"; +echo " \n"; +echo " \n"; +echo " \n"; +echo " \n"; +echo " \n"; +echo " \n"; +echo " \n"; +echo " \n"; +echo " \n"; +echo " \n"; +echo " \n"; +echo " \n"; +echo " \n"; +echo " \n"; +echo " \n"; +echo " \n"; +echo " \n"; +echo " \n"; +echo " \n"; +echo " \n"; +echo "
SMTP Auth
SMTP Security
Host
Port
Username
Password
Use HTML formatting
From email address
To email address
Subject
\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +} +?> + + + + +
+
+ +
+ '0') echo "Running"; + else + echo "NOT running"; + + //Get Errors if exists + ob_start(); + $results = exec("tail -r errorOUT.txt"); + ob_end_clean(); + echo "
"; + echo $results; + echo ""; + + //Get IP Count + echo "
You are blocking "; + ob_start(); + $results = exec("pfctl -T show -t countryblock |grep -v -c Z"); + ob_end_clean(); + echo $results; + echo " Networks"; + ?> + +

+ +

+

+ + + + + + + -- cgit v1.2.3