Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > ISPConfig 3 > General

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 20th March 2013, 12:34
trigar trigar is offline
Junior Member
 
Join Date: Jun 2006
Posts: 17
Thanks: 2
Thanked 0 Times in 0 Posts
Default Path to private directory

I have just installed a new ISPConfig 3.0.5.1 server, and I am trying to get to grips with the fact that I can no longer read or write to the parent of the web root (via "../").

Searching the forums I understand that this was a security hazard and rightly blocked, and I should be using /var/www/domain.net/private instead. That works fine, except that that will need hard coding into a lot of scripts across many sites.

What I would like is an easy way of doing this, either by programmatically determining the current site, or by having a standard path that works across all sites. Failing that I could just add a "sitename" file in the webroot and read that in every script, but again that is not ideal.

I am using Perl, not PHP.

Any suggestions gratefully received!

Thanks,
__________________
Chris Roberts
Reply With Quote
Sponsored Links
  #2  
Old 20th March 2013, 13:07
till till is online now
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 36,072
Thanks: 826
Thanked 5,396 Times in 4,240 Posts
Default

There are sevarl options to get that path, e.g. in php:

realpath('../provate');

or

realpath('/var/www/domain.tld/private');

Or if your scripts are working correctly with symlinks (which should be ok in most cases), then use:

/var/www/domain.tld/private/
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
  #3  
Old 20th March 2013, 13:39
trigar trigar is offline
Junior Member
 
Join Date: Jun 2006
Posts: 17
Thanks: 2
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by till View Post
There are sevarl options to get that path, e.g. in php:

realpath('../provate');

or

realpath('/var/www/domain.tld/private');
Thanks Till, but I am using Perl not PHP. Using the equivalent realpath command in Perl...

Code:
use Cwd 'realpath';
my $dir = realpath("../private");
print $dir;
... returns "/private", which is not correct or usable, as it would require private to be a subdir off the web root. Whether this is a Perl issue, or something peculiar to ISPConfig, I have no idea.

Quote:
Originally Posted by till View Post
Or if your scripts are working correctly with symlinks (which should be ok in most cases), then use:

/var/www/domain.tld/private/
Which works, but would need hardcoding into every script on every site. I need a way of programmatically calculating the path to the private directory.
__________________
Chris Roberts
Reply With Quote
  #4  
Old 20th March 2013, 13:42
till till is online now
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 36,072
Thanks: 826
Thanked 5,396 Times in 4,240 Posts
Default

Quote:
Which works, but would need hardcoding into every script on every site. I need a way of programmatically calculating the path to the private directory.
This des not require hardcoding as this path contains the domain name and you should be able to get it for the local site from within your script e.g. from apache server variables or you get the path your current script is running in and use this as basis to calculate the private dir path.
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
The Following User Says Thank You to till For This Useful Post:
trigar (20th March 2013)
  #5  
Old 20th March 2013, 13:55
trigar trigar is offline
Junior Member
 
Join Date: Jun 2006
Posts: 17
Thanks: 2
Thanked 0 Times in 0 Posts
 
Default

Quote:
Originally Posted by till View Post
This des not require hardcoding as this path contains the domain name and you should be able to get it for the local site from within your script e.g. from apache server variables or you get the path your current script is running in and use this as basis to calculate the private dir path.
Yes, you're right, the environment variables have it.

Thank you!
__________________
Chris Roberts
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Webmin upgrade lishaw1968 Installation/Configuration 15 26th August 2010 15:23
Email problem 'Cannot set my user or group id.' (using ISPConfig 3 + OpenSuSE 11.2) urosm Installation/Configuration 5 19th June 2010 22:41
can't help ispconfig to install please help steve51184 Installation/Configuration 17 20th February 2009 10:37
ISPConfig install issues... flyingaggie Installation/Configuration 2 18th July 2008 10:46
Systemimager (rsync) doesn't copy all comedit HOWTO-Related Questions 11 19th January 2007 17:17


All times are GMT +2. The time now is 12:36.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.