Webdav + quota access to web's root patch

Discussion in 'Tips/Tricks/Mods' started by krakoukas, Dec 5, 2007.

  1. krakoukas

    krakoukas New Member

    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:


    For SSL certificate:
    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...
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    I've added the patch to the stable and unstable branch of ISPConfig.
     
  3. krakoukas

    krakoukas New Member

    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
     
  4. radim_h

    radim_h Member HowtoForge Supporter

    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.php?p=41615&sid=8d1674413ad00cc039f9c3953a5e9acd
    it seems that this package is removed from repository. Do you have idea if there is possibility install webdav without it?
     
    Last edited: Aug 27, 2008
  5. till

    till Super Moderator Staff Member ISPConfig Developer

  6. radim_h

    radim_h Member HowtoForge Supporter

    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: Sep 8, 2008

Share This Page