Koozali.org: home of the SME Server

Installing TWiki how to allow perl from /opt

Offline chrislaurie

  • *
  • 96
  • +0/-0
Installing TWiki how to allow perl from /opt
« on: March 14, 2008, 03:56:39 AM »
I'm trying to install TWiki (a perl script) on my SME 7.2 using /opt instead of an ibay.

When I run the configure script I get the following error:

eval "use CGI::Carp qw(fatalsToBrowser)";
if ($@) {
    print <<"REPORT";
Content-type: text/plain

Could not load CGI::Carp. Please install this module before continuing.
It can be downloaded from http://www.cpan.org

But, SME does have CGI:Carp installed (v1.28).

I suspect that I need to do something else to allow apache to run the perl scripts. The admin pages are perls scripts so it should be possible, I assume.


Offline cactus

  • *
  • 4,880
  • +3/-0
    • http://www.snetram.nl
Re: Installing TWiki how to allow perl from /opt
« Reply #1 on: March 14, 2008, 10:03:19 AM »
I'm trying to install TWiki (a perl script) on my SME 7.2 using /opt instead of an ibay.

When I run the configure script I get the following error:

eval "use CGI::Carp qw(fatalsToBrowser)";
if ($@) {
    print <<"REPORT";
Content-type: text/plain

Could not load CGI::Carp. Please install this module before continuing.
It can be downloaded from http://www.cpan.org

But, SME does have CGI:Carp installed (v1.28).

I suspect that I need to do something else to allow apache to run the perl scripts. The admin pages are perls scripts so it should be possible, I assume.


AFAIK SME Server does not have CGI:Carp installed by default:

Code: [Select]
[root@sme73test ~]# rpm -qa | grep perl | grep -i carp
perl-Carp-Assert-0.20-1.el4.rf
[root@sme73test ~]#

Whatever you do do not install it using the cpan command, try and find it as an RPM in the dag or atrpms repository, most of the times it is listed there as perl-CGI-Carp I guess. Configuration instructions for those repositories are in the wiki.

The server should run perl scripts by default from the cgi-bin folder of an ibay or from the html folder if you allow the execution of active content, however it might well be not aware of the location of perl and it's libraries how to set that I do not know.
Be careful whose advice you buy, but be patient with those who supply it. Advice is a form of nostalgia, dispensing it is a way of fishing the past from the disposal, wiping it off, painting over the ugly parts and recycling it for more than its worth ~ Baz Luhrmann - Everybody's Free (To Wear Sunscreen)

Offline chrislaurie

  • *
  • 96
  • +0/-0
Re: Installing TWiki how to allow perl from /opt
« Reply #2 on: March 14, 2008, 11:30:15 AM »
Thanx for the response.

Maybe one of the other contribs loaded Carp:

[root]#perl -e 'use CGI::Carp; print $CGI::Carp::VERSION."\n"'
1.28

I suspect that you are right and that the twiki scripts somehow does not know how to load the perl libraries.

Offline SARK devs

  • ****
  • 2,806
  • +1/-0
    • http://sarkpbx.com
Re: Installing TWiki how to allow perl from /opt
« Reply #3 on: March 14, 2008, 12:47:34 PM »
Don't know if it helps but we just run TWiki from an Ibay and it works fine.


Offline Davidof

  • 6
  • +0/-0
Re: Installing TWiki how to allow perl from /opt
« Reply #4 on: April 22, 2008, 04:45:29 PM »
Selintra,


   Could you tell us how do you install twiki in an ibay ?


Thanks,

David

Offline Normando

  • *
  • 841
  • +2/-1
    • Unixlan
Re: Installing TWiki how to allow perl from /opt
« Reply #5 on: April 22, 2008, 06:04:58 PM »
I have installed sucesfully twiki under /opt directory.

Create a directory named twiki under /opt dir.

Extract all content from twiki tar file under /opt/twiki (bin, data, etc)

Follow the twiki instructions about perl dependancy and requirement, and configure.

Create a new file named "mod_perl_startup.pl" under /opt/twiki/tools/ with this content:

Code: [Select]
$ENV{MOD_PERL} =~ /mod_perl/ or die "mod_perl_startup called, but mod_perl not used!";
use lib qw( /opt/twiki/bin );
require 'setlib.cfg';
1;

Create a custom template named "98Twiki" under /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf with the following content.

Code: [Select]
# Autogenerated httpd.conf file for TWiki.
# Generated at http://twiki.org/cgi-bin/view/TWiki/ApacheConfigGenerator
# For TWiki version 4.2.X

# We set an environment variable called blockAccess.
#
# Setting a BrowserMatchNoCase to ^$ is important. It prevents TWiki from
# including its own topics as URLs and also prevents other TWikis from
# doing the same. This is important to prevent the most obvious
# Denial of Service attacks.
#
# You can expand this by adding more BrowserMatchNoCase statements to
# block evil browser agents trying the impossible task of mirroring a twiki
#
# Example:
# BrowserMatchNoCase ^SiteSucker blockAccess
# BrowserMatchNoCase ^$ blockAccess

BrowserMatchNoCase ^Accoona blockAccess
BrowserMatchNoCase ^ActiveAgent blockAccess
BrowserMatchNoCase ^Attache blockAccess
BrowserMatchNoCase BecomeBot blockAccess
BrowserMatchNoCase ^bot blockAccess
BrowserMatchNoCase Charlotte/ blockAccess
BrowserMatchNoCase ^ConveraCrawler blockAccess
BrowserMatchNoCase ^CrownPeak-HttpAgent blockAccess
BrowserMatchNoCase ^EmailCollector blockAccess
BrowserMatchNoCase ^EmailSiphon blockAccess
BrowserMatchNoCase ^e-SocietyRobot blockAccess
BrowserMatchNoCase ^Exabot blockAccess
BrowserMatchNoCase ^FAST blockAccess
BrowserMatchNoCase ^FDM blockAccess
BrowserMatchNoCase ^GetRight/6.0a blockAccess
BrowserMatchNoCase ^GetWebPics blockAccess
BrowserMatchNoCase ^Gigabot blockAccess
BrowserMatchNoCase ^gonzo1 blockAccess
BrowserMatchNoCase ^Google\sSpider blockAccess
BrowserMatchNoCase ^ichiro blockAccess
BrowserMatchNoCase ^ie_crawler blockAccess
BrowserMatchNoCase ^iGetter blockAccess
BrowserMatchNoCase ^IRLbot blockAccess
BrowserMatchNoCase Jakarta blockAccess
BrowserMatchNoCase ^Java blockAccess
BrowserMatchNoCase ^KrakSpider blockAccess
BrowserMatchNoCase ^larbin blockAccess
BrowserMatchNoCase ^LeechGet blockAccess
BrowserMatchNoCase ^LinkWalker blockAccess
BrowserMatchNoCase ^Lsearch blockAccess
BrowserMatchNoCase ^Microsoft blockAccess
BrowserMatchNoCase ^MJ12bot blockAccess
BrowserMatchNoCase MSIECrawler blockAccess
BrowserMatchNoCase ^MSRBOT blockAccess
BrowserMatchNoCase ^noxtrumbot blockAccess
BrowserMatchNoCase ^NutchCVS blockAccess
BrowserMatchNoCase ^RealDownload blockAccess
BrowserMatchNoCase ^Rome blockAccess
BrowserMatchNoCase ^Roverbot blockAccess
BrowserMatchNoCase ^schibstedsokbot blockAccess
BrowserMatchNoCase ^Seekbot blockAccess
BrowserMatchNoCase ^SiteSnagger blockAccess
BrowserMatchNoCase ^SiteSucker blockAccess
BrowserMatchNoCase ^Snapbot blockAccess
BrowserMatchNoCase ^sogou blockAccess
BrowserMatchNoCase ^SpiderKU blockAccess
BrowserMatchNoCase ^SpiderMan blockAccess
BrowserMatchNoCase ^Squid blockAccess
BrowserMatchNoCase ^Teleport blockAccess
BrowserMatchNoCase ^User-Agent\: blockAccess
BrowserMatchNoCase VoilaBot blockAccess
BrowserMatchNoCase ^voyager blockAccess
BrowserMatchNoCase ^W3C blockAccess
BrowserMatchNoCase ^w3search blockAccess
BrowserMatchNoCase ^Web\sDownloader blockAccess
BrowserMatchNoCase ^WebCopier blockAccess
BrowserMatchNoCase ^WebDevil blockAccess
BrowserMatchNoCase ^WebSec blockAccess
BrowserMatchNoCase ^WebVac blockAccess
BrowserMatchNoCase ^Webwhacker blockAccess
BrowserMatchNoCase ^Webzip blockAccess
BrowserMatchNoCase ^Wells blockAccess
BrowserMatchNoCase ^WhoWhere blockAccess
BrowserMatchNoCase www\.netforex\.org blockAccess
BrowserMatchNoCase ^WX_mail blockAccess
BrowserMatchNoCase ^yacybot blockAccess
BrowserMatchNoCase ^ZIBB blockAccess
BrowserMatchNoCase ^$ blockAccess


# Mod_perl preloading
PerlRequire /opt/twiki/tools/mod_perl_startup.pl
PerlSwitches -T

# The ScriptAlias defines the bin directory as a directory where CGI
# scripts are allowed.
# The first parameter will be part of the URL to your installation e.g.
# http://my.co.uk/twiki/bin/view/...
# The second parameter must point to the physical path on your disc.
#ScriptAlias /twiki/bin "/opt/twiki/bin"

# The Alias defines a url that points to the root of the twiki installation.
# It is used to access files in the pub directory (attachments etc)
# It must come _after_ the ScriptAlias.
#Alias /twiki "/opt/twiki"

ScriptAlias /twiki/bin "/opt/twiki/bin"
Alias /twiki/pub "/opt/twiki/pub"
Alias /twiki "/opt/twiki/bin/view"

# Block access to typical spam related attachments
# Except the TWiki directory which is read only and does have attached html files.
SetEnvIf Request_URI "twiki/pub/.*\.[hH][tT][mM]?$" blockAccess
SetEnvIf Request_URI "twiki/pub/TWiki/.*\.[hH][tT][mM]?$" !blockAccess

# This specifies the options on the TWiki scripts directory. The ExecCGI
# and SetHandler tell apache that it contains scripts. "Allow from all"
# lets any IP address access this URL.
<Directory "/opt/twiki/bin">
    AllowOverride None
    Order Allow,Deny
    Allow from all
    Deny from env=blockAccess

    Options ExecCGI FollowSymLinks
    SetHandler cgi-script

    # Password file for TWiki users
    AuthUserFile /opt/twiki/data/.htpasswd
    AuthName 'Enter your WikiName: (First name and last name, no space, no dots, capitalized, e.g. JohnSmith). Cancel to register if you do not have one.'
    AuthType Basic

    # File to return on access control error (e.g. wrong password)
    ErrorDocument 401 /twiki/bin/view/TWiki/TWikiRegistration

# Limit access to configure to specific IP addresses and or users.
# Make sure configure is not open to the general public.
# It exposes system details that can help attackers.
<FilesMatch "^(configure)$">
    SetHandler cgi-script
    Order Deny,Allow
    Deny from all
    Allow from localhost
    Require user Normando admin
    Satisfy Any
</FilesMatch>

# Enable mod_perl for the bin scripts listed

<FilesMatch "(attach|edit|manage|rename|save|upload|view|rest|.*auth).*">
    SetHandler perl-script
    PerlResponseHandler ModPerl::Registry
    PerlSendHeader On
    PerlOptions +ParseHeaders
</FilesMatch>

</Directory>

# This sets the options on the pub directory, which contains attachments and
# other files like CSS stylesheets and icons. AllowOverride None stops a
# user installing a .htaccess file that overrides these options.
# Note that files in pub are *not* protected by TWiki Access Controls,
# so if you want to control access to files attached to topics you need to
# block access to the specific directories same way as the ApacheConfigGenerator
# blocks access to the pub directory of the Trash web
<Directory "/opt/twiki/pub">
    Options None
    AllowOverride None
    Order Allow,Deny
    Allow from all
    Deny from env=blockAccess

    # Disable execusion of PHP scripts
    php_admin_flag engine off

    # This line will redefine the mime type for the most common types of scripts
    AddType text/plain .shtml .php .php3 .phtml .phtm .pl .py .cgi
#
#add an Expires header that is sufficiently in the future that the browser does not even ask if its uptodate
# reducing the load on the server significantly
#IF you can, you should enable this - it _will_ improve your twiki experience, even if you set it to under one day.
# you may need to enable expires_module in your main apache config
#LoadModule expires_module libexec/httpd/mod_expires.so
#AddModule mod_expires.c
#<ifmodule mod_expires.c>
#  <filesmatch "\.(jpg|gif|png|css|js)$">
#       ExpiresActive on
#       ExpiresDefault "access plus 11 days"
#   </filesmatch>
#</ifmodule>
#

</Directory>

# Spammers are known to attach their stuff and then move it to trash where it remains unnoticed.
# We prevent viewing any attachments directly from pub
<Directory "/opt/twiki/pub/Trash">
    deny from all
</Directory>

# Security note: All other directories should be set so
# that they are *not* visible as URLs, so we set them as =deny from all=.
<Directory "/opt/twiki/data">
    deny from all
</Directory>

<Directory "/opt/twiki/templates">
    deny from all
</Directory>

<Directory "/opt/twiki/lib">
    deny from all
</Directory>

<Directory "/opt/twiki/locale">
    deny from all
</Directory>

<Directory "/opt/twiki/tools">
    deny from all
</Directory>

<Directory "/opt/twiki/working">
    deny from all
</Directory>

Then save, expand, and restart httpd service.

With this templates you not need to login at twiki at /twiki/bin/...
You only go to yourdomain/twiki.

Enjoy

Offline thomasch

  • *
  • 232
  • +0/-0
Re: Installing TWiki how to allow perl from /opt
« Reply #6 on: April 23, 2008, 04:57:39 AM »
Normando,
I have installed sucesfully twiki under /opt directory.
..

this great howto should go to wiki.contribs.org

thomas

Offline Normando

  • *
  • 841
  • +2/-1
    • Unixlan
Re: Installing TWiki how to allow perl from /opt
« Reply #7 on: April 23, 2008, 05:51:21 AM »
Normando,
this great howto should go to wiki.contribs.org

thomas

Go ahead :)

Offline Davidof

  • 6
  • +0/-0
Re: Installing TWiki how to allow perl from /opt
« Reply #8 on: April 23, 2008, 09:56:20 AM »
Go ahead :)

Thanks Normando for this HowTo.  :P

I will read your HowTo and add additionnal info if needed  :?:

Offline thomasch

  • *
  • 232
  • +0/-0
Re: Installing TWiki how to allow perl from /opt
« Reply #9 on: April 23, 2008, 11:45:15 AM »
Normando,

Created a page How To Install TWiki on SME Server

see http://wiki.contribs.org/TWiki

I copy and paste it from this forum and I have no time to test it.
Will you please check it?

Thanks

thomas

Offline Davidof

  • 6
  • +0/-0
Re: Installing TWiki how to allow perl from /opt
« Reply #10 on: April 23, 2008, 01:40:53 PM »
I think you should state that this part (especially bold one) must be adapted:

<FilesMatch "^(configure)$">
    SetHandler cgi-script
    Order Deny,Allow
    Deny from all
    Allow from localhost
    Require user Normando admin
    Satisfy Any
 </FilesMatch>

Offline Davidof

  • 6
  • +0/-0
Re: Installing TWiki how to allow perl from /opt
« Reply #11 on: April 23, 2008, 01:44:29 PM »
And for those on sme8 (apache 2), you should create an additionnal custom template named "20LoadModule80mod_auth_basic" under /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf with the following content.

Code: [Select]
LoadModule auth_basic_module      modules/mod_auth_basic.so
LoadModule authn_file_module      modules/mod_authn_file.so

Offline Normando

  • *
  • 841
  • +2/-1
    • Unixlan
Re: Installing TWiki how to allow perl from /opt
« Reply #12 on: April 23, 2008, 03:26:33 PM »
Good Job thomasch and Davidof!

Will we complete the how to with all twiki instructions, specially the requirement perl modules and how to get those modules via yum.
I have no time at this moment to complete the how to. May be the next weekend.

Offline rjh808

  • 2
  • +0/-0
Re: Installing TWiki how to allow perl from /opt
« Reply #13 on: June 02, 2008, 07:36:43 AM »
Hi All,

I've recently spent about 3 weeks getting TWiki going on SME Server 7.3

It is stored in an I-bay and I also got the following working correctly:
  • Access control of attachments
  • TreeBrowserPlugin
  • TreePlugin
  • FlexWebListPlugin

There is quite a long list of instructions that I created on how to install it but if you're still interested or if others are still interested I can try and convert my instructions into a form suitable for posting here or in the HowTo.

I realise that there is now a partial HowTo on installing TWiki to the /opt directory, but if anyone wants to know how to get it going in an ibay, let me know and I'll see what info I can provide.

Rob.

Offline tloaky

  • 2
  • +0/-0
Re: Installing TWiki how to allow perl from /opt
« Reply #14 on: October 25, 2008, 06:23:05 PM »
Hello is it possible to get the instruction on installing
Twiki on SME Server?   I would greatly appreciate it!

Can email to teeloak@bellsouth.net
Thanks