Kaynağa Gözat

- Added system wide var to disable the allow users check
- Removed the check on a non exstied domain. (.test) for example
- Restart web after changing fast cache status

Jaap Marcus 5 yıl önce
ebeveyn
işleme
a013122f43

+ 2 - 1
bin/v-list-sys-config

@@ -67,7 +67,8 @@ json_list() {
         "DB_PGA_ALIAS": "'$DB_PGA_ALIAS'",
         "DB_PGA_ALIAS": "'$DB_PGA_ALIAS'",
         "LOGIN_STYLE": "'$LOGIN_STYLE'",
         "LOGIN_STYLE": "'$LOGIN_STYLE'",
         "INACTIVE_SESSION_TIMEOUT": "'$INACTIVE_SESSION_TIMEOUT'",
         "INACTIVE_SESSION_TIMEOUT": "'$INACTIVE_SESSION_TIMEOUT'",
-        "PHPMYADMIN_KEY": "'$PHPMYADMIN_KEY'"
+        "PHPMYADMIN_KEY": "'$PHPMYADMIN_KEY'",
+        "ALLOW_USERS_SYSTEM": "'$ALLOW_USERS_SYSTEM'"
     }
     }
     }'
     }'
 }
 }

+ 10 - 11
func/domain.sh

@@ -881,9 +881,6 @@ is_valid_extension() {
     test_domain=$(idn -t --quiet -u "$1" )
     test_domain=$(idn -t --quiet -u "$1" )
     extension=$( /bin/echo "${test_domain}" | /usr/bin/rev | /usr/bin/cut -d "." --output-delimiter="." -f 1 | /usr/bin/rev );
     extension=$( /bin/echo "${test_domain}" | /usr/bin/rev | /usr/bin/cut -d "." --output-delimiter="." -f 1 | /usr/bin/rev );
     exten=$(grep "^$extension\$" $HESTIA/data/extensions/public_suffix_list.dat);
     exten=$(grep "^$extension\$" $HESTIA/data/extensions/public_suffix_list.dat);
-    if [ $? -ne 0 ]; then
-        check_result 2 ".$extension is not valid"
-    fi
 }
 }
 
 
 is_valid_2_part_extension() {
 is_valid_2_part_extension() {
@@ -901,7 +898,7 @@ get_base_domain() {
     test_domain=$1
     test_domain=$1
     is_valid_extension "$test_domain"
     is_valid_extension "$test_domain"
     if [ $? -ne 0 ]; then
     if [ $? -ne 0 ]; then
-        basedomain=""
+        basedomain=$( /bin/echo "${test_domain}" | /usr/bin/rev | /usr/bin/cut -d "." --output-delimiter="." -f 1-2 | /usr/bin/rev ); 
     else 
     else 
         is_valid_2_part_extension "$test_domain"
         is_valid_2_part_extension "$test_domain"
         if [ $? -ne 0 ]; then
         if [ $? -ne 0 ]; then
@@ -919,14 +916,16 @@ is_base_domain_owner(){
         if [ "$object" != "none" ]; then
         if [ "$object" != "none" ]; then
             get_base_domain $object
             get_base_domain $object
             web=$(grep -F -H -h "DOMAIN='$basedomain'" $HESTIA/data/users/*/web.conf);
             web=$(grep -F -H -h "DOMAIN='$basedomain'" $HESTIA/data/users/*/web.conf);
-            if [ ! -z "$web" ]; then
-                parse_object_kv_list "$web"
-                if [ -z "$ALLOW_USERS" ] ||  [ "$ALLOW_USERS" != "yes" ]; then
-                # Don't care if $basedomain all ready exists only if the owner is of the base domain is the current user
-                is_domain_new "" $basedomain
+            if [ $ALLOW_USERS_SYSTEM = "no" ]; then
+                if [ ! -z "$web" ]; then
+                    parse_object_kv_list "$web"
+                    if [ -z "$ALLOW_USERS" ] ||  [ "$ALLOW_USERS" != "yes" ]; then
+                    # Don't care if $basedomain all ready exists only if the owner is of the base domain is the current user
+                    is_domain_new "" $basedomain
+                    fi
+                else
+                    is_domain_new "" $basedomain
                 fi
                 fi
-            else
-                is_domain_new "" $basedomain
             fi
             fi
         fi
         fi
     done
     done

+ 6 - 1
func/upgrade.sh

@@ -143,7 +143,12 @@ upgrade_health_check() {
         echo "[ ! ] Adding missing variable to hestia.conf: INACTIVE_SESSION_TIMEOUT ('60')"
         echo "[ ! ] Adding missing variable to hestia.conf: INACTIVE_SESSION_TIMEOUT ('60')"
         $BIN/v-change-sys-config-value "INACTIVE_SESSION_TIMEOUT" "60"
         $BIN/v-change-sys-config-value "INACTIVE_SESSION_TIMEOUT" "60"
     fi
     fi
-    
+
+    # Inactive session timeout
+    if [ -z "$ALLOW_USERS_SYSTEM" ]; then
+        echo "[ ! ] Adding missing variable to hestia.conf: ALLOW_USERS_SYSTEM ('yes')"
+        $BIN/v-change-sys-config-value "ALLOW_USERS_SYSTEM" "yes"
+    fi    
     
     
     echo "[ * ] Health check complete. Starting upgrade from $VERSION to $new_version..."
     echo "[ * ] Health check complete. Starting upgrade from $VERSION to $new_version..."
     echo "============================================================================="
     echo "============================================================================="

+ 3 - 0
install/hst-install-debian.sh

@@ -1094,6 +1094,9 @@ echo "LOGIN_STYLE='default'" >> $HESTIA/conf/hestia.conf
 # Inactive session timeout
 # Inactive session timeout
 echo "INACTIVE_SESSION_TIMEOUT='60'" >> $HESTIA/conf/hestia.conf
 echo "INACTIVE_SESSION_TIMEOUT='60'" >> $HESTIA/conf/hestia.conf
 
 
+# Allow users to always create domains even the are not the owner of the main domain
+echo "ALLOW_USERS_SYSTEM='yes'" >> $HESTIA/conf/hestia.conf
+
 # Version & Release Branch
 # Version & Release Branch
 echo "VERSION='${HESTIA_INSTALL_VER}'" >> $HESTIA/conf/hestia.conf
 echo "VERSION='${HESTIA_INSTALL_VER}'" >> $HESTIA/conf/hestia.conf
 echo "RELEASE_BRANCH='release'" >> $HESTIA/conf/hestia.conf
 echo "RELEASE_BRANCH='release'" >> $HESTIA/conf/hestia.conf

+ 3 - 0
install/hst-install-ubuntu.sh

@@ -1127,6 +1127,9 @@ echo "LOGIN_STYLE='default'" >> $HESTIA/conf/hestia.conf
 # Inactive session timeout
 # Inactive session timeout
 echo "INACTIVE_SESSION_TIMEOUT='60'" >> $HESTIA/conf/hestia.conf
 echo "INACTIVE_SESSION_TIMEOUT='60'" >> $HESTIA/conf/hestia.conf
 
 
+# Allow users to always create domains even the are not the owner of the main domain
+echo "ALLOW_USERS_SYSTEM='yes'" >> $HESTIA/conf/hestia.conf
+
 # Version & Release Branch
 # Version & Release Branch
 echo "VERSION='${HESTIA_INSTALL_VER}'" >> $HESTIA/conf/hestia.conf
 echo "VERSION='${HESTIA_INSTALL_VER}'" >> $HESTIA/conf/hestia.conf
 echo "RELEASE_BRANCH='release'" >> $HESTIA/conf/hestia.conf
 echo "RELEASE_BRANCH='release'" >> $HESTIA/conf/hestia.conf

+ 1 - 0
web/add/web/index.php

@@ -168,6 +168,7 @@ if (!empty($_POST['ok'])) {
         exec (HESTIA_CMD."v-delete-web-domain-proxy ".$user." ".escapeshellarg($v_domain)." 'no'", $output, $return_var);
         exec (HESTIA_CMD."v-delete-web-domain-proxy ".$user." ".escapeshellarg($v_domain)." 'no'", $output, $return_var);
         check_return_code($return_var,$output);
         check_return_code($return_var,$output);
         unset($output);
         unset($output);
+        $restart_web = 'yes';
     }
     }
     
     
     // Change template
     // Change template

+ 12 - 1
web/edit/server/index.php

@@ -657,7 +657,7 @@ if (!empty($_POST['save'])) {
         }
         }
     }
     }
 
 
-    // Change login style
+    // Change INACTIVE_SESSION_TIMEOUT
     if (empty($_SESSION['error_msg'])) {
     if (empty($_SESSION['error_msg'])) {
         if ($_POST['v_inactive_session_timeout'] != $_SESSION['INACTIVE_SESSION_TIMEOUT']) {
         if ($_POST['v_inactive_session_timeout'] != $_SESSION['INACTIVE_SESSION_TIMEOUT']) {
             exec (HESTIA_CMD."v-change-sys-config-value INACTIVE_SESSION_TIMEOUT ".escapeshellarg($_POST['v_inactive_session_timeout']), $output, $return_var);
             exec (HESTIA_CMD."v-change-sys-config-value INACTIVE_SESSION_TIMEOUT ".escapeshellarg($_POST['v_inactive_session_timeout']), $output, $return_var);
@@ -667,6 +667,17 @@ if (!empty($_POST['save'])) {
             $v_security_adv = 'yes';
             $v_security_adv = 'yes';
         }
         }
     }
     }
+    
+    // Change ALLOW_USERS_SERVER
+    if (empty($_SESSION['error_msg'])) {
+        if ($_POST['v_allow_users_system'] != $_SESSION['v_allow_users_system']) {
+            exec (HESTIA_CMD."v-change-sys-config-value ALLOW_USERS_SYSTEM ".escapeshellarg($_POST['v_allow_users_system']), $output, $return_var);
+            check_return_code($return_var,$output);
+            unset($output);
+            if (empty($_SESSION['error_msg'])) $v_allow_users_system = $_POST['v_allow_users_system'];
+            $v_security_adv = 'yes';
+        }
+    }
 
 
     // Change login style
     // Change login style
     if (empty($_SESSION['error_msg'])) {
     if (empty($_SESSION['error_msg'])) {

+ 1 - 0
web/edit/web/index.php

@@ -333,6 +333,7 @@ if (!empty($_POST['save'])) {
             check_return_code($return_var,$output);
             check_return_code($return_var,$output);
             unset($output); 
             unset($output); 
         }
         }
+        $restart_proxy = 'yes';
     }
     }
 
 
     // Delete proxy support
     // Delete proxy support

+ 15 - 1
web/templates/admin/edit_server.html

@@ -982,7 +982,7 @@
                                         </tr>
                                         </tr>
                                         <tr>
                                         <tr>
                                             <td class="vst-text input-label">
                                             <td class="vst-text input-label">
-                                                <?php print _('Inactive session length');?> (<?php print _('Minutes');?>)
+                                                <?php print _('Inactive session timeout');?> (<?php print _('Minutes');?>)
                                             </td>
                                             </td>
                                         </tr>
                                         </tr>
                                         <tr>
                                         <tr>
@@ -991,6 +991,20 @@
                                                 <br><br>
                                                 <br><br>
                                             </td>
                                             </td>
                                         </tr>
                                         </tr>
+                                        <tr>
+                                            <td class="vst-text input-label">
+                                                <?php print _('Disable check domain owner');?>
+                                            </td>
+                                        </tr>
+                                        <tr>
+                                            <td>
+                                                <select class="vst-list" name="v_allow_users_system">
+                                                    <option value='yes'><?php print _('yes'); ?></option>
+                                                    <option value='no' <?php if($_SESSION['ALLOW_USERS_SYSTEM'] == 'no') echo 'selected' ?> ><?php print _('no'); ?></option>
+                                                </select>
+                                                <br><br>
+                                            </td>
+                                        </tr>
                                     </table>
                                     </table>
                                 </td>
                                 </td>
                             </tr>
                             </tr>