Net2ftp integration.

Discussion in 'Tips/Tricks/Mods' started by vsevolod, Jan 11, 2010.

  1. vsevolod

    vsevolod New Member

    Hello!
    In attachment you can read instruction how to integrate Net2ftp in ISPConfig3 on Centos 5.4.
     

    Attached Files:

  2. trx82

    trx82 New Member

    Thanks

    Works with debian lenny too.

    At step 26. insert .icons16.icoWebFTP { background-image: url("../../icons/x16/folder_open.png"); }
    replace the background-image: with background: to have a proper display of folder icon.
     
    Last edited: Jan 12, 2010
  3. por

    por New Member

    Heres how to get it to work with Ubuntu 9.10

    For Ubuntu Karmic Koala 9.10 do the following to add net2ftp/WebFTP:

    1. cd /tmp
    2. wget http://www.net2ftp.com/download/net2ftp_v0.98.zip
    3. unzip net2ftp_v0.98.zip
    4. cd net2ftp_v0.98
    5. mv files_to_upload /var/www/webftp
    6. cd ..
    7. /bin/rm -R net2ftp_v0.98
    8. cd /etc/apache2/conf.d
    9. nano webftp.conf or vi webftp.conf

    Add This:
    <Directory /var/www/webftp>
    Order deny,allow
    Allow from all
    </Directory>
    Alias /net2ftp /var/www/webftp
    Alias /webftp /var/www/webftp

    11. If using nano save with this (CTRL+O,Press Enter,CTRL+X) is vi use this (Shift+ZZ)
    12. /etc/init.d/apache2 restart
    13. cd /var/www/ispconfig/sites
    14. nano site_webftp.php or vi site_webftp.php

    Add This:
    <?php
    require_once('../../lib/config.inc.php');
    require_once('../../lib/app.inc.php');
    $app->auth->check_module_permissions('sites');
    if (!isset($_GET['id'])){
    die ("No site selected!");
    }
    $domainId = intval($_GET['id']);
    $dbData = $app->db->queryOneRecord("SELECT server_id FROM web_domain WHERE
    domain_id = " . $domainId);
    $serverId = intval($dbData['server_id']);
    if ($serverId == 0){
    die ("No Server found!");
    }
    $serverData = $app->db->queryOneRecord(
    "SELECT server_name FROM server WHERE server_id = " .
    $serverId);
    header('location:/webftp?servername="'.$serverData['server_name'].'"');
    exit;
    ?>


    16. If using nano save with this (CTRL+O,Press Enter,CTRL+X) is vi use this (Shift+ZZ)
    17. chown ispconfig:ispconfig site_webftp.php
    18. cd /var/www/ispconfig/sites/templates
    19. nano web_domain_list.htm or vi web_domain_list.htm
    20. /*Go to line 44*/ (if using VI type 44G) | (if using nano just scroll down with arrow, find position typing CTRL+C)
    21. Add This:
    <a class="icons16 icoWebFTP" href="sites/site_webftp.php?id={tmpl_var name='id'}" target="webftp"><span>{tmpl_var name='admin_txt'}</span></a>

    22. If using nano save with this (CTRL+O,Press Enter,CTRL+X) is vi use this (Shift+ZZ)
    23. cd /var/www/ispconfig/themes/default/css/screen
    24. nano content_ispc.css or vi content_ispc.css
    25. /*Go to line 291*/ (if using VI type 291G) | (if using nano just scroll down with arrow, find position typing CTRL+C)
    26. Add This:
    .icons16.icoWebFTP { background-image: url("../../icons/x16/folder_open.png"); }

    27. cd /var/www/webftp
    28. nano settings_authorizations.inc.php or vi settings_authorizations.inc.php
    29. /*Go to line 35*/ (if using VI type 35G) | (if using nano just scroll down with arrow, find position typing CTRL+C)
    30. Find:
    $net2ftp_settings["allowed_ftpservers"][1] = "ALL";
    Change to this:
    //$net2ftp_settings["allowed_ftpservers"][1] = "ALL";//commented out to add webftp/net2ftp

    31. Right above the text you commented out add this:
    $ftp_server=null;
    $ftp_server=trim($_GET['servername'], '"');
    if(!strlen($ftp_server)){
    $ftp_server=$_COOKIE['ftp_server'];
    }
    else{
    setcookie("ftp_server", $ftp_server);
    }
    if(strlen($ftp_server)){
    $net2ftp_settings["allowed_ftpservers"][1] = $ftp_server;
    }
    else{
    $net2ftp_settings["allowed_ftpservers"][1] = "ALL";
    }


    Now you can access webftp from domain list you will see a smal Open folder icon.

    [​IMG]
     
  4. HiresAli

    HiresAli New Member

    I did everything, but i got an error message:


    Warning: ftp_connect() [function.ftp-connect]: php_network_getaddresses: getaddrinfo failed: Name or service not known in /var/www/webftp/includes/filesystem.inc.php on line 53
    An error has occured

    Unable to connect to FTP server on port 21.

    What did i wrong?

    Debian 5
    Ispconfig 3.0.1.1
     
    Last edited: Feb 9, 2010
  5. Nicke

    Nicke New Member

    Point 31

    Code:
    $ftp_server=trim($_GET['servername'], '"');
    should be

    Code:
    $ftp_server=trim($_GET['servername'], '\"');
     
    Last edited: Feb 9, 2010
  6. HiresAli

    HiresAli New Member


    Very THX!!!!
     
  7. BorderAmigos

    BorderAmigos New Member

    This works great. My only issue is that clicking on the symlink for the logs directory crashes net2ftp. Typing it in works though. By reading their forums I see this has been an ongoing issue for years with them. If anyone has this and finds a solution please post it. Thanks.
     
  8. fducloux

    fducloux New Member

    hi guys,
    i think i screwup something :cool:
    when i click on the web2ftp icon i get this

    Code:
    require_once('../../lib/config.inc.php'); require_once('../../lib/app.inc.php'); $app->auth->check_module_permissions('sites'); if (!isset($_GET['id'])){ die ("No site selected!"); } $domainId = intval($_GET['id']); $dbData = $app->db->queryOneRecord("SELECT server_id FROM web_domain WHERE domain_id = " . $domainId); $serverId = intval($dbData['server_id']); if ($serverId == 0){ die ("No Server found!"); } $serverData = $app->db->queryOneRecord( "SELECT server_name FROM server WHERE server_id = " . $serverId); header('location:/webftp?servername="'.$serverData['server_name'].'"'); exit; ?> 
    
    any ideas what i'm missing? :(
     
  9. fducloux

    fducloux New Member

    err never mind.. i guess it's been a long day :)

    i was missing the <?php at the begining!
     
  10. fducloux

    fducloux New Member

    I've automated the whole process and tested it!
    i hope anyone finds this useful

    note: it backup files prior performing any modification, and then shows a diff on a less, so you'll have to press q. and you'll have to delete the backup files manually.

    here's the shell script, you can find it attached and gzipped.

    Code:
    # cat web2ftp.sh 
    #!/bin/bash
    set -x
    
    # Download, unzip, and more
    cd /tmp
    wget http://www.net2ftp.com/download/net2ftp_v0.98.zip
    unzip net2ftp_v0.98.zip
    cd net2ftp_v0.98
    mv files_to_upload /var/www/webftp
    cd ..
    /bin/rm -R net2ftp_v0.98
    
    # add to webftp.conf
    echo ............. Creating /etc/apache2/conf.d/webftp.conf
    cat <<EOF>/etc/apache2/conf.d/webftp.conf
    <Directory /var/www/webftp>
    Order deny,allow
    Allow from all
    </Directory>
    Alias /net2ftp /var/www/webftp
    Alias /webftp /var/www/webftp
    EOF
    
    # Restart apache
    echo ............. Restarting apache
    /etc/init.d/apache2 restart
    
    echo ............. Creating /var/www/ispconfig/sites/site_webftp.php
    cat <<EOF>/var/www/ispconfig/sites/site_webftp.php
    <?php
    require_once('../../lib/config.inc.php');
    require_once('../../lib/app.inc.php');
    \$app->auth->check_module_permissions('sites');
    if (!isset(\$_GET['id'])){
    die ("No site selected!");
    }
    \$domainId = intval(\$_GET['id']);
    \$dbData = \$app->db->queryOneRecord("SELECT server_id FROM web_domain WHERE
    domain_id = " . \$domainId);
    \$serverId = intval(\$dbData['server_id']);
    if (\$serverId == 0){
    die ("No Server found!");
    }
    \$serverData = \$app->db->queryOneRecord(
    "SELECT server_name FROM server WHERE server_id = " .
    \$serverId);
    header('location:/webftp?servername="'.\$serverData['server_name'].'"');
    exit;
    ?>
    EOF
    
    echo ............. Setting permissions for /var/www/ispconfig/sites/site_webftp.php
    chown ispconfig:ispconfig /var/www/ispconfig/sites/site_webftp.php
    
    echo ............. Modifing line 44 /var/www/ispconfig/sites/templates/web_domain_list.htm  Backup on /var/www/ispconfig/sites/templates/web_domain_list.htm.bak.$$
    cp /var/www/ispconfig/sites/templates/web_domain_list.htm /var/www/ispconfig/sites/templates/web_domain_list.htm.bak.$$
    sed -i "44i<a class=\"icons16 icoWebFTP\" href=\"sites/site_webftp.php?id={tmpl_var name=\'id\'}\" target=\"webftp\"><span>{tmpl_var name=\'admin_txt\'}</span></a>" /var/www/ispconfig/sites/templates/web_domain_list.htm
    diff /var/www/ispconfig/sites/templates/web_domain_list.htm /var/www/ispconfig/sites/templates/web_domain_list.htm.bak.$$ |less
    
    
    echo ............. Adding text on line 291 /var/www/ispconfig/themes/default/css/screen/content_ispc.css  Backup on  /var/www/ispconfig/themes/default/css/screen/content_ispc.css.bak.$$
    cp /var/www/ispconfig/themes/default/css/screen/content_ispc.css /var/www/ispconfig/themes/default/css/screen/content_ispc.css.bak.$$
    sed -i '291i.icons16.icoWebFTP { background-image: url(\"../../icons/x16/folder_open.png\"); }' /var/www/ispconfig/themes/default/css/screen/content_ispc.css
    diff /var/www/ispconfig/themes/default/css/screen/content_ispc.css /var/www/ispconfig/themes/default/css/screen/content_ispc.css.bak.$$ |less
    
    echo ............. Commenting line 35 /var/www/webftp/settings_authorizations.inc.php Backup on /var/www/webftp/settings_authorizations.inc.php.bak.$$
    cp /var/www/webftp/settings_authorizations.inc.php /var/www/webftp/settings_authorizations.inc.php.bak.$$
    sed -i '35s/^/\/\/ /'  /var/www/webftp/settings_authorizations.inc.php
    sed -i '35s/$/ \/\/commented out to add webftpi\/net2ftp/'  /var/www/webftp/settings_authorizations.inc.php
    diff /var/www/webftp/settings_authorizations.inc.php /var/www/webftp/settings_authorizations.inc.php.bak.$$  |less 
    
    echo ............. Adding text on line 34  /var/www/webftp/settings_authorizations.inc.php Backup on /var/www/webftp/settings_authorizations.inc.php.bak2.$$
    cp /var/www/webftp/settings_authorizations.inc.php /var/www/webftp/settings_authorizations.inc.php.bak2.$$
    
    sed -i "34i \$ftp_server=null; \n \$ftp_server=trim\(\$_GET[\'servername\'], \'\\\\\"\'\); \n if\(!strlen\(\$ftp_server\)\){ \n \$ftp_server=\$_COOKIE[\'ftp_server\']; \n } \n else{ \n setcookie\(\"ftp_server\", \$ftp_server\); \n } \n if(strlen\(\$ftp_server\)\){ \n \$net2ftp_settings[\"allowed_ftpservers\"][1] = \$ftp_server; \n } \n else{ \n \$net2ftp_settings[\"allowed_ftpservers\"][1] = \"ALL\"; \n } \n 
    " /var/www/webftp/settings_authorizations.inc.php
    
    diff /var/www/webftp/settings_authorizations.inc.php /var/www/webftp/settings_authorizations.inc.php.bak2.$$  |less
    


    BTW, i'm quite good with shell scripting, and a complete n00b when it comes to PHP or MySQL!
    Could any one do the same thing for Z-Push? It would be awesome to have push-imap into ISPConfig!!

    http://z-push.sourceforge.net/soswp/


    Cheers!
     

    Attached Files:

    Last edited: Mar 15, 2010
  11. dclardy

    dclardy New Member

    I used the script to install the service, but I get an error when clicking on the folder icon.

    Any help would be appreciated.

    Code:
    <\?php require_once('../../lib/config.inc.php'); require_once('../../lib/app.inc.php'); $app->auth->check_module_permissions('sites'); if (!isset($_GET['id'])){ die ("No site selected!"); } $domainId = intval($_GET['id']); $dbData = $app->db->queryOneRecord("SELECT server_id FROM web_domain WHERE domain_id = " . $domainId); $serverId = intval($dbData['server_id']); if ($serverId == 0){ die ("No Server found!"); } $serverData = $app->db->queryOneRecord( "SELECT server_name FROM server WHERE server_id = " . $serverId); header('location:/webftp?servername="'.$serverData['server_name'].'"'); exit; ?> 
    I am pretty sure that it has something to do with the leading slash, but where do I go to change this?
     
  12. dclardy

    dclardy New Member

    The leading "\" was the issue. I took that out from the /var/www/ispconfig/sites/site_webftp.php file, and it works fine now.

    Thanks.
     
  13. fducloux

    fducloux New Member

    oh sorry about that!
    it's in /var/www/ispconfig/sites/site_webftp.php

    i'll fix the script and upload it agan.
     
  14. fducloux

    fducloux New Member

    here's the script after fixing line number 30.
     

    Attached Files:

  15. theWeird

    theWeird Member

    Today I found this project and I really like it:
    http://www.ajaxplorer.info
    Do you think there is any way to integrate it with ISP3 as web FTP?
     
  16. Germanius

    Germanius New Member

    Ajaxplorer is really nice. Can somebody write a howto like the one for net2ftp?
     
  17. apoana

    apoana New Member

    Using AjaxPlorer integrated with ISPCONFIG

    Hi,

    No really an Howto, but, some info how I integrated AjaxPlorer with my multiserver ISPCONFIG setup. I attached to this post all files changed to get the integration done.


    In the ISPCONFIG master server:
    -------------------------------

    1) Install and make work the default AjaxPlorer in /var/www/AjaXplorer - in the attached file is an apache configuration file named ajaxexplorer.conf, put it on /etc/apache2/conf.d

    2) Access Ajaxplorer in your browse using an URL like http://www.yourispconfigmaster.com/_fm and test using the default login for newly installed Ajaxplorer. If it's works go to step 3, else, correct erros and try again.

    3) Add to the AjaxPlorer plugins dir the directory named "auth.ispconfig" from the attached file, correct file permissions and owners.

    4) Get the conf.php from the attached file and put in the ajaxPlorer installation dir server/conf, change permissions/owner.

    5) Edit the new conf.php and change the configuration to allow ajaxPlorer acces your ISPCONFIG database. You need to change $CONF_STORAGE and $AUTH_DRIVER.

    6) Create on the ISPCONFIG master database the tables used by AjaxPlorer configuration. You can get an sql file inside plugins/conf.sql - remember, these tables MUST BE on the ISPCONFIG master database.

    7) Copy from the attached zip the file ftp_user.tform.php to /usr/local/ispconfig/interface/web/sites/form/ftp_user.tform.php - by default ISPCONFIG store the FTP user password encrypted, but, ajaxPlorer need to read it to make an login to the FTP server where the client must login in.

    all changes in the ISPCONFIG master server are done.


    In the ISPCONFIG www server (where the client sites are hosted):
    ---------------------------------------------------------------

    1) Put in the /usr/local/ispconfig/server/plugins-avaiable the file ftpuser_base_plugin.inc.php from the attached file.
    2) Change /etc/pure-ftpd/db/mysql.conf: MYSQLCrypt cleartext

    done changes on the www server.


    Some clarifications about this setup:

    1) I have an multiserver ISPCONFIG setup
    2) The login name for AjaxPlorer is the client login and password in ISPCONFIG, not the FTP login.
    3) after logged in AjaxPlorer the client have all FTP repositories from his account avaiable to browse.
    4) I Know, change the storage method from encrypted to plain text for the FTP accounts is not good for security, but, AjaxPlorer need to read the password in plain text to make the login in the FTP server to allow work. An solution for this can be make an auth plugin for pure-ftpd.
    5) To put an icon on ISPCONFIG to call a new window with AjaxPlorer is only a matter of change the WEB2FTP example.

    To Be Done:
    ------------

    1) Make the client login automatic in AjaxPlorer.
    2) Add client MySql databases as reporitories on AjaxPlorer - this can be done adding some code in the MySql plugin as I have made for the FTP plugin.


    After all, sorry for my bad english.
     

    Attached Files:

  18. mirk67

    mirk67 New Member

    white site page

    my problem

    [​IMG]

    help me please
     
  19. till

    till Super Moderator Howtoforge Staff HowtoForge Supporter ISPConfig Developer

    And how is this related to net2ftp?
     
  20. mirk67

    mirk67 New Member

    yes
    I followed the guide for ubuntu
    I have ubuntu server 9.10
     
: net2ftp, webftp

Share This Page