? ? ? Pending

User tests: Successful: Unsuccessful:

avatar Hackwar
Hackwar
5 Jan 2021

Pull Request for Issue #20774 .

Summary of Changes

Joomla 3.x (and below) supports installing on a system without write permissions for the apache user. This means, that we either provide FTP credentials during installation to write the configuration.php or you get the configuration.php displayed at one point and need to create that file manually. This feature is missing in Joomla 4 right now.

This PR adds that back in. When the installation can't write to the filesystem (specifically the root folder of the installation or an existing configuration.php), it redirects to a preinstall screen, where you can provide the FTP credentials. Below are 2 buttons, one to check the credentials and one to skip this step. There is also a button next to the path field to auto-discover the correct path of the installation.

Clicking the auto-discover button triggers an AJAX request which takes the FTP credentials and tries to connect with those. It then will fill that field. Clicking the "Verify FTP Settings" button checks if all given info is correct and we are now able to write to that folder. "Manually create file" skips this step and later displays the content for the configuration.php.

When displaying the content for the configuration.php, there is a button "Continue", which will check if the configuration.php has been created and then redirects to the "remove" page.

Testing Instructions

  1. Get a setup (preferably on Unix), where only your FTP user has write access to the folder, none else.
  2. Clone this repo and try the installation. Before this PR, you can only progress with the installation when fixing the write permissions. Afterwards you can also install with FTP credentials.

Notes

I'm more than welcome for any PRs to improve the language strings here.

avatar Hackwar Hackwar - open - 5 Jan 2021
avatar Hackwar Hackwar - change - 5 Jan 2021
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 5 Jan 2021
Category Installation Language & Strings JavaScript
avatar Hackwar Hackwar - change - 5 Jan 2021
Labels Added: ? ?
avatar brianteeman
brianteeman - comment - 5 Jan 2021

Does this mean that you have found a way to test this?

avatar Hackwar
Hackwar - comment - 5 Jan 2021

Yes, I've created a VM with a deliberately botched installation. Installed Ubuntu Server, then apache, mysql, php and vsftpd. Added a user "ftpuser" and set /var/www as its home dir, changed the owner to ftpuser and set permissions to 755. Unfortunately I don't think I can share my VM somehow... But that triggered the permissions warning and stops the installation until you have fixed this.

This draft currently is still missing the possibility of simply displaying the configuration.php at the end and some cleanup.

avatar PhilETaylor
PhilETaylor - comment - 8 Jan 2021

Does this mean that you have found a way to test this?
Yes, I've created a VM with a deliberately botched installation.

er..? I spent half a day providing a complete dockerized test environment for this specific issue... I guess no one used it even after I was asked to do that.

avatar Hackwar
Hackwar - comment - 8 Jan 2021

@PhilETaylor I saw your docker container, but for my coding, I needed something else and rolled my own. For testing, your container is a good solution. Since the code currently does not have any of the features to get around an unwritable filesystem, I did my own solution.

avatar Hackwar Hackwar - change - 20 Jan 2021
The description was changed
avatar Hackwar Hackwar - edited - 20 Jan 2021
avatar Hackwar
Hackwar - comment - 20 Jan 2021

So, this should be ready now. Please test! :-)

avatar brianteeman
brianteeman - comment - 29 Jan 2021

With invalid ftp details and using the verify settings button

image

With valid ftp details and using the verify settings button

image

avatar brianteeman
brianteeman - comment - 29 Jan 2021

After entering the mysql details and waiting for it to complete you are silently returned to the first page as shown below

ftp

avatar brianteeman
brianteeman - comment - 29 Jan 2021

@PhilETaylor please create a new issue

avatar brianteeman
brianteeman - comment - 29 Jan 2021

Installing to a remote mysql server did not go through the expected security checks

avatar brianteeman brianteeman - test_item - 29 Jan 2021 - Tested unsuccessfully
avatar PhilETaylor
PhilETaylor - comment - 29 Jan 2021

Installing to a remote mysql server did not go through the expected security checks

If you are using docker, then this can be correct and fine. There is a flag in the base Joomla docker images to bypass the security check (as its NORMAL in docker to not be using a localhost mysql)

see environment JOOMLA_INSTALLATION_DISABLE_LOCALHOST_CHECK here: https://github.com/joomla-docker/docker-joomla/blob/99611523032a31c85cfe37b5dfa750925106adc8/php7.3/apache/Dockerfile#L5

avatar brianteeman
brianteeman - comment - 29 Jan 2021

I have tested this item ? unsuccessfully on 1d6227e


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/31857.

avatar Hackwar Hackwar - change - 29 Jan 2021
Labels Added: Conflicting Files
avatar brianteeman
brianteeman - comment - 14 Mar 2021

Are the errors in this going to be addressed or should we simply remove the ftp option.

avatar Hackwar
Hackwar - comment - 14 Mar 2021

yes, these are going to be fixed eventually.

avatar brianteeman
brianteeman - comment - 14 Mar 2021

Eventually is a wonderful word. It can mean please wait it will be done next week. It could mean I will look at this in two years time when we are hopefully ready to release 5.0

avatar Hackwar Hackwar - change - 18 Mar 2021
Labels Added: ?
Removed: Conflicting Files
avatar Hackwar
Hackwar - comment - 18 Mar 2021

Please check if this fixes your concerns.

avatar brianteeman
brianteeman - comment - 20 Mar 2021

So I get a bit further now (i think)
after entering the mysql details and clicking continue I get a 500 error

Warning: include_once(/var/www/html/4/configuration.php): failed to open stream: Permission denied in /var/www/html/4/libraries/loader.php on line 265

Warning: include_once(): Failed opening '/var/www/html/4/configuration.php' for inclusion (include_path='.:/usr/local/lib/php') in /var/www/html/4/libraries/loader.php on line 265
avatar brianteeman
brianteeman - comment - 20 Mar 2021

note that the configuration.php is created and all the values look correct

avatar rdeutz
rdeutz - comment - 26 Mar 2021

@Hackwar can you have a look at Brian comments

avatar brianteeman
brianteeman - comment - 26 Mar 2021

There is another issue which I am sure will occur is with the creation of the autoload_psr4.php file but as I havent been able to get as far as a complete install using ftp I cannot be 100% certain. However I cant see how it can be created on a site that requires ftp to create the configuration.php

avatar brianteeman brianteeman - test_item - 2 Apr 2021 - Tested unsuccessfully
avatar brianteeman
brianteeman - comment - 2 Apr 2021

I have tested this item ? unsuccessfully on 183c748

Forgot to record my tests before


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/31857.

avatar brianteeman
brianteeman - comment - 16 Apr 2021

there really is no point in having ftp during installation if you cant update with ftp

avatar PhilETaylor
PhilETaylor - comment - 22 Apr 2021

There is another issue which I am sure will occur is with the creation of the autoload_psr4.php file

This is written using the Filesystem API File::write() method, which is "FTP Aware".

avatar PhilETaylor
PhilETaylor - comment - 22 Apr 2021

There is another issue which I am sure will occur is with the creation of the autoload_psr4.php file

However, without any FTP Credentials yet stored, this file cannot be written when first visiting /installation/index.php

Screenshot 2021-04-22 at 17 09 50

This comment is about 4.0-dev and not this PR, which is still downloading for me at the moment

avatar PhilETaylor
PhilETaylor - comment - 22 Apr 2021

The " Prebuilt packages are available for download." are not available for this PR either...

https://ci.joomla.org/artifacts/joomla/joomla-cms/4.0-dev/31857/downloads/40857 is a 404

avatar PhilETaylor PhilETaylor - test_item - 22 Apr 2021 - Tested unsuccessfully
avatar PhilETaylor
PhilETaylor - comment - 22 Apr 2021

I have tested this item ? unsuccessfully on 183c748

just like 4.0-dev, this PR doesn't address the initial save of the "autoload_psr4" when /installation/index.php is loaded, resulting in an error message

https://user-images.githubusercontent.com/400092/115747875-91658d80-a38d-11eb-8413-e3eec6ca37cc.png


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/31857.
avatar PhilETaylor PhilETaylor - test_item - 22 Apr 2021 - Tested unsuccessfully
avatar PhilETaylor
PhilETaylor - comment - 22 Apr 2021

I have tested this item ? unsuccessfully on 183c748

If I allow the autoload_psr4 file to be written directly (by 777 the cache folder "for testing only") I get a little further...

If I then select "Manually" and attempt to install Joomla 4, I get to the point where its actually inserting data to the database and then I get an error

Screenshot 2021-04-22 at 17 22 12


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/31857.
avatar brianteeman
brianteeman - comment - 22 Apr 2021

There is another issue which I am sure will occur is with the creation of the autoload_psr4.php file

However, without any FTP Credentials yet stored, this file cannot be written when first visiting /installation/index.php

Exactly my point - but its actually worse than that as FTP credentials are never saved now and you have to re-enter them each time they are needed. So this can never work for autoload

avatar brianteeman
brianteeman - comment - 22 Apr 2021

@rdeutz its been a month now. Is there really any point in pretending that this will ever be resolved. Looks like all release blockers are stuck in the same place

avatar PhilETaylor
PhilETaylor - comment - 22 Apr 2021

I have tested this item ? unsuccessfully

If I allow the autoload_psr4 file to be written directly (by 777 the cache folder "for testing only") I get a little further...

If I then select "verify FTP" and attempt to install Joomla 4... I then replicate @brianteeman issue where Joomla "appears" to install perfectly and it writes configuration.php (the file is there and its contents are valid and it contains the FTP credentials and ftp path correctly..

   4 -rw-------   1 www-ftp    2198 Apr 22 16:27 configuration.php

But then Joomla cannot read it as the PERMISSIONS are too restrictive:

Screenshot 2021-04-22 at 17 30 41

If I manually change the permissions to 644 then refresh Joomla can then load to the final installer page:

Screenshot 2021-04-22 at 17 31 34

Clicking remove installation folder button correctly uses FTP to remove the folder.

avatar brianteeman
brianteeman - comment - 22 Apr 2021

#33079 (comment)

I guess jumping on the FLoC bandwagon is more important than releasing joomla

avatar Hackwar
Hackwar - comment - 24 Apr 2021

Since @brianteeman asked so nicely: I tested this code on my machine with FTP and it works fine. With the information given by you, I can't debug this. The FTP user could be misconfigured to only allow reading for himself and not for other users, like the user of the webserver. Thus I would need more information to move this forward. You say that the configuration.php is created and seems to have the right content, so my assumption would be, that your FTP server is configured to write the files with 600 permissions or something similar.

avatar PhilETaylor
PhilETaylor - comment - 24 Apr 2021

I tested this code on my machine with FTP and it works fine.

I tested this code on my machine with FTP and it doesn't work fine. I reported some issues here #31857 (comment) and here #31857 (comment) which you have failed to acknowledge or address

The FTP user could be misconfigured to only allow reading for himself and not for other users,

Thats not misconfigured - that is standard linux permissions and standard mass-market FTP accounts.

You say that the configuration.php is created and seems to have the right content, so my assumption would be, that your FTP server is configured to write the files with 600 permissions or something similar.

.... and Joomla fails to take the FTP layer into consideration, thus leaving the configuration.php permissions at the standard permissions for writing files by FTP (Which is OWNED then by the FTP user that logged in) which doesn't allow READ by the web server process user... you know: STANDARD LINUX PERMISSIONS.... .

The problem is that Joomla fails to take this into account - this is a bug in Joomla, not in the way the files are written by the FTP server.

There is code in the writeConfigFile method that attempts to make files writable/not writable - but only if FTP layer is disabled. There is no concept of ensuring they are readable too.

Joomla doesn't take into account that the newly FTP Uploaded file is OWNED by the FTP User, and therefore might have permissions used might be wrong to allow READING by other users (I.e the web server process user.)

avatar brianteeman
brianteeman - comment - 24 Apr 2021

As stated before I used the docker container provided by @PhilETaylor no idea what extra information you need

avatar PhilETaylor
PhilETaylor - comment - 24 Apr 2021

He openly stated he did not use it

avatar PhilETaylor
PhilETaylor - comment - 24 Apr 2021

This draft currently is still missing the possibility of simply displaying the configuration.php at the end and some cleanup.

And thus incomplete and cannot be merged as doesn't resolve this issue.

avatar PhilETaylor
PhilETaylor - comment - 24 Apr 2021

Yes, I've created a VM with a deliberately botched installation. Installed Ubuntu Server, then apache, mysql, php and vsftpd.

That is not a "botched installation" - that is a standard installation that many many people use.

avatar Hackwar
Hackwar - comment - 24 Apr 2021

Ok, so you already did all the work to debug this and apparently also found the code and the place to fix this. You seem to have fun letting me do all that work again instead of creating a PR against my branch here to move us forward. I don't have time for that, so here we are. Again: Teaches me to volunteer to execute decisions the PLT has made.

avatar PhilETaylor
PhilETaylor - comment - 24 Apr 2021

Ok, so you already did all the work to debug this and apparently also found the code and the place to fix this.

Excuse me? No. I tested the PR as presented. Just like any other PR. I did not "find the code" to resolve your bugs in your PR I just commented knowing (and already spending CONSIDERABLE TIME with the FTP layer since it was designed)...

You really have an attitude issue and dont seem to be able to cope with people reporting the genuine issues with the PR you present. That is concerning.

Assuming and demanding that testers create PR's against your branch is unreasonable. Testing and creating PRs are two different tasks, with different time constraints and commitments.

All I have done is test the code you put out into the public - for testing - and reported the issues found.

Teaches me to volunteer to execute decisions the PLT has made.

Decisions that seem to be made and communicated in private...

avatar PhilETaylor
PhilETaylor - comment - 24 Apr 2021

The FTP user could be misconfigured to only allow reading for himself and not for other users, like the user of the webserver.

Its clear you do not understand the whole reason the FTP Layer exists, if you believe that this is a misconfiguration.

What you are describing as a "misconfiguration", a "botched installation" - is literally the whole point. Its NEITHER. Its a standard way of running a server, where the FTP user and the Apache/PHP user have different roles and one cannot write to the files/folders of the other.

avatar PhilETaylor
PhilETaylor - comment - 24 Apr 2021

So I have EXTENSIVELY AND COMPREHENSIVELY Tested this PR today. We are talking several hours of set up (several virtual machines, docker, and real life servers at Digital Ocean), testing various senarious, and reporting back, as well as PR creation for issues found. 6 coffees consumed. Half a package of biscuits eaten.

The issues encounted in testing this PR were (and not all are related to this PRs content)

  1. Before you can even test this PR - autoload_psr4.php cannot be created - as commented here #31857 (comment) right from the beginning it is impossible to proceed because Joomla cannot write the /administrator/cache/autoload_psr4.php file as it cannot write to the folder as it cannot use the FTP layer as no FTP credentials have yet been provided. I have already spent considerable time debugging that and providing the PR for it here #33263

  2. ConfigurationModel.php uses is_writable several times which returns factually incorrect information, because is_writable is not FTP aware, whereas File::write is FTP aware. This is a global issue and documented in #33238 already. What we need is a Folder::is_writable method in the Filesystem layer that is FTP aware (we dont have that yet, no PR)

  3. Once configuration.php is written by the FTP Layer, the permissions are 0600. This means the configuration.php is unreadable by PHP and an Internal Server Error happens on the next page reload. The Filesystem API only writes the file, and doesnt check if the written file is actually readable by PHP after being written.

  4. If I "mess" with permissions on /administrator/cache I can get the installation to throw an untranslated JLIB_CLIENT_ERROR_JFTP_CLIENT_BAD_RESPONSE - Now PR here #33284

  5. After installation, if I click on the Open Site button I get ON THE FIRST PAGE LOAD ONLY "Joomla\Filesystem\File::move: Rename failed." Ive seen this before in Joomla 4.0-dev several years ago but was told I was going mad (cannot find that reference now!) The error is caused by logrotation (see new image in #33283) and is because the logrotation uses the FileSystem API from the Joomla framework which is not FTP aware instead of the CMS Filesystem package! Now PR here: #33283

  6. There are many J* prefixed class names that cause issues in installation/src/Controller/InstallationController.php, installation/src/Model/ChecksModel.php and installation/tmpl/configuration/default.php, these need the J* prefix removing so that the Class can be resolved by the use import already there. New PR here Hackwar#49

  7. If you select "Manually create file" at the start of the process, then at the end of the process no configuration.php is displayed to you to copy and create manually, and no button to then chech and proceed. Instead you are sent back to the start of the installation process. This apparently is by design currently as this PR Author states: "This draft currently is still missing the possibility of simply displaying the configuration.php at the end and some cleanup." - I do not know what additional cleanup is needed.

So out of these, the author of this PR needs only to address 3 in order to get a successful test result flagged by me. Ive done or are doing the rest.

avatar brianteeman
brianteeman - comment - 24 Apr 2021

But does it work in Joomla 3 right now. Because if its broken then there really is little point as it means no one is using it

avatar PhilETaylor
PhilETaylor - comment - 24 Apr 2021

But does it work in Joomla 3 right now. Because if its broken then there really is little point as it means no one is using it

Out of scope of this PR :) We could fix it and call it a new flagship feature of Joomla 4 ;-)

avatar Hackwar Hackwar - change - 24 Apr 2021
Labels Added: ?
Removed: ?
avatar Hackwar
Hackwar - comment - 30 Apr 2021

The Production Team decided to drop the FTP layer. See #33390 (comment) for further comments.

avatar Hackwar Hackwar - change - 30 Apr 2021
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2021-04-30 10:28:24
Closed_By Hackwar
Labels Added: ?
Removed: ?
avatar Hackwar Hackwar - close - 30 Apr 2021

Add a Comment

Login with GitHub to post a comment