Difference: TWikiAccessControl (20 vs. 21)

Revision 212002-03-20 - MikeMannix

Line: 1 to 1
 
Line: 6 to 6
  Restricting read and write access to topics and webs, by users and groups
Deleted:
<
<

Overview

 TWikiAccessControl allows you restrict access to single topics and entire webs, by individual user and by user groups, in three main areas: view; edit & attach; and rename/move/delete. These controls, combined with TWikiUserAuthentication, let you easily create and manage an extremely flexible, fine-grained privilege system.

An Important Control Consideration

Line: 29 to 27
 

Users and Groups

Changed:
<
<
Access control is based on users and groups. Users are defined by their WikiNames, an then organized into unlimited combinations under different user groups.
>
>
Access control is based on users and groups. Users are defined by their WikiNames, an then organized in unlimited combinations under different user groups.
 

Managing Users

Line: 112 to 110
 
  • DENYTOPICRENAME (in topic) overrides DENYWEBRENAME (in WebPreferences)
  • ALLOWTOPICRENAME (in topic) overrides ALLOWWEBRENAME (in WebPreferences)
Changed:
<
<

Restricting Read Access

>
>

Restricting Web Access

 
Changed:
<
<
You can define restrictions of who is allowed to view a TWiki web.
>
>
You can prevent selected users and groups from accessing certain webs, by hiding them using restricting read access, or by requiring login. There are two basic methods, one simple, using standard preferences variables to hide a web, but offering low security, and a secure log-in approach that is currently a workaround, involving some minor script and filesystem modification.
 
Changed:
<
<
>
>

Create Hidden Webs

You can prevent selected users and groups from viewing certain TWiki webs by setting one or both of these variables in each web's WebPreferences topic:

 
    • Set DENYWEBVIEW = < list of users and groups >
    • Set ALLOWWEBVIEW = < list of users and groups >
Added:
>
>
  • If keeping a hidden web out of general use is a consideration, you should also prevent the "all webs" search option from accessing each hidden web, by enabling the NOSEARCHALL variable in WebPreferences:
    • Set NOSEARCHALL = on
    • It is not recommended to restrict view access to individual topics since all content is searchable within a web.
  • HELPThis method only works if the view script is authenticated, which means that all users have to login, even for read-only access. (An open guest account, like TWikiGuest, can get around this, allowing anyone to login with, for example, view-only access for public webs.) TWikiInstallationGuide has more on Basic Authentication, using the .htaccess file.
  • ALERT! Hiding webs is not very secure, as there is a way to circumvent the read access restriction. It can be useful in certain situations - for example, to simplify site organization and clutter, by hiding low traffic webs - but is not recommended for securing sensitive content.

Create Authenticated Access By Web

 
Changed:
<
<

Known Issues

>
>
To selectively restrict web access with the security of Basic Authentication, there is a reliable workaround that involves some straightforward code modification:
  1. Set aside the view script (rename) and create a view subdirectory in its place.
  2. In the view subdirectory, create a separate copy of a modified viewing script for each web, and create .htaccess settings for the restricted webs.
    • TIP You can use symbolic links to a single copy of the viewing script to make any script updates that much easier.
 
Changed:
<
<
  • The view restriction is not suitable for very sensitive content since there is a way to circumvent the read access restriction.
  • Read access restriction only works if the view script is authenticated, that means that users need to log on also just to read topics. TWikiInstallationGuide has more on Basic Authentication based on the .htaccess file.
>
>
Example of viewing script redirect
#!/usr/bin/perl -w
#
 
Changed:
<
<

Selective Unrestricted Web Access

>
>
chdir '..';

# Adjust SCRIPT and PATH_INFO variables to account for the changed directory my $web = $ENV{SCRIPT_NAME}; $web =~ s#^.*/view(/[^/]*).*$#$1#; # isolate the path element after "view" $ENV{PATH_TRANSLATED} =~ s#(/[^/]*)$#$web$1#; $ENV{PATH_INFO} =~ s#(/[^/]*)$#$web$1#; $ENV{SCRIPT_NAME} =~ s#/view$web#/view#; $ENV{SCRIPT_FILENAME} =~ s#/view$web#/view#;

# open (LOG, '>>/tmp/redirect.log'); # print LOG join ("\n", scalar localtime (time ()), %ENV); # close LOG; exec ('/usr/bin/perl', '-wT', 'view.orig') or

print <<EOF; Content-type: text/plain

Error executing /cgi-bin/view.orig: $? Click the BACK button in your browser and contact webmaster\@bcs-oops.org.

EOF

 
Changed:
<
<
  • There is a workaround if you prefer to have unrestricted access to view topics located in normal webs, and to authenticate users only for webs where view restriction is enabled:
>
>
A SECOND OPTION: A less reliable workaround that also requires code changes is available to provide the same unrestricted viewing access, with authentication required only on selected webs:
 
    1. Omit the view script from the .htaccess file.
Changed:
<
<
    1. Enable the $doRememberRemoteUser flag in lib/TWiki.cfg as described in TWikiUserAuthentication. TWiki will now remember the IP address of an authenticated user.
    2. Copy the view script to viewauth (or better, create a symbolic link)
    3. Add viewauth to the list of authenticated scripts in the .htaccess file.
>
>
  1. Enable the $doRememberRemoteUser flag in lib/TWiki.cfg as described in TWikiUserAuthentication. TWiki will now remember the IP address of an authenticated user. 1. Copy the view script to viewauth (or better, create a symbolic link) 1. Add viewauth to the list of authenticated scripts in the .htaccess file.
 
      • When a user accesses a web where you enabled view restriction, TWiki will redirect from the view script to the viewauth script once (this happens only if the user has never edited a topic). Doing so will ask for authentication. The viewauth script shows the requested topic if the user could log on and if the user is authorized to see that web.
      • If you enable view restriction for a web, it is recommended to restrict search "all webs" from searching this web. Enable this restriction with the NOSEARCHALL variable in its WebPreferences, like:
        • Set NOSEARCHALL = on
Line: 158 to 193
 
  • The default setting is not to have superusers.
Changed:
<
<
-- MikeMannix - 02 Dec 2001
>
>
-- MikeMannix - 20 Mar 2002
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 1999-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback
Note: Please contribute updates to this topic on TWiki.org at TWiki:TWiki.TWikiAccessControl.