Difference between revisions of "Webshare"

From SME Server
Jump to navigationJump to search
(Added upload file size section & commands)
 
(32 intermediate revisions by 9 users not shown)
Line 1: Line 1:
== Webshare for SME Server ==
+
{{Languages}}
 +
 
 +
{{Warning box| this contrib is not maintained and the php phpfm used to display files needs to be updated to something else as it seems not maintained anymore. Use at your own risks}}
  
 
=== Maintainer ===
 
=== Maintainer ===
[http://myezserver.com/ Darrel May] (Contrib)
+
no active maintainer.
 +
 
 +
original contributor: [http://myezserver.com/ Darrel May] (Contrib)  
 +
 
 +
=== Version ===
 +
{{ #smeversion: smeserver-webshare }}
  
 
=== Description ===
 
=== Description ===
Line 10: Line 17:
 
*Can handle many filetypes in the webbrowser.
 
*Can handle many filetypes in the webbrowser.
  
<br>Step-by-step silly HowTo for installation of Webshare on a fresh SMEserver 7.1.3.
+
<br>Step-by-step HowTo for installation of Webshare on a fresh SMEserver 7.x. Will not install on Koozali SME Server 9.1.
  
It reflects the experiences I've had during install and are probably not always applicable.
+
Check latest releases at http://mirror.contribs.org/smeserver/releases/7/smecontribs/i386/RPMS/
  
It's intended for Linux-newbies.
+
=== Installation SME8 ===
  
Check latest releases at http://mirror.contribs.org/smeserver/contribs/dmay/smeserver/7.x/
+
1. Log in (with username root) to the SMEserver console.
  
Replace filenames if you use other versions.
+
2. Install smeserver-webshare from the smecontribs repo (which also installs the dependency perl-Apache-Htpasswd & perl-Crypt-PasswdMD5)
  
I don't use smedev for this install [http://forums.contribs.org/index.php?topic=36433.0 as advised by dmay]
+
yum install --enablerepo=smecontribs smeserver-webshare
  
=== Installation ===
+
3. Instructions at the end of previous installation advises the following commands:
 +
<br><code>signal-event post-upgrade and signal-event reboot</code>
 +
<br>but you can skip that (not necessary) and move on.
  
1. Log in (with username root) to the SMEserver console.
 
  
2. Download perl-Apache-Htpasswd (needed by package smeserver-webshare)
+
4. In a web browser login to server-manager as admin.
 +
<br>Under Collaboration there should be a new line named "Webshare".
 +
Configure the webshare name, users and passwords.
  
wget http://mirror.contribs.org/smeserver/contribs/dmay/smeserver/7.x/perl-Apache-Htpasswd-1.5.9-1.1.el3.rf.noarch.rpm
 
  
3. Install perl-Apache-Htpasswd
+
5. Access the newly created webshare using https://www.yourdomain.com/webshare/websharename
 +
Upload and download files as required.
  
yum localinstall perl-Apache-Htpasswd-1.5.9-1.1.el3.rf.noarch.rpm
+
=== Installation SME9 ===
 +
Update pending. Being moved to smecontribs for Koozali SME 9.
  
You will get a y/N-question, answer y if it looks fine.
+
1. Login as root to the console.
  
Instructions at the end of previous installation advices the following commands:
+
2. This contrib currently resides in the sme8contribs repository. See https://wiki.contribs.org/SME9.0_Contribs_QA#Setup for instructions on enabling it. Dependencies require the enabling of the epel repository as well https://wiki.contribs.org/Epel#tab=For_SME_9_x.
<br>"signal-event post-upgrade" and "signal-event reboot"
 
<br>But you can ignore that and move on
 
  
4. Download smeserver-webshare
+
3. Install with
 +
  yum --enablerepo=sme8contribs,smecontribs,epel install smeserver-webshare
  
  wget http://mirror.contribs.org/smeserver/contribs/dmay/smeserver/7.x/smeserver-webshare-1.0.0-8dmay.noarch.rpm
+
4. Then
 +
  signal-event post-upgrade; signal-event reboot
  
5. Install smeserver-webshare
+
5. Go to server-manager panel and setup webshares.
  
yum localinstall smeserver-webshare-1.0.0-8dmay.noarch.rpm
+
6. Access webshare using
 
+
https://your-domain.tld/webshare/nameofshare
You will get a y/N-question, answer y if it looks fine.
 
 
 
6. Instructions at the end of previous installation advices the following commands:
 
<br><code>signal-event post-upgrade and signal-event reboot</code>
 
<br>but you can skip that (not necessary) and move on.
 
 
 
7. Open your webbrowser and go to the server-manager.
 
<br>Under Collaboration there should be a new line named "Webshare".
 
  
 
==== Check installed version ====
 
==== Check installed version ====
Line 86: Line 89:
 
  expand-template /etc/php.ini
 
  expand-template /etc/php.ini
 
  /etc/init.d/httpd-e-smith restart
 
  /etc/init.d/httpd-e-smith restart
 +
 +
=== Using with ibays & SME users ===
 +
 +
From this Italian forum post http://forums.contribs.org/index.php/topic,46399.msg227523.html#msg227523
 +
 +
are instructions re how to use webshare with an ibay and SME users, so the files/dirs are available also via samba. This allows an ibay to be accessed by the webshare frontend it does not link the standard webshare to the ibay webshare. 
 +
 +
Create the custom template and fragment
 +
mkdir -p /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf
 +
cd /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf
 +
nano 86WebSharealias
 +
 +
Contents of 86WebSharealias
 +
{
 +
    my $db      = esmith::ConfigDB->open_ro("WebShare")
 +
    or return "# webshare disabled\n";
 +
 +
    my @webshare = $db->get_all_by_prop( type => 'WebShare' );
 +
 +
    foreach $webshare (@webshare) {
 +
        #name
 +
        my $key = $webshare->key;
 +
        #use  ibay?
 +
        my $useibay = $webshare->prop('UseIbay') || "no";
 +
        #use sme users?
 +
        my $smeusers = $webshare->prop('SmeUsers') || "no";
 +
        $OUT .= "# webshare\/$key\n";
 +
 +
        if ( "$useibay" eq "no" ) {
 +
                $OUT .= "Alias \/webshare\/$key \/opt\/webshare\/$key\n";
 +
                $OUT .= "<Directory \/opt\/webshare\/$key>\n";
 +
        }
 +
        else {
 +
                $OUT .= "Alias \/webshare\/$key \/home\/e-smith\/files\/ibays\/$key\/html\n";
 +
                $OUT .= "<Directory \/home\/e-smith\/files\/ibays\/$key\/html>\n";
 +
        }
 +
        {
 +
            use esmith::util;
 +
            my $release = esmith::util::determineRelease();
 +
            if ( "$release" ge "7.0" ) {
 +
                $OUT .= "    SSLRequireSSL\n";
 +
            }
 +
            else {
 +
                $OUT .= "    RequireSSL on\n";
 +
            }
 +
        }
 +
        $OUT .= "    Options +Indexes\n";
 +
        $OUT .= "    AllowOverride None\n";
 +
        $OUT .= "    order deny,allow\n";
 +
        $OUT .= "    deny from all\n";
 +
        $OUT .= "    allow from all\n";
 +
        $OUT .= "    AuthName \"Restricted $key access only\"\n";
 +
        $OUT .= "    AuthType Basic\n";
 +
 +
        if ( "$smeusers" eq "no" ) {     
 +
                $OUT .= "    AuthUserFile \/home\/e-smith\/db\/webshare\/htpasswd.$key\n";
 +
        }
 +
        else {
 +
                $OUT .= "    AuthExternal pwauth\n";
 +
        }
 +
        $OUT .= "    Require valid-user\n";
 +
        $OUT .= "    AddType application\/x-httpd-php \.php \.php3\n";
 +
        $OUT .= "    php_flag  magic_quotes_gpc  on\n";
 +
        $OUT .= "    php_flag  track_vars        on\n";
 +
        $OUT .= "<\/Directory>\n";
 +
        $OUT .= "\n";
 +
    }
 +
}
 +
 +
Create an ibay in server manager with the name ibaywebsharename, with no password and enable "Execution of dynamic content".
 +
{{Note box|ibaywebsharename should be the same as websharename and ibayname}}
 +
 +
Configure the db setting, expand template & restart service
 +
db WebShare setprop ibaywebsharename UseIbay yes SmeUsers yes
 +
expand-template /etc/httpd/conf/httpd.conf
 +
service httpd-e-smith restart
 +
 +
 +
Copy files from original webshare in /opt to ibay
 +
cd /opt/webshare/ibaywebsharename
 +
cp -a ./* /home/e-smith/files/ibays/ibaywebsharename/html/
 +
cd /home/e-smith/files/ibays/ibaywebsharename/html
 +
rm index.html
 +
 +
{{Note box|Previous step is necessary to migrate from old files location to the new one.. it should be not necessary for new webshares '''not tested'''}}
 +
 +
Now Create a link in the /home/e-smith/files/ibays/ibaywebsharename/html dir
 +
mv ./files ./files.old
 +
ln -s ../files
 +
 +
Access the ibay webshare via web browser with this URL (note to use https:)
 +
https://yourdomain.com/ibaywebsharename
 +
 +
Access the ibay webshare files locally via samba network share
 +
\\servername\ibaywebsharename\files
  
 
=== Additional information ===
 
=== Additional information ===
Line 92: Line 190:
  
 
*Add [http://forums.contribs.org/index.php?topic=39729.0;topicseen more than four uploads].
 
*Add [http://forums.contribs.org/index.php?topic=39729.0;topicseen more than four uploads].
 +
 +
==special WebShare==
 +
 +
to be documented more but reading configuration file you can create a special webshare with user that have right on other webspaces.
 +
It seems that to do so you have to create
 +
db WebShare set MultiAccess MultiAccess WebShareName YOURNAME Webshares SHARE2,SHARE3,SHARE5 Users user1:pass1,user2:pass2
  
 
=== Bugs ===
 
=== Bugs ===
 
Please raise bugs under the SME-Contribs section in {{BugzillaFileBug|product=|component=|title=bugzilla}}and select the smeserver-webshare component or use {{BugzillaFileBug|product=SME%20Contribs|component=smeserver-webshare|title=this link}}.
 
Please raise bugs under the SME-Contribs section in {{BugzillaFileBug|product=|component=|title=bugzilla}}and select the smeserver-webshare component or use {{BugzillaFileBug|product=SME%20Contribs|component=smeserver-webshare|title=this link}}.
 +
 +
{{#bugzilla:columns=id,product,version,status,summary |sort=id|order=desc|disablecache=1 |component=smeserver-webshare|noresultsmessage="No open bugs found."}}
  
 
=== Tested software versions ===
 
=== Tested software versions ===

Latest revision as of 23:19, 3 March 2017



Warning.png Warning:
this contrib is not maintained and the php phpfm used to display files needs to be updated to something else as it seems not maintained anymore. Use at your own risks


Maintainer

no active maintainer.

original contributor: Darrel May (Contrib)

Version

Contrib 10:
Contrib 9:
smeserver-webshare
The latest version of smeserver-webshare is available in the SME repository, click on the version number(s) for more information.


Description

  • Webshare is an addon for SME Server that provides secure web accessible file and directory storage.
  • Create and set permissions for each share via Server-manager GUI.
  • Can handle many filetypes in the webbrowser.


Step-by-step HowTo for installation of Webshare on a fresh SMEserver 7.x. Will not install on Koozali SME Server 9.1.

Check latest releases at http://mirror.contribs.org/smeserver/releases/7/smecontribs/i386/RPMS/

Installation SME8

1. Log in (with username root) to the SMEserver console.

2. Install smeserver-webshare from the smecontribs repo (which also installs the dependency perl-Apache-Htpasswd & perl-Crypt-PasswdMD5)

yum install --enablerepo=smecontribs smeserver-webshare

3. Instructions at the end of previous installation advises the following commands:


signal-event post-upgrade and signal-event reboot


but you can skip that (not necessary) and move on.


4. In a web browser login to server-manager as admin.
Under Collaboration there should be a new line named "Webshare". Configure the webshare name, users and passwords.


5. Access the newly created webshare using https://www.yourdomain.com/webshare/websharename Upload and download files as required.

Installation SME9

Update pending. Being moved to smecontribs for Koozali SME 9.

1. Login as root to the console.

2. This contrib currently resides in the sme8contribs repository. See https://wiki.contribs.org/SME9.0_Contribs_QA#Setup for instructions on enabling it. Dependencies require the enabling of the epel repository as well https://wiki.contribs.org/Epel#tab=For_SME_9_x.

3. Install with

 yum --enablerepo=sme8contribs,smecontribs,epel install smeserver-webshare

4. Then

signal-event post-upgrade; signal-event reboot

5. Go to server-manager panel and setup webshares.

6. Access webshare using

https://your-domain.tld/webshare/nameofshare

Check installed version

yum info installed smeserver-webshare
yum info installed perl-Apache-Htpasswd

Uninstall

yum remove smeserver-webshare
yum remove perl-Apache-Htpasswd


Adjusting upload file size

Default php settings in sme server will severely limit the file upload size.

These can be adjusted by db commands, see http://wiki.contribs.org/index.php?title=SME_Server:Documentation:Technical_Manual:Booklet#Php

To see the default settings do

config show php

The following commands will set a 50Mb file upload size.

As this includes system overheads, you should specify a value slightly larger than the maximum file size you wish to upload.

db configuration setprop php MaxExecutionTime 3600
db configuration setprop php MemoryLimit 50M
db configuration setprop php PostMaxSize 50M
db configuration setprop php UploadMaxFilesize 50M
expand-template /etc/php.ini
/etc/init.d/httpd-e-smith restart

Using with ibays & SME users

From this Italian forum post http://forums.contribs.org/index.php/topic,46399.msg227523.html#msg227523

are instructions re how to use webshare with an ibay and SME users, so the files/dirs are available also via samba. This allows an ibay to be accessed by the webshare frontend it does not link the standard webshare to the ibay webshare.

Create the custom template and fragment

mkdir -p /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf
cd /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf
nano 86WebSharealias

Contents of 86WebSharealias

{
   my $db       = esmith::ConfigDB->open_ro("WebShare")
   or return "# webshare disabled\n";

   my @webshare = $db->get_all_by_prop( type => 'WebShare' );

   foreach $webshare (@webshare) {
       #name
       my $key = $webshare->key;
       #use  ibay?
       my $useibay = $webshare->prop('UseIbay') || "no";
       #use sme users?
       my $smeusers = $webshare->prop('SmeUsers') || "no";
       $OUT .= "# webshare\/$key\n";

       if ( "$useibay" eq "no" ) {
               $OUT .= "Alias \/webshare\/$key \/opt\/webshare\/$key\n";
               $OUT .= "<Directory \/opt\/webshare\/$key>\n";
       }
       else {
               $OUT .= "Alias \/webshare\/$key \/home\/e-smith\/files\/ibays\/$key\/html\n";
               $OUT .= "<Directory \/home\/e-smith\/files\/ibays\/$key\/html>\n";
       }
       {
           use esmith::util;
           my $release = esmith::util::determineRelease();
           if ( "$release" ge "7.0" ) {
               $OUT .= "    SSLRequireSSL\n";
           }
           else {
               $OUT .= "    RequireSSL on\n";
           }
       }
       $OUT .= "    Options +Indexes\n";
       $OUT .= "    AllowOverride None\n";
       $OUT .= "    order deny,allow\n";
       $OUT .= "    deny from all\n";
       $OUT .= "    allow from all\n";
       $OUT .= "    AuthName \"Restricted $key access only\"\n";
       $OUT .= "    AuthType Basic\n";

       if ( "$smeusers" eq "no" ) {       
               $OUT .= "    AuthUserFile \/home\/e-smith\/db\/webshare\/htpasswd.$key\n";
       }
       else {
               $OUT .= "    AuthExternal pwauth\n";
       }
       $OUT .= "    Require valid-user\n";
       $OUT .= "    AddType application\/x-httpd-php \.php \.php3\n";
       $OUT .= "    php_flag  magic_quotes_gpc  on\n";
       $OUT .= "    php_flag  track_vars        on\n";
       $OUT .= "<\/Directory>\n";
       $OUT .= "\n";
   }
}

Create an ibay in server manager with the name ibaywebsharename, with no password and enable "Execution of dynamic content".

Important.png Note:
ibaywebsharename should be the same as websharename and ibayname


Configure the db setting, expand template & restart service

db WebShare setprop ibaywebsharename UseIbay yes SmeUsers yes
expand-template /etc/httpd/conf/httpd.conf
service httpd-e-smith restart


Copy files from original webshare in /opt to ibay

cd /opt/webshare/ibaywebsharename
cp -a ./* /home/e-smith/files/ibays/ibaywebsharename/html/
cd /home/e-smith/files/ibays/ibaywebsharename/html
rm index.html


Important.png Note:
Previous step is necessary to migrate from old files location to the new one.. it should be not necessary for new webshares not tested


Now Create a link in the /home/e-smith/files/ibays/ibaywebsharename/html dir

mv ./files ./files.old
ln -s ../files

Access the ibay webshare via web browser with this URL (note to use https:)

https://yourdomain.com/ibaywebsharename

Access the ibay webshare files locally via samba network share

\\servername\ibaywebsharename\files

Additional information

special WebShare

to be documented more but reading configuration file you can create a special webshare with user that have right on other webspaces. It seems that to do so you have to create

db WebShare set MultiAccess MultiAccess WebShareName YOURNAME Webshares SHARE2,SHARE3,SHARE5 Users user1:pass1,user2:pass2

Bugs

Please raise bugs under the SME-Contribs section in bugzilla and select the smeserver-webshare component or use this link .

IDProductVersionStatusSummary
12779SME Contribs11.0CONFIRMEDperl-CGI 'startform' and 'endform' are dropped in favor of 'start_form' and 'end_form'

Tested software versions

Host: SMEserver v7.1 with update 3 (7.1.3)

Installed: perl-Apache-Htpasswd.noarch 0:1.5.9-1.1.el3.rf

Installed: smeserver-webshare.noarch 0:1.0.0-8dmay