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

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 17th August 2012, 14:58
Croydon Croydon is offline
ISPConfig Developer
 
Join Date: Jul 2007
Location: Koblenz, Germany
Posts: 922
Thanks: 16
Thanked 258 Times in 206 Posts
Post Getting ajaxplorer to work with multiserver ISPC (no real integration)

I tried (and managed) to get ajaxplorer working with a multiserver setup of ISPConfig 3.
It is not fully integrated but uses the remoting api to get the right server for a ftp user.

This does only work with latest svn version of ISPConfig as I added a small function to the remoting.

Step 1:
Install Ajaxplorer as usual
Be sure you have configured everything you want with the admin user before you proceed. Admin login is currently no longer working after completing the following steps, so you have to revert them temporarily if you need to login as admin again.

Step 2:
Create a remote user in ispconfig. This user needs the "Server functions" and "FTP-User functions" rights, nothing else.

Step 3:
Change the conf/bootstrap_plugins.php section
PHP Code:
        "AUTH_DRIVER" => array(
                
"NAME"          => "ftp",
                
"OPTIONS"       => array(
                        
"LOGIN_REDIRECT"                => false,
                        
"REPOSITORY_ID"             => "ispc_ftp",
                        
"ADMIN_USER"                => "admin",
                        
"FTP_LOGIN_SCREEN"      => false,
                        
"AUTOCREATE_AJXPUSER"   => true,
                        
"TRANSMIT_CLEAR_PASS"   => true,
                )
        ), 
Step 4:
Add this as the first(!) repository in conf/bootstrap_repositories.php
PHP Code:
$REPOSITORIES["ispc_ftp"] = array(
        
"DISPLAY"       => "Web FTP",
        
"DRIVER"        => "ftp",
        
"DRIVER_OPTIONS"=> array(
            
"FTP_HOST"       => "localhost",
            
"FTP_PORT"      => "21",
            
"FTP_SECURE"   => false,
            
"DEFAULT_RIGHTS"    => "rw",
            
"USE_SESSION_CREDENTIALS"   => true,
            
"FIX_PERMISSIONS" => "detect_remote_user_id",
            
"TMP_UPLOAD" => "/tmp"
        
)
); 
Do not change the FTP_HOST, it is determined automatically later.
You can change the DISPLAY setting if you like.
If you want SSL connections to the ftp server you can set FTP_SECURE to true.

I deleted all other repositories from the file, except ajaxp_shared and ajxp_conf.


Step 5:
in file plugins/auth.ftp/class.ftpAuthDriver.php add a new method to the class:
PHP Code:

class ftpAuthDriver extends AbstractAuthDriver {
    
// stripped content

function get_ispc_host($username) {
       
// connect to ispc via remoting and read ftp user
       
$server '';             
       
$login 'YOURREMOTEUSER';
       
$pass 'YOURREMOTEPASS';
       
       
$soap_uri 'http://your.server.com:8080/remote/';
       
$soap_location $soap_uri 'index.php';

       
$client = new SoapClient(null, array('location' => $soap_location'uri'      => $soap_uri));
       try {
           if(
$session_id $client->login($login,$pass)) {
               
$check $client->sites_ftp_user_server_get($session_id$username);
               if(
$check) {
                   
$server = isset($check['ip_address']) ? $check['ip_address'] : $check['hostname'];
               }

               
$client->logout($session_id);
          }
      } catch (
SoapFault $e) {
      }

      return (
$server != '' $server 'localhost');
}

// stripped content

Step 6:
Search for function checkPassword($login, $pass, $seed)
In this function add after
PHP Code:
               $repoId $this->options["REPOSITORY_ID"]; 
this
PHP Code:
                $repository ConfService::getRepositoryById($repoId);
                
$_SESSION['ISPC_HOST'] = $this->get_ispc_host($login);
                
$repository->addOption('FTP_HOST'$_SESSION['ISPC_HOST']); 
Step 7:
In file plugins/access.ftp/class.ftpAccessDriver.php search for function initRepository() - should be around line 55.
add after
PHP Code:
                $this->urlBase $wrapperData["protocol"]."://".$this->repository->getId(); 
this
PHP Code:
                if(isset($_SESSION['ISPC_HOST'])) {
                        
$this->repository->addOption('FTP_HOST'$_SESSION['ISPC_HOST']);
                        
ConfService::tmpReplaceRepository($this->repository);
                } 
and around line 221 replace
PHP Code:
return is_writable($path); 
with
PHP Code:
return true
This leads to ajaxexplorer showing the raw ftp errors like "ftp_fput() permission denied" instead of "Cannot write file ... " but makes it working at least as ajaxplorer compares the file's owner uid with the login name. This differs due to virtual users in ispconfig pureftp.


This should be everything that is needed.

What is done:
On login (checkPassword method) a function is called that calls the ISPConfig remoting api and gets some server infos for the given ftp user.
It then returns the server-ip (or hostname) and overwrites the Ajaxplorer repository config temporarily.

No warranty for this howto, as always Use at your own risk.
__________________
Marius Cramer

pixcept KG

Last edited by Croydon; 18th August 2012 at 10:22.
Reply With Quote
The Following 3 Users Say Thank You to Croydon For This Useful Post:
cfoe (17th August 2012), falko (18th August 2012), till (17th August 2012)
Sponsored Links
 

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
Net2ftp integration. vsevolod Tips/Tricks/Mods 38 18th October 2013 12:34
Cron issue in Debian 6 Nolan Installation/Configuration 6 18th April 2011 16:36
Multiserver install: what did I do wrong and how is it supposed to work? Rowdy Installation/Configuration 11 12th May 2010 09:43
ISPc with frontal and specialized work for PC servers DreamK Tips/Tricks/Mods 1 8th February 2010 10:33
Upgraded and all webs work but dont show in ISPC grandpagenocide General 3 10th April 2008 14:18


All times are GMT +2. The time now is 01:08.


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