Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > ISPConfig 2 > Tips/Tricks/Mods

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 5th December 2007, 19:20
krakoukas krakoukas is offline
Member
 
Join Date: Sep 2006
Location: Paris
Posts: 64
Thanks: 2
Thanked 3 Times in 2 Posts
Default Webdav + quota access to web's root patch

Here is my contribution for giving a webdav access to ISPconfig web's roots.
It consists in a modification of /root/ispconfig/scripts/lib/config.lib.php (after line 1660 in 2.2.18)

If your ISPconfig server hostname is www.mydomain.com, for account like userhost.userdomain.com you will get access to your webdav account through https://www.mydomain.com/userhost.userdomain.com/

You will need a database for webdav user mysql_auth mechanism:
DB: webdav, Table: users (login, pass)

Code:
  
  $mod->tpl->assign( array( FP_RESOURCE_CONFIG => $fp_resource_config,
                       FP_ACCESS_CONFIG => $fp_access_config));
  $mod->tpl->parse(TABLE, table);

/*
  HERE Add webdav ssl access to /web directories
*/
  if ($go_info["server"]["webdav"] == 1) {
  $myserver = trim(shell_exec("hostname -f"), "\r\n");
  $webdav = "
<VirtualHost ".$web["web_ip"].":443>
	ServerName ".$myserver.":443
	ServerAdmin webmaster@".$web["web_domain"]."
	DocumentRoot /var/www/sharedip
	SetEnvIf User-Agent \".*MSIE.*\" nokeepalive ssl-unclean-shutdown downgrade-1.0 force-response-1.0
	<IfModule mod_ssl.c>
		NameVirtualHost ".$myserver.":443
		SSLEngine on
		SSLCertificateFile /etc/apache2/ssl/new.cert.cert
		SSLCertificateKeyFile /etc/apache2/ssl/new.cert.key
	</IfModule>
	";

	foreach ($webs as $web)
	{
	$webdav_root = $mod->system->server_conf["server_path_httpd_root"]."/"."web".$web["doc_id"]."/"."web";
	$my_quota = $web["web_speicher"]."000";
	$webdav .= "Alias /".$web["web_host"].".".$web["web_domain"]." ".$webdav_root;
	$mod->log("Update QUOTA for ".$web["web_host"].".".$web["web_domain"].": ".$web["web_speicher"]." Mo - Webdav access ".$webdav_root);

	$webdav .= "
	<Location /".$web["web_host"].".".$web["web_domain"].">
		DAV On
		AddType text/plain .html
		AddType text/plain .htm
		AddType text/plain .js
		AddType text/plain .css
		AddType text/plain .xml
		AddType text/plain .php
	   
		DAVSATMaxAreaSize ".$my_quota."
		AuthType Basic
		AuthName \"Data Webdav Access\"
		Auth_MySQL_DB webdav
		Auth_MySQL_Password_Table users
		Auth_MySQL_Username_Field login
		Auth_MySQL_Password_Field pass
		Auth_MySQL_Empty_Passwords off
		Auth_MySQL_Encryption_Types PHP_MD5
		<Limit PUT POST DELETE PROPFIND PROPPATCH MKCOL COPY MOVE LOCK UNLOCK>
			Require user ".$web["web_host"].".".$web["web_domain"]."
		</Limit>
	</Location>";
  }
$webdav .= "
</VirtualHost>";
}
  if(!empty($webs)){
  $vhost_text = $mod->tpl->fetch();
  // ICI Add Webdav to vhost
  if ($go_info["server"]["webdav"] == 1) $vhost_text .= $webdav;
  } else {
  $vhost_text = "";
  }
It modifies your vhost file if you add : $go_info["server"]["webdav"] = 1;
in /home/admispconfig/ispconfig/lib/config.inc.php

For mod_dav quota and auth_mysql apache2 needs to be patched and right modules have to be loaded and configure:

Quote:
# Normal Install apache2 and required modules
apt-get install apache2 libapache-mod-dav libapache2-mod-auth-mysql apache2-doc

# Compile quota patched webdav module
cd /usr/src
wget http://leche.goodcrew.ne.jp/webdav/w...-quota-2.3.txt
wget http://archive.apache.org/dist/httpd...-2.0.55.tar.gz
tar -xvzf httpd-2.0.55.tar.gz
cd httpd-2.0.55
patch -p2 < ../webdav-2.0.55-quota-2.3.txt
./configure --enable-modules=most --enable-mods-shared=all
make

# Replace mod_dav module with patched one
mv /usr/lib/apache2/modules/mod_dav.so /usr/lib/apache2/modules/mod_dav.so-bkp
mv /usr/lib/apache2/modules/mod_dav_fs.so /usr/lib/apache2/modules/mod_dav_fs.so-bkp
cp ./modules/dav/main/.libs/mod_dav.so /usr/lib/apache2/modules/mod_dav.so
cp ./modules/dav/fs/.libs/mod_dav_fs.so /usr/lib/apache2/modules/mod_dav_fs.so

# Activate apache webdav module
ln -s /etc/apache2/mods-available/dav_fs.conf /etc/apache2/mods-enabled/dav_fs.conf
ln -s /etc/apache2/mods-available/dav_fs.load /etc/apache2/mods-enabled/dav_fs.load
ln -s /etc/apache2/mods-available/dav.load /etc/apache2/mods-enabled/dav.load

# Enable and Configure auth_mysql
ln -s /etc/apache2/mods-available/auth_mysql.load /etc/apache2/mods-enabled/auth_mysql.load
ln -s /etc/apache2/mods-available/auth_mysql.conf /etc/apache2/mods-enabled/auth_mysql.conf

# Give database reference (user/password) for auth_mysql
vi /etc/apache2/mods-available/auth_mysql.conf
Quote:
Auth_MySQL_Info localhost davdbuser davdbpasswd
/etc/init.d/apache2 restart

For SSL certificate:
Quote:
cd /etc/apache2/ssl/
openssl req -new > new.cert.csr
# Remove password
openssl rsa -in privkey.pem -out new.cert.key
# Key signing by cert
openssl x509 -in new.cert.csr -out new.cert.cert -req -signkey new.cert.key -days 3650
chmod 400 /etc/apache2/ssl/new.cert.key
Now have fun and Enjoy!

PS: If your accounts always have ISPconfig users, you can use sys_user database for mysql_auth, and modify a little this script...
Reply With Quote
The Following 2 Users Say Thank You to krakoukas For This Useful Post:
falko (6th December 2007), Hans (5th December 2007)
Sponsored Links
  #2  
Old 29th December 2007, 20:34
till till is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 37,015
Thanks: 840
Thanked 5,652 Times in 4,461 Posts
Default

I've added the patch to the stable and unstable branch of ISPConfig.
__________________
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:
krakoukas (2nd January 2008)
  #3  
Old 2nd January 2008, 16:53
krakoukas krakoukas is offline
Member
 
Join Date: Sep 2006
Location: Paris
Posts: 64
Thanks: 2
Thanked 3 Times in 2 Posts
Default

Hi, good news!
Did you include apache2 webdav quota patch and module compilation during ispconfig install, or should it be done manually?
Happy New Year to Everyone
Reply With Quote
  #4  
Old 28th August 2008, 00:28
radim_h radim_h is offline
Senior Member
 
Join Date: Jan 2007
Location: Prague, Czech
Posts: 426
Thanks: 34
Thanked 26 Times in 21 Posts
Send a message via ICQ to radim_h
Default

When trying to install
apt-get install libapache2-mod-auth-mysql on Debian Etch, i'm getting message
Package libapache2-mod-auth-mysql is not available, but is referred to by another package.
According this page
http://forums.debian.net/viewtopic.p...f9c3953a5e9acd
it seems that this package is removed from repository. Do you have idea if there is possibility install webdav without it?

Last edited by radim_h; 28th August 2008 at 00:48.
Reply With Quote
  #5  
Old 28th August 2008, 11:26
till till is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 37,015
Thanks: 840
Thanked 5,652 Times in 4,461 Posts
Default

Please take a look at falkos howto for webdav:

http://www.howtoforge.com/setting-up...e2-debian-etch

He used the libapache2-mod-auth-mysql package from debian lenny successfully on etch.
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
  #6  
Old 8th September 2008, 19:21
radim_h radim_h is offline
Senior Member
 
Join Date: Jan 2007
Location: Prague, Czech
Posts: 426
Thanks: 34
Thanked 26 Times in 21 Posts
Send a message via ICQ to radim_h
 
Default

well im bit scared on using lenny libraries on my Etch machine as it want to update lot of files (abou 120MB) what do you think about use oldstable ?

EDIT: also dependency problems

Last edited by radim_h; 8th September 2008 at 19:26.
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
monit howto Jamesk5 HOWTO-Related Questions 11 5th August 2008 16:10
apache not working cruz Server Operation 21 29th October 2007 01:19
Add Webmin to the system sushestvo Installation/Configuration 44 21st August 2007 17:52
Server Side Includes don't work PermaNoob General 7 1st May 2007 21:38
cannot connect to ispconfig guidovanh Installation/Configuration 22 3rd March 2006 20:52


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


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