Cheap VPS & Xen Server


Residential Proxy Network - Hourly & Monthly Packages

Using Pydio In An ISPConfig 3 Multiserver Installation


Prerequisites

You have to set up ISPConfig 3 on your servers. Best way to do this is to follow our “perfect server” tutorials.

Preparing

You have to decide on which server you want pydio to reside. This will be the server where your customers access the pydio interface.
We will install the pydio software in a newly created web.
In this howto we use a two-server-setup where the first (master) server is server1.mydomain.com with ip 192.168.10.10 and the second (slave) server is server2.mydomain.com with ip 192.168.10.11.
We will install pydio into a subdirectory /webftp of our domain myftpdomain.com which lies on the slave server.
Please replace these data by the ones from your servers.

 

Create the website

You can skip this if you have already created a website or if you want to install pydio in a sub directory of an existing site.

Create the website by logging in to ISPConfig as client or admin and go to the “Sites” tab.

screen_1

Click on the “Add new website” button and enter your domain in the “Domain” field. Then click “Save”.

screen_2

Install pydio

Log in to your server via ssh and change to the website path.

ssh root@192.168.10.11
cd /var/www/myftpdomain.com/web/

Now download the latest version of pydio from http://pyd.io/download/ or directly from sourceforge. At the time of writing this, version 5.2.1 is the most current.
Do not use the distribution packages! Only use the tar.gz or zip!

Download and extract the package. Then rename the extracted directory.
Don’t forget to alter the owner of all the files to match the owner of the website. In our case these are user web2 and group client1.

wget -O pydio.tar.gz http://downloads.sourceforge.net/project/ajaxplorer/pydio/stable-channel/5.2.1/pydio-core-5.2.1.tar.gz
tar xzf pydio.tar.gz
mv pydio-core-5.2.1 webftp
rm pydio.tar.gz
chown -R web2:client1 webftp

Open the file webftp/conf/bootstrap_conf.php and uncomment this line:

define(“AJXP_LOCALE”, “en_EN.UTF-8”);

You might have to alter the value to match your local system, e. g. change it to en_US.UTF-8 or de_DE.UTF-8.

You should now be able to access the pydio installation at http://myftpdomain.com/webftp/.

screen_3

If you get some warnings there, check the text and correct them where needed. Then click on “click here to continue to Pydio”.

On the welcome page click on “Start wizard!”.

screen_4

Fill out the fields like this:

Admin access
Admin Login: <choose one yourself>
Admin Display Name: <choose one yourself>
Admin Password: <choose one yourself>

Global options
Fill the fields according to your needs.

Configuration storage
Storage Type: No Database (Quick start)

Add some users
Do not enter anything here.

Then click on the “Install pydio now” button.

screen_5

After a few seconds you should be redirected to the login screen. Log in with the admin user and password you entered in the previous step.

screen_6

On first login you will get a choice of what workspace to use. Select “My Files” and check the “Use this workspace as default” box. Then click “Enter”.

screen_7

On your home screen point to the top-right corner and select “Settings” from the drop down menu.

screen_8

We need to make some settings now. At first a workspace has to be added. Go to “Workspaces & Users” -> “Workspaces” and click on the “New Workspace” button at the top. In the popup select “FTP Server” as Access Driver and you will get a window like this:

screen_9

Fill out the fields like this:

Workspace Label: Fill as you like, I prefer “WebFTP”

Connexion
Host: localhost
Port: 21
Path: /
Secure: No
Active: Yes

FTP Server Teaks
User Id: 1000
Nothing more to change here!

Dynamic FTP
Pass FTP Data through Auth driver: Yes

User Credentials
User: leave empty
Password: leave empty
Session credentials: Yes

Filesystem Commons
Recycle Bin Folder: empty(!)
Leave the rest of the fields as they are.

Repository Commons
Default Rights: Read and Write
Alias: ISPConfigFTP
Leave the rest of the fields as they are.

Once you click the “Next” button in the lower right corner you should get something like this:

screen_10

Further configuration

Go to “Global Configuration” -> “Feature Plugins” -> “Access”

screen_11

Double click on the “User Dashboard” entry and set “Available” option to “No” and click “Save” in the upper right corner.

Now log out from the admin panel (upper right corner) and you will be redirected to the login screen.

 

Modify code to access ISPConfig

We will have to alter some code files of pydio so it uses the remoting api of ISPConfig. First we need a set-up remoting use in ISPConfig.

Log in to ISPConfig as admin and click on the “System” tab and on “Remote Users”. Click the “Add new user” button.

screen_12

Enter the username and password for the remote user and check the boxes that say “Server functions” and “Sites FTP-User functions”. Then click “Save”.

screen_13

Now (re-)open the server ssh console and navigate to the webftp folder you created during pydio installation.

Edit the conf/bootstrap_repositories.php

/*
 * Copyright 2007-2013 Charles du Jeu - Abstrium SAS <team (at) pyd.io>
 * This file is part of Pydio.
 *
 * Pydio is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Pydio is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with Pydio.  If not, see <http://www.gnu.org/licenses/>.
 *
 * The latest code can be found at <http://pyd.io/>.
 *
 * Description : configuration file
 * BASIC REPOSITORY CONFIGURATION.
 * The standard repository will point to the data path (ajaxplorer/data by default), folder "files"
 * Use the GUI to add new repositories.
 *   + Log in as "admin" and open the "Settings" Repository
 */
defined('AJXP_EXEC') or die( 'Access not allowed');

// ADMIN REPOSITORY
$REPOSITORIES["ajxp_conf"] = array(
    "DISPLAY"           =>      "Settings",
    "DISPLAY_ID"                =>      "165",
    "DESCRIPTION_ID"    =>      "506",
    "DRIVER"            =>      "ajxp_conf",
    "DRIVER_OPTIONS"=> array()
);

Open the file plugins/auth.ftp/class.ftpAuthDriver.php and search for this (around line 110):

function setFtpDataCallback($actionName, $httpVars, $fileVars){

Add this function to the class right below the “logoutCallback” function. Replace the values with yours:

       function get_ispc_host($username) {
			// connect to ispc via remoting and read ftp user
			$server = '';
			$login = '<your remote user>';
			$pass = '<your remote user password>';


			$soap_location = 'https://pathtoispconfig:8080/remote/index.php';
			$soap_uri = 'https://pathtoispconfig:8080/remote/';

			$client = new SoapClient(null, array('location' => $soap_location,

			'uri'      => $soap_uri));
			try {
				//* Login to the remote server
				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'];
					}
					
					if($client->logout($session_id)) {
					}
				}
			} catch (SoapFault $e) {
			}
			
			return ($server != '' ? $server : 'localhost');
        }

In the same file search for the function “setFTPDataCallback” that should be right below. Add the following code to the beginning of the functions so it looks like this:

    public function setFtpDataCallback($actionName, $httpVars, $fileVars)
    {
               if(isset($httpVars['userid'])) {
                       // get host from ispconfig                      
                       $httpVars['FTP_HOST'] = $this->get_ispc_host($httpVars['userid']);
               }
        $options = array("CHARSET", "FTP_DIRECT", "FTP_HOST", "FTP_PORT", "FTP_SECURE", "PATH");
        $ftpOptions = array();
      [...]
    }

Open the file plugins/access.ftp/class.ftpAccessDriver.php and add “return true;” to the beginning of the function “isWriteable”:

        public function isWriteable($path, $type="dir"){
               return true;

               $parts = parse_url($path);
               [...]
        }

Open data/plugins/boot.conf/bootstrap.json and make it look like

{
  "core.conf":{
    "USER_CREATE_REPOSITORY":false,
    "SAVE_GUEST_PREFERENCES":false,
    "SKIP_USER_HISTORY":false,
    "USERS_LIST_COMPLETE_LIMIT":"20",
    "USERS_LIST_COMPLETE_MIN_CHARS":"3",
    "USERS_LIST_HIDE_LOGIN":false,
    "ALLOW_CROSSUSERS_SHARING":false,
    "UNIQUE_INSTANCE_CONFIG":{
      "instance_name":"conf.serial",
      "group_switch_value":"conf.serial"
    }
  },
  "core.auth":{
    "ENABLE_USERS":true,
    "CASE_SENSITIVE":true,
    "ALLOW_GUEST_BROWSING":false,
    "PASSWORD_MINLENGTH":"6",
    "SESSION_SET_CREDENTIALS":true,
    "SECURE_LOGIN_FORM":false,
    "MASTER_INSTANCE_CONFIG":{
      "instance_name":"auth.ftp",
      "TRANSMIT_CLEAR_PASS":true,
      "REPOSITORY_ID":"<YOUR_VALUE>",
      "LOGIN_REDIRECT":"",
      "FTP_LOGIN_SCREEN":true,
      "AUTOCREATE_AJXPUSER":false,
      "AJXP_ADMIN_LOGIN":"",
      "group_switch_value":"auth.ftp"
    },
    "MULTI_MODE":{
      "instance_name":"MASTER_SLAVE",
      "group_switch_value":"MASTER_SLAVE"
    },
    "MULTI_USER_BASE_DRIVER":"",
    "SLAVE_INSTANCE_CONFIG":[

    ],
    "SLAVE_INSTANCE_CONFIG_group_switch":""
  }
}

Replace <YOUR_VALUE> by the md5 hash that you find in the file data/plugins/conf.serial/aliases.ser.

Open file plugins/auth.ftp/manifest.xml. You have to change some lines in there.

Around line 53:
if(el.name != “userid” && el.name!=”password” && el.name != “get_action” && el.name!=”login_seed”){
remove the el.name != “userid” && part so it looks like this:
if(el.name!=”password” && el.name != “get_action” && el.name!=”login_seed”){

Around line 79:
<div class=”dialogLegend” ajxp_message_id=”ftp_auth.1″>AJXP_MESSAGE[ftp_auth.1]</div>
add this directly behind:
<input type=”hidden” name=”FTP_HOST” value=””><input type=”hidden” name=”FTP_SECURE” value=”FALSE”><input type=”hidden” name=”FTP_DIRECT” value=”FALSE”><input type=”hidden” name=”FTP_PORT” value=”21″><input type=”hidden” name=”CHARSET” value=””><input type=”hidden” name=”PATH” value=”/web”>
so it looks like this:
<div class=”dialogLegend” ajxp_message_id=”ftp_auth.1″>AJXP_MESSAGE[ftp_auth.1]</div><input type=”hidden” name=”FTP_HOST” value=””><input type=”hidden” name=”FTP_SECURE” value=”FALSE”><input type=”hidden” name=”FTP_DIRECT” value=”FALSE”><input type=”hidden” name=”FTP_PORT” value=”21″><input type=”hidden” name=”CHARSET” value=””><input type=”hidden” name=”PATH” value=”/web”>

(If you want to grant access to the base dir instead of the web dir, e. g. if you want to access the “private” folder, too, just change the “/web” to “/” in the last hidden input field.)

Around line 82:
Remove these three lines from the file:
<tr>
<td align=”right”><ajxp:message ajxp_message_id=”ftp_auth.2″>AJXP_MESSAGE[ftp_auth.2]</ajxp:message> </td><td colspan=”3″><input type=”text” name=”FTP_HOST” style=”width: 190px; padding:0px; margin-right: 10px;” class=”dialogFocus”><ajxp:message ajxp_message_id=”ftp_auth.8″>AJXP_MESSAGE[ftp_auth.8]</ajxp:message>  <input type=”text” name=”FTP_PORT” style=”width: 25px; padding:0px;” value=”21″></td>
</tr>

Around line 86 (after deleting the previous lines):
Remove all 13 lines from the file. This section starts with:
<tr>
<td colspan=”4″>
<div class=”dialogLegend” style=”margin-top: 12px;” ajxp_message_id=”ftp_auth.3″>AJXP_MESSAGE[ftp_auth.3]</div>

and ends with
<td align=”right”><ajxp:message ajxp_message_id=”ftp_auth.7″>AJXP_MESSAGE[ftp_auth.7]</ajxp:message> </td><td><input type=”radio” name=”FTP_DIRECT” style=”width: 12px; padding:0px;” value=”TRUE”><label style=”display:inline-block;width:27px;”>AJXP_MESSAGE[440]</label><input type=”radio” name=”FTP_DIRECT” style=”width: 12px; padding:0px;” value=”FALSE” checked><label style=”display:inline-block;width:27px;”>AJXP_MESSAGE[441]</label></td>
</tr>

Save your changes.

IMPORTANT! Now you have to clear the data cache:

rm data/cache/*.ser

Now you are finished. Once you reload your pydio login screen in the browser you will be prompted with a slightly different one than before:

screen_14

You can now login with every ftp user you create inside ISPConfig, no matter on what server of your multi-server-setup it resides. Have fun.

 

Comments

comments