Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cpanel migrate - CGI folder and some scripts have been setup #940

Open
shoulders opened this issue Oct 21, 2024 · 9 comments
Open

cpanel migrate - CGI folder and some scripts have been setup #940

shoulders opened this issue Oct 21, 2024 · 9 comments

Comments

@shoulders
Copy link

SYSTEM INFORMATION
OS type and version Ubuntu Linux 22.04.5
Usermin version 2.102
Virtualmin version 7.20.2 Pro
Theme version 21.20.7
Apache version 2.4.52
Package updates 8 package updates are available

the issue

I imported a cpanel account in to virtualmin and it has created the following folder and CGI scripts

image

  • I do not have CGI installed and this is not in my server template.
  • The PHP version is currently PHP-FPM
  • I did notice during the import procedure it said it was setting up some CGI stuff but I just ignored it because I did not know if this was normal

image

image

proposed solution

Don't install CGI stuff when CGI is not selected.

@jcameron
Copy link
Collaborator

Hmm, that's odd that those CGI wrappers would be created when they aren't needed!

To help debug this, it would be useful to see the output from the migration process. Also, if you create a new domain on your system, does it get those php*.cgi files?

@shoulders
Copy link
Author

it would be useful to see the output from the migration process.

Is this the text that appears on screen while migrating?

I will runs some tests, clarify and get you the information.

@shoulders
Copy link
Author

What I have done

  • I imported the 2 of my cpanel accounts into my dev server and could not get these folders to appear
  • I created a new virtualserver on my dev site and the folders did not appear
  • I created a new server on my live site using both my internal and clients template, these CGI files did not appear.
  • Of the 4 cpanel accounts I imported into my live site
    • 2 of them have the CGI files present
    • all of them had /home/user/etc/phpx.x for each version of php installed (nb: some of my other sites don't have all version represented here)

my thoughts

  • There is something on my love server that was not cleanup properly that the migrate script is still using.
  • I don't know why only 2 out of the

requested details

Create New site - no folders - (From my dev site) ![image](https://github.com/user-attachments/assets/49a04ee8-0cf5-4598-95a2-2ebee0995a8d)
Saving server details ..
.. done

Creating administration group toenail ..
.. done

Creating administration user toenail ..
.. done

Creating aliases for administration user ..
.. done

Adding administration user to groups ..
.. done

Creating home directory ..
.. done

Creating mailbox for administration user ..
.. done

Adding new DNS zone ..
.. done

Adding to email domains list ..
.. done

Adding default mail aliases ..
.. done

Adding new virtual website ..
.. done

Setting up CGI scripts support with suEXEC execution mode ..
.. done

Adding webserver user www-data to server's group ..
.. done

Performing other Apache configuration ..
.. done

Creating SSL certificate and private key ..
.. done

Adding new SSL virtual website ..
.. done

Setting up log file rotation ..
.. done

Creating MariaDB login ..
.. done

Setting up spam filtering ..
.. done

Setting up AWStats reporting ..
.. done

Setting up password protection for AWStats ..
.. done

Creating Webmin user ..
.. done

Saving server details ..
.. done

Applying DNS zone for toenailxxx.com ..
.. done

Applying webserver configuration ..
.. done

Restarting PHP-FPM 8.2 server ..
.. done

Re-loading Webmin ..
.. done

Re-starting Usermin ..
.. done

Restarting mail server ..
.. done

Updating Webmin user ..
.. done

Setting up initial SSL certificate ..
.. keeping self-signed certificate

Creating initial website index page ..
.. done

Re-loading Webmin ..
.. done
Import site - no folders - (From my dev site) - this in my live site had the CGI files ![image](https://github.com/user-attachments/assets/49a04ee8-0cf5-4598-95a2-2ebee0995a8d)
Uploading migration file ..
.. uploaded 670.27 MiB

Validating migration file ..
.. done

Starting migration of thelambs.co.uk from uploaded file ..

    Checking for cPanel features ..
    .. found Home directory, Administration user, Apache website, Log file rotation, Webmin login, DNS domain, Mail for domain, AWStats reporting, MariaDB database .
    However, the follow features are not supported or enabled on your system : Webalizer reporting. Some functions of the migrated virtual server may not work.

    Checking for clashes and dependencies ..
    .. all OK
    Creating initial virtual server thelambs.co.uk ..
        Saving server details ..
        .. done
        Creating administration group chickenuser ..
        .. done
        Creating administration user chickenuser ..
        .. done
        Creating aliases for administration user ..
        .. done
        Adding administration user to groups ..
        .. done
        Creating home directory ..
        .. done
        Creating mailbox for administration user ..
        .. done
        Adding new DNS zone ..
        .. done
        Adding to email domains list ..
        .. done
        Adding new virtual website ..
        .. done
        Setting up CGI scripts support with suEXEC execution mode ..
        .. done
        Adding webserver user www-data to server's group ..
        .. done
        Performing other Apache configuration ..
        .. done
        Setting up log file rotation ..
        .. done
        Creating MariaDB login ..
        .. done
        Setting up AWStats reporting ..
        .. done
        Setting up password protection for AWStats ..
        .. done
        Creating Webmin user ..
        .. done
        Saving server details ..
        .. done
        Applying DNS zone for thelambs.co.uk ..
        .. done
        Applying webserver configuration ..
        .. done
        Restarting PHP-FPM 8.2 server ..
        .. done
        Re-loading Webmin ..
        .. done
        Updating Webmin user ..
        .. done
        Re-loading Webmin ..
        .. done
    .. done
    Copying home directory to /home/chickenuser ..
    .. done
    Fixing home directory permissions ..
    .. done
    Re-creating mail users for thelambs.co.uk ..
    .. done (migrated 1 mail users)
    Moving server owner's mailbox ..
    .. done
    Copying email aliases ..
    .. done (migrated 1 aliases)
    Copying Cron jobs ..
    .. done
    Re-creating and loading MySQL databases ..
        Creating MariaDB database chickenuser_presta ..
        .. done
        Creating MariaDB database chickenuser_joomla ..
        .. done
        Creating MariaDB database chickenuser_cms ..
        .. done
    .. done (created 3 databases)
    Re-creating MySQL users ..
    .. done (created 3 MySQL users)
    Re-creating FTP users ..
    .. done (created 0 FTP users)
    Copying AWstats data files ..
    .. done
    Applying webserver configuration ..
    .. done
    Restarting PHP-FPM 8.2 server ..
    .. done

Successfully migrated thelambs.co.uk virtual server, click here to manage it.

@jcameron
Copy link
Collaborator

Hmmm ... I'm not sure what could be going on here then. Maybe the default PHP mode wasn't set to FPM when a domain was imported, and thus those .cgi files were created?

@shoulders
Copy link
Author

I don't have the php CGI mode available as I removed it. I think I removed php-cgi module for each php version.

I did have them installed at one point, I think.

Only php-fpm is available.

It is almost like some of the behind the scenes handling of php-cgi is being triggered as if it were installed.

Parts of the template system might be being ignored for php when you import.

Are there hardcoded rules for handling CGI?

Is the import saying cpanel had CGI so I will now add CGI files?

Tricky one. I can't see anything obvious.

@jcameron
Copy link
Collaborator

No, we don't even get the PHP mode from the cPanel backup. Hard to say what's going on here unless it can be re-produced, as I don't see any obvious trigger for this in the code.

@jcameron
Copy link
Collaborator

Actually ... I did find one code path where the .cgi wrappers can be created unnecessarily. I'll fix this for the next release : 4e3efd2

@iliajie
Copy link
Collaborator

iliajie commented Oct 22, 2024

I did find one code path where the .cgi wrappers can be created unnecessarily. I'll fix this for the next release : 4e3efd2

Even with this patch, if this function is called, like in FPM mode, it will still default to &cgi_bin_dir($_[0]), and create ~/cgi-bin and stuff, right?

Why not just add after $mode:

return if ($mode !~ /cgi/);

@jcameron
Copy link
Collaborator

But cgi-bin directories are different from PHP .cgi wrappers.

I will clean up those if statements though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants