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

View file

@ -19,6 +19,19 @@
</select> </select>
<input type="submit" name="ok" value="" class="submenu-button-select"> <input type="submit" name="ok" value="" class="submenu-button-select">
</div> </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(); ?> <?php display_error_block(); ?>
</td> </td>
</tr> </tr>