Skip to content

Commit

Permalink
Item2106: Move /usr/lib/cgi-bin/foswiki/ to /usr/share/foswiki/bin/
Browse files Browse the repository at this point in the history
   Loosen permissions so online extensions may be installed to cgi dir.

git-svn-id: http://svn.foswiki.org/branches/Release01x00@5172 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
DrakeDiedrich authored and DrakeDiedrich committed Sep 29, 2009
1 parent 47d0b25 commit 211f9ed
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 32 deletions.
2 changes: 1 addition & 1 deletion core/tools/pkg/debian/LocalSite.cfg
@@ -1,7 +1,7 @@
$Foswiki::cfg{DataDir} = '/var/lib/foswiki/data';
$Foswiki::cfg{Site}{Lang} = 'en';
$Foswiki::cfg{LocalesDir} = '/var/lib/foswiki/locale';
$Foswiki::cfg{ScriptUrlPath} = '/cgi-bin/foswiki';
$Foswiki::cfg{ScriptUrlPath} = '/foswiki/bin';
$Foswiki::cfg{DefaultUrlHost} = 'http://your.domain.com';
$Foswiki::cfg{PermittedRedirectHostUrls} = 'http://localhost';
$Foswiki::cfg{Site}{FullLang} = 'en-us';
Expand Down
6 changes: 3 additions & 3 deletions core/tools/pkg/debian/ShorterUrl.conf
Expand Up @@ -12,8 +12,8 @@

<Directory /var/www>
RewriteEngine on
RewriteRule ^$ /cgi-bin/foswiki/view/$1 [PT] [L]
RewriteRule ^([A-Z].*) /cgi-bin/foswiki/view/$1 [PT] [L]
RewriteRule ^(foswiki_redirect_cache.*) /cgi-bin/foswiki/view/$1 [PT] [L]
RewriteRule ^$ /foswiki/bin/view/$1 [PT] [L]
RewriteRule ^([A-Z].*) /foswiki/bin/view/$1 [PT] [L]
RewriteRule ^(foswiki_redirect_cache.*) /foswiki/bin/view/$1 [PT] [L]
</Directory>

12 changes: 6 additions & 6 deletions core/tools/pkg/debian/apache.conf
Expand Up @@ -15,8 +15,8 @@
# BrowserMatchNoCase ^SiteSucker blockAccess
# BrowserMatchNoCase ^$ blockAccess

RedirectMatch /foswiki/?$ /cgi-bin/foswiki/view$1
RedirectMatch /foswiki(/([A-Z].*)?)?$ /cgi-bin/foswiki/view$1
RedirectMatch /foswiki/?$ /foswiki/bin/view$1
RedirectMatch /foswiki(/([A-Z].*)?)?$ /foswiki/bin/view$1

#see /etc/foswiki/ShorterUrl.conf to activate ShorterUrls

Expand All @@ -25,7 +25,7 @@ RedirectMatch /foswiki(/([A-Z].*)?)?$ /cgi-bin/foswiki/view$1
# The first parameter will be part of the URL to your installation e.g.
# http://my.co.uk/foswiki/bin/view/...
# The second parameter must point to the physical path on your disc.
#ScriptAlias /foswiki/bin "/var/lib/foswiki/bin"
ScriptAlias /foswiki/bin "/usr/share/foswiki/bin"

# The Alias defines a url that points to the root of the foswiki installation.
# It is used to access files in the pub directory (attachments etc)
Expand All @@ -40,7 +40,7 @@ SetEnvIf Request_URI "foswiki/pub/System/.*\.[hH][tT][mM][lL]?$" !blockAccess
# This specifies the options on the Foswiki scripts directory. The ExecCGI
# and SetHandler tell apache that it contains scripts. "Allow from all"
# lets any IP address access this URL.
<Directory "/usr/lib/cgi-bin/foswiki/">
<Directory "/usr/share/foswiki/bin">
AllowOverride all
Order Allow,Deny
Allow from all
Expand All @@ -55,7 +55,7 @@ SetEnvIf Request_URI "foswiki/pub/System/.*\.[hH][tT][mM][lL]?$" !blockAccess
AuthType Basic

# File to return on access control error (e.g. wrong password)
ErrorDocument 401 /cgi-bin/foswiki/view/System/UserRegistration
ErrorDocument 401 /foswiki/bin/view/System/UserRegistration

# Make sure configure is not open to the general public.
# It exposes system details that can help attackers.
Expand Down Expand Up @@ -91,7 +91,7 @@ SetEnvIf Request_URI "foswiki/pub/System/.*\.[hH][tT][mM][lL]?$" !blockAccess
AddType text/plain .shtml .php .php3 .phtml .phtm .pl .py .cgi

#for TWikiCompatibility - or even to make 'attachment not found's more user friendly
ErrorDocument 404 /cgi-bin/foswiki/viewfile
ErrorDocument 404 /foswiki/bin/viewfile

#
#add an Expires header that is sufficiently in the future that the browser does not even ask if its uptodate
Expand Down
9 changes: 3 additions & 6 deletions core/tools/pkg/debian/postinst
Expand Up @@ -81,12 +81,6 @@ configpassword="$RET"

case "$1" in
configure)
# P=/usr/lib/cgi-bin/foswiki
# for i in attach changes edit geturl installpasswd mailnotify oops passwd preview rdiff register rename save search statistics testenv upload view viewfile; do
# if ! dpkg-statoverride --list $P/$i >/dev/null; then
# dpkg-statoverride --update --add $WIKI_OWNER www-data 4555 $P/$i
# fi
# done

#note that only apache2 really seems to exist in Etch etc, but the others I've left for historical reasons
servers="apache apache-perl apache-ssl apache2"
Expand Down Expand Up @@ -144,6 +138,9 @@ case "$1" in
if [ -e /usr/lib/cgi-bin/foswiki/.htaccess ]; then
rm /usr/lib/cgi-bin/foswiki/.htaccess
fi
if [ -e /usr/share/foswiki/bin/.htaccess ]; then
rm /usr/share/foswiki/bin/.htaccess
fi
if [ -e /etc/foswiki/.htaccess ]; then
rm /etc/foswiki/.htaccess
fi
Expand Down
2 changes: 1 addition & 1 deletion core/tools/pkg/debian/postrm
Expand Up @@ -44,7 +44,7 @@ fi
if [ "$1" = "purge" ]; then
#purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)

files="/etc/foswiki/*_old /usr/lib/cgi-bin/foswiki/.htaccess* /var/log/foswiki/*"
files="/etc/foswiki/*_old /usr/lib/cgi-bin/foswiki/.htaccess* /usr/share/foswiki/bin/.htaccess* /var/log/foswiki/*"
for file in $files; do
rm -f $file
done
Expand Down
28 changes: 15 additions & 13 deletions core/tools/pkg/debian/rules
Expand Up @@ -38,17 +38,19 @@ install: build

echo `pwd`

cp -r bin/* debian/foswiki/usr/lib/cgi-bin/foswiki
cp -r debian/foswiki/usr/lib/cgi-bin/foswiki/LocalLib.cfg.txt debian/foswiki/usr/lib/cgi-bin/foswiki/LocalLib.cfg
cp bin/* debian/foswiki/usr/share/foswiki/bin/
cp debian/foswiki/usr/share/foswiki/bin/LocalLib.cfg.txt debian/foswiki/usr/share/foswiki/bin/LocalLib.cfg

# not needed, with statoverride?
chmod 755 debian/foswiki/usr/lib/cgi-bin/foswiki/*
chmod 644 debian/foswiki/usr/lib/cgi-bin/foswiki/setlib.cfg
#need more libreal perms to allow configure script to work :()
chmod 644 debian/foswiki/usr/lib/cgi-bin/foswiki/LocalLib.cfg
chmod 644 debian/foswiki/usr/lib/cgi-bin/foswiki/LocalLib.cfg.txt
chmod 755 debian/foswiki/usr/share/foswiki/bin/*
chmod 644 debian/foswiki/usr/share/foswiki/bin/setlib.cfg
chmod 644 debian/foswiki/usr/share/foswiki/bin/LocalLib.cfg
chmod 644 debian/foswiki/usr/share/foswiki/bin/LocalLib.cfg.txt

# Make dir group WIKI_OWNER, g+rw, +t so extensions may be added
# without overwriting existing files
chgrp $(WIKI_OWNER) debian/foswiki/usr/share/foswiki/bin
chmod 1775 debian/foswiki/usr/share/foswiki/bin

# chown $(WIKI_OWNER) debian/foswiki/usr/lib/cgi-bin/foswiki/*
cp -Rp pub debian/foswiki/var/lib/foswiki/
cp -pR templates debian/foswiki/var/lib/foswiki/
cp -pR locale debian/foswiki/var/lib/foswiki/
Expand Down Expand Up @@ -106,15 +108,15 @@ install: build
#move LocalSite.cfg to /etc/foswiki
cp debian/LocalSite.cfg debian/foswiki/etc/foswiki/LocalSite.cfg

perl -pi~ -e 's|^(.foswikiLibPath).*|\1 = \"/etc/foswiki\";|;' debian/foswiki/usr/lib/cgi-bin/foswiki/LocalLib.cfg
perl -pi~ -e 's|^(.foswikiLibPath).*|\1 = \"/etc/foswiki\";|;' debian/foswiki/usr/share/foswiki/bin/LocalLib.cfg
#enable /var/lib/foswiki/lib as an extra lib dir for plugin installers (configure, fosiki extras and unziping)
perl -pi~ -e 's|^# (.localPerlLibPath).*|\1 = \"/var/lib/foswiki/lib\";\n\$$CPANBASE = 1;|;' debian/foswiki/usr/lib/cgi-bin/foswiki/LocalLib.cfg
rm debian/foswiki/usr/lib/cgi-bin/foswiki/LocalLib.cfg~
perl -pi~ -e 's|^# (.localPerlLibPath).*|\1 = \"/var/lib/foswiki/lib\";\n\$$CPANBASE = 1;|;' debian/foswiki/usr/share/foswiki/bin/LocalLib.cfg
rm debian/foswiki/usr/share/foswiki/bin/LocalLib.cfg~

chmod -R 644 debian/foswiki/etc/foswiki/*

# fix paths for index.html
perl -pi~ -e 's|http://your.server.com/your-cgi-bin/view/Main/WebHome|http://localhost/cgi-bin/foswiki/view/Main/WebHome|;' index.html
perl -pi~ -e 's|http://your.server.com/your-cgi-bin/view/Main/WebHome|http://localhost/foswiki/bin/view/Main/WebHome|;' index.html
perl -pi~ -e 's|license.txt|copyright|g;' index.html
rm index.html~

Expand Down
4 changes: 2 additions & 2 deletions core/tools/pkg/debian/templates
Expand Up @@ -44,15 +44,15 @@ Default: admin
# Translators, do not translate "'configure'" script's name
_Description: Apache user allowed access to 'configure' script:
Please enter the username of the apache user who will be allowed to
run the configure script at http://localhost/cgi-bin/foswiki/configure.
run the configure script at http://localhost/foswiki/bin/configure.

Template: foswiki/adminpassword
Type: password
#flag:comment:1
# Translators, do not translate "configuser" in the variable
_Description: Password for '${configuser}':
Please enter the password of the apache user who will be allowed to
run the configure script at http://localhost/cgi-bin/foswiki/configure.
run the configure script at http://localhost/foswiki/bin/configure.

Template: foswiki/adminpassword_again
Type: password
Expand Down

0 comments on commit 211f9ed

Please sign in to comment.