cron email reporting

This commit is contained in:
Serghey Rodin 2014-09-24 02:52:24 +03:00
commit baae928144
6 changed files with 65 additions and 11 deletions

View file

@ -55,7 +55,6 @@ IFS=$'\n'
for line in $(sort -r -n -k 2 -t \' $rules); do
eval $line
if [ "$SUSPENDED" = 'no' ]; then
chain="-A INPUT"
proto="-p $PROTOCOL"
port="--dport $PORT"
ip="-s $IP"
@ -83,22 +82,22 @@ for line in $(sort -r -n -k 2 -t \' $rules); do
fi
# Adding firewall rule
echo "$iptables $chain $proto $port $ip $state $action" >> $tmp
echo "$iptables -A INPUT $proto $port $ip $state $action" >> $tmp
fi
done
# Handling DNS replies
proto="-p udp"
port="--sport 53"
action="-j ACCEPT"
echo "$iptables $chain $proto $port $state $action" >> $tmp
# Handling local traffic
echo "$iptables -A INPUT -p udp --sport 53 -j ACCEPT" >> $tmp
echo "$iptables -A INPUT -s 127.0.0.1 -j ACCEPT" >> $tmp
for ip in $(ls $VESTA/data/ips); do
echo "$iptables -A INPUT -s $ip -j ACCEPT" >> $tmp
done
# Enabling stateful firewall
if [ "$stateful" != 'no' ]; then
proto="-p tcp"
state="-m state --state ESTABLISHED,RELATED"
action="-j ACCEPT"
echo "$iptables $chain $proto $state $action" >> $tmp
str="$iptables -A INPUT -p tcp -m state"
str="$str --state ESTABLISHED,RELATED -j ACCEPT"
echo "$str" >> $tmp
fi
# Switching chain policy to DROP
@ -107,6 +106,9 @@ echo "$iptables -P INPUT DROP" >> $tmp
# Applying rules
bash $tmp
# Deleting temporary file
rm -f $tmp
# Saving rules to the master iptables file
if [ -e "/etc/redhat-release" ]; then
/sbin/iptables-save > /etc/sysconfig/iptables

View file

@ -0,0 +1,13 @@
<?php
// Init
error_reporting(NULL);
ob_start();
session_start();
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
exec (VESTA_CMD."v-add-cron-reports ".$user, $output, $return_var);
$_SESSION['error_msg'] = __('Cronjob email reporting has been successfully enabled');
unset($output);
header("Location: /list/cron/");
exit;

View file

@ -0,0 +1,13 @@
<?php
// Init
error_reporting(NULL);
ob_start();
session_start();
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
exec (VESTA_CMD."v-delete-cron-reports ".$user, $output, $return_var);
$_SESSION['error_msg'] = __('Cronjob email reporting has been successfully disabled');
unset($output);
header("Location: /list/cron/");
exit;

View file

@ -21,6 +21,19 @@
</select>
<input type="submit" name="ok" value="" class="submenu-button-select">
</div>
<div class="submenu-select-block">
<?php
if($panel[$user]['CRON_REPORTS'] == 'yes') {
?>
<a class="submenu-select-link" href="/delete/cron/reports/">[ <?php print __('disable email reports');?> ]</a>
<?php
} else {
?>
<a class="submenu-select-link" href="/add/cron/reports/">[ <?php print __('enable email reports');?> ]</a>
<?php
}
?>
</div>
<?php display_error_block(); ?>
</td>
</tr>

View file

@ -19,6 +19,19 @@
</select>
<input type="submit" name="ok" value="" class="submenu-button-select">
</div>
<div class="submenu-select-block">
<?php
if($panel[$user]['CRON_REPORTS'] == 'yes') {
?>
<a class="submenu-select-link" href="/delete/cron/reports/">[ <?php print __('disable email reports');?> ]</a>
<?php
} else {
?>
<a class="submenu-select-link" href="/add/cron/reports/">[ <?php print __('enable email reports');?> ]</a>
<?php
}
?>
</div>
<?php display_error_block(); ?>
</td>
</tr>