Răsfoiți Sursa

cron email reporting

Serghey Rodin 11 ani în urmă
părinte
comite
baae928144

+ 0 - 0
bin/v-add-cron-report → bin/v-add-cron-reports


+ 13 - 11
bin/v-update-sys-firewall

@@ -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
-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
 # Enabling stateful firewall
 if [ "$stateful" != 'no' ]; then
 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
 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

+ 13 - 0
web/add/cron/reports/index.php

@@ -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;

+ 13 - 0
web/delete/cron/reports/index.php

@@ -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;

+ 13 - 0
web/templates/admin/list_cron.html

@@ -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>

+ 13 - 0
web/templates/user/list_cron.html

@@ -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>