Koozali.org: home of the SME Server

Obsolete Releases => SME Server 7.x => Topic started by: edb on October 30, 2007, 12:49:33 AM

Title: Ibay permissions? Will Pay for solution
Post by: edb on October 30, 2007, 12:49:33 AM
Some history ....

I previously was running SME6x and had an ecommerce site running within an ibay.
I initially had an issue that when a customer made a purchase it would create a file of the transaction a write it to the "files" folder which was within the ibay. The initial issue I had was an inability for the system to write to that directory but I was able to resolve the issue some how just don't remember exactly how.
Also, because another server would FTP into that directory to import the transaction file into our accounting system I had to use the chroot contrib for SME6x and all was then fine.

I have recently switched to SME7.2 with clean install and have that same issue again where the system cannot write a file to the "files" directory of the ibay.

Could someone tell me how I can achieve this as I have tried everything I know and cannot get it to work.
I am willing to pay for a resolution!

Kinda desperate right now so I would appreciate any assistance wether free or pay.

edb
Title: Re: Ibay permissions? Will Pay for solution
Post by: shell on October 30, 2007, 01:17:40 AM
Hey edb,

i had a similar problem with cerberus install recently, ended up being a custom template solution to add upload_tmp_dir directives to httpd.conf

here is the code for that fix (thanks to Russell Taihin also, Wiki/Cerberus):
Code: [Select]
mkdir -p /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf/
cd /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf/
pico 88cerberus
Contents of 88cerberus
# Cerberus - Help Desk Support Center

Alias  /cerberus  /opt/cerberus
Alias  /support-center  /opt/cerberus/support-center

<Directory /opt/cerberus>
    order deny,allow
    deny from all
    allow from all
    AuthName "Cerberus"
    AuthType Basic
    AuthExternal pwauth
    Satisfy all
    AddType application/x-httpd-php .php .php3 .phtml
    php_admin_value open_basedir /opt/cerberus:/tmp
    php_admin_value upload_tmp_dir /opt/cerberus/temp
</Directory>

Code: [Select]
expand-template /etc/httpd/conf/httpd.conf
/etc/rc.d/init.d/httpd-e-smith restart

i found a small php script called phpinfo.php that i simply placed in the ibay html folder and opened from a browser, this gave me heaps of details, including the global settings and specific ibay settings for php and may help you identify which directive you don't have set.  its a bit long to paste here, and I can't upload it but if you would like it and can't find it by simply googling then sing out and i'll email it or something...

you can name the 88cerberus anything (ie 88yourwebsitename) and put only the directives you need, but include in the opening and closing <Directory> tags.

in addition some of the directives are linked to db:
this may help identify those - changes to these will be global (as opposed to the above which is specific to the /opt/cerberus directory).

to find out your current settings from console:

Code: [Select]
config show php
to change a setting:
Code: [Select]
config setprop php UploadMaxFilesize 100M
expand-template /etc/php.ini
/etc/rc7.d/S86httpd-e-smith restart

available settings (this may not be comprehensive...)
MaxExecutionTime
MemoryLimit
PostMaxSize
UploadMaxFilesize

I believe the chroot addon has been redesigned for sme 7 and is available at dungog.net but this is a vague recall, such or open a new thread for that specific...

good luck and let us know how you get on.  if it fixes or helps lead to a fix of your problem the advice would be to donate any moulah to contribs.org.

cheers, shell



Title: Re: Ibay permissions? Will Pay for solution
Post by: edb on October 30, 2007, 01:55:56 AM
Thanks for the reply SHELL

However, I have basically have the same setup already and my site is otherwise working fine with the only exception being the ability to write to the ibay's "files" directory.

The application uses whatever user the apache web server runs as - and tries to write to the path specified in the config file  " /home/e-smith/files/ibays/ibayname/files" (the writing is done via php code) however the apache server process/php get's an error when it does a check to see if it can write/create files in that directory.  I believe it uses php's is_writable() function to test.

My phpinfo file shows:
post_max_size 100M
upload_max_filesize 100M
memory_limit 300M
open_basedir /home/e-smith/files/ibays/ibayname/
upload_tmp_dir /tmp

Also, I already have dungog's new chroot contrib installed and the other server that is suposed to connect to the SME ibay/files directory can do so fine without any issue thanks to that contrib.

My only issue is why the file cannot be written to the ibay/files directory within the storefront.

Maybe I have missed something ...

Thank you very much for your support!

edb
Title: Re: Ibay permissions? Will Pay for solution
Post by: shell on October 30, 2007, 02:25:05 AM
maybe required here as a second argument:
Code: [Select]
open_basedir /home/e-smith/files/ibays/ibayname/:/home/e-smith/files/ibays/ibayname/directory
also shouldn't the full open_basedir be to /html?

Code: [Select]
open_basedir /home/e-smith/files/ibays/ibayname/html/:/home/e-smith/files/ibays/ibayname/html/directory
I don't think you can web access the files folder, smb vs apache or some such - better minds than me will be able to elaborate...

What do the log files say?  httpd/access_log?  httpd/error_log?

can you browse directly to the directory http://dn/program/directory?

you could try (for testing) chmod the /html/directory to 777 - see if that works...  of course don't leave it open.

cheers, shell

edit:

opening /tmp as the upload_tmp_dir is generally frowned on too as there maybe temp files in here from the system that you don't want accessible.  better to create a tmp folder somewhere (i usually place inside html folder as well)  it could be a permission issue here as /tmp isn't www:www owner i don't believe.
Title: Re: Ibay permissions? Will Pay for solution
Post by: edb on October 30, 2007, 02:39:55 AM
Hey SHELL

Just wanted to say thanks .... I started really looking at what I was missing from my previous setup and what you had sent in your message and I noticed one thing ... my open_basedir /home/e-smith/files/ibays/ibayname/ was missing the /tmp path.
I adjusted this to read open_basedir /home/e-smith/files/ibays/ibayname:/tmp with the following commands:
[root@defcon1 ~]# db accounts setprop store PHPBaseDir /home/e-smith/files/ibays/ibayname:/tmp
[root@defcon1 ~]# signal-event ibay-modify store

I then tried my store again and voila it's fixed!!!!

Sometimes it's just a little thing that helps put a puzzle together ....

I will make a donation to SME and just anted to say thanks again!

edb
Title: Re: Ibay permissions? Will Pay for solution
Post by: girkers on October 30, 2007, 05:12:05 AM
Just for clarity edb, are your files being stored in the files directory as you wanted or are they in the tmp directory?

Sheel for reference, you can access the files directory of an ibay from the internet, as this is a place my Father in Law puts files for me to download from him.
Title: Re: Ibay permissions? Will Pay for solution
Post by: edb on November 01, 2007, 08:03:21 PM
Hi gerkers

Yes, my files are be stored in the files directory not tmp.
I created a specific group for my purpose and assigned a sigle user to the new group, then modified the ibay security to write-newgroup, read-newgroup. That way I could use the specific user to FTP to the folder with full rights and protect access from the Internet in general.
Works slip in combination with the dungog chroot contrib which I used to change the users chroot directory to be the files directory of the ibay.
Nice and secure  8)

edb