byrokrat / giroapp

Command line app for managing autogiro donations.
GNU General Public License v3.0
4 stars 2 forks source link

php posix_getpwuid() dependency missed under CentOS 7 [BUG] #44

Closed nonbinary closed 7 years ago

nonbinary commented 7 years ago

Found a bug in dependencies under CentOS 7.

After a fresh install on CentOS7, with php 7.1 from webtatic repository, I ran composer install. This pointed me further php packages that needed to be installed (php71w-bcmath, php71w-mbstring and php71w-xml). After the installation, I ran spec tests. I got this response:


byrokrat/giroapp/DI/ContainerFactory                                                         
  19  - it creates containers
      exception [err:Error("Call to undefined function byrokrat\giroapp\DI\posix_getpwuid()")] has been thrown.

byrokrat/giroapp/DI/UserDirectoryLocator                                                      
  28  - it returns default path if nothins is specified
      exception [err:Error("Call to undefined function byrokrat\giroapp\DI\posix_getpwuid()")] has been thrown.

/  skipped: 0%  /  pending: 0%  /  passed: 98%  /  failed: 0%   /  broken: 1%   /  152 examples
33 specs
152 examples (150 passed, 2 broken)

CentOS is a bit weird with the posix functions. For these to work, we need to install the php71w-process package. This should of course be caught in composer dependencies, if possible.

nonbinary commented 7 years ago

Note: The same package contains the needed functions on Fedora, but this package seemed to be installed on my Fedora machine when I first installed the giroapp. I didn't get any failed tests on the Fedora machine.

hanneskod commented 7 years ago

You need php71w-posix as well. Used to find home dir in DI/UserDirectoryLocator. This dependency is added to composer.json in #45. Leaving issue open however, maybe we can do this without this posix extension? Now when I read the docs I see that ext-posix is not supported on windows. And it seams silly not to support windows just because of this little function...

nonbinary commented 7 years ago

Quite true. The files don't need to be positioned in the homedir anyway, they could just as well be in a data dir, nested under the app root, or something other.

hanneskod commented 7 years ago

We need a default place when user doesn't choose actively. And not under app root. Removing the app should not remove your data...

nonbinary commented 7 years ago

Ah. Of course. Well, it is kinda sensitive data. Can't we force the user to choose location? That way, it'll be easier for users to remember where the files are, and delete them, if need be. Right now, the app doesn't ask at all, and doesn't really let the user know where the files are.

hanneskod commented 7 years ago

Its documented in pr #42

https://github.com/hanneskod/giroapp/blob/91405ea6ddc92cf8018d6c358cc7f9899f8dbb2e/README.md

nonbinary commented 7 years ago

I've been thinking about this. As a linux sysop, I'd recommend installing the app in the /opt/giroapp dir, and store the data in /var/lib/giroapp. Linux has harder security on the /var/lib directory, and it'll be easier to set up e.g. selinux on the files, thereby hardening security even more. I don't think we need to keep things in the /home/user dirs, since the application probably won't have many installations where multiple users on the same machine use different autogiro databases.

Not sure what the equivalent would be on windows, though.

This would, however, probably require sudo on installation, and different kinds of security elevations when we run it. A bit more work.

hanneskod commented 7 years ago

Yupp lets add a line in the readme. I still like to default to ~/.giroapp though. Hardening security will be up to the person installing..

hanneskod commented 7 years ago

Note to self: https://stackoverflow.com/questions/1894917/how-to-get-the-home-directory-from-a-php-cli-script