1 Apache Access Handler Perl Module
2 ---------------------------------
3 The OpenILS::WWW::AccessHandler Perl module is intended for limiting patron
4 access to configured locations in Apache. These locations could be folder
5 trees, static files, non-Evergreen dynamic content, or other Apache
6 features/modules. It is intended as a more patron-oriented and transparent
7 version of the OpenILS::WWW::Proxy and OpenILS::WWW:Proxy::Authen modules.
9 Instead of using Basic Authentication the AccessHandler module instead redirects
10 to the OPAC for login. Once logged in additional checks can be performed, based
11 on configured variables:
13 * Permission Checks (at Home OU or specified location)
14 * Home OU Checks (Org Unit or Descendant)
15 * "Good standing" Checks (Not Inactive or Barred)
17 Use of the module is a simple addition to a Location block in Apache:
21 <Location /path/to/be/protected>
22 PerlAccessHandler OpenILS::WWW::AccessHandler
23 # For each option you wish to set:
24 PerlSetVar OPTION "VALUE"
28 The available options are:
30 OILSAccessHandlerLoginURL::
31 * Default: /eg/opac/login
32 * The page to redirect to when Login is needed
33 OILSAccessHandlerLoginURLRedirectVar::
34 * Default: redirect_to
35 * The variable the login page wants the "destination" URL stored in
36 OILSAccessHandlerFailURL::
38 * URL to go to if Permission, Good Standing, or Home OU checks fail. If not set
39 a 403 error is generated instead. To customize the 403 you could use an
40 ErrorDocument statement.
41 OILSAccessHandlerCheckOU::
42 * Default: <User Home OU>
43 * Org Unit to check Permissions at and/or to load Referrer from. Can be a
45 OILSAccessHandlerPermission::
47 * Permission, or comma- or space-delimited set of permissions, the user must have to
48 access the protected area.
49 OILSAccessHandlerGoodStanding::
51 * If set to a true value the user must be both Active and not Barred.
52 OILSAccessHandlerHomeOU::
54 * An Org Unit, or comma- or space-delimited set of Org Units, that the user's Home OU must
55 be equal to or a descendant of to access this resource. Can be set to
57 OILSAccessHandlerReferrerSetting::
59 * Library Setting to pull a forced referrer string out of, if set.
61 As the AccessHandler module does not actually serve the content it is
62 protecting, but instead merely hands control back to Apache when it is done
63 authenticating, you can protect almost anything else you can serve with Apache.
67 The general use of this module is "protect access to something else" - what that
68 something else is will vary. Some possibilities:
71 ** Automatic Directory Indexes
72 ** Proxies (see below)
73 *** Electronic Databases
74 *** Software on other servers/ports
75 * Non-Evergreen software
76 ** Timekeeping software for staff
77 ** Specialized patron request packages
78 * Static files and folders
79 ** Semi-public Patron resources
80 ** Staff-only downloads
84 One potentially interesting use of the AccessHandler module is to protect an
85 Apache Proxy configuration. For example, after installing and enabling
86 mod_proxy, mod_proxy_http, and mod_proxy_html you could proxy websites like so:
91 # Base "Rewrite URLs" configuration
93 ProxyHTMLLinks area href
94 ProxyHTMLLinks link href
95 ProxyHTMLLinks img src longdesc usemap
96 ProxyHTMLLinks object classid codebase data usemap
98 ProxyHTMLLinks blockquote cite
99 ProxyHTMLLinks ins cite
100 ProxyHTMLLinks del cite
101 ProxyHTMLLinks form action
102 ProxyHTMLLinks input src usemap
103 ProxyHTMLLinks head profile
104 ProxyHTMLLinks base href
105 ProxyHTMLLinks script src for
107 # To support scripting events (with ProxyHTMLExtended On)
108 ProxyHTMLEvents onclick ondblclick onmousedown onmouseup \
109 onmouseover onmousemove onmouseout onkeypress \
110 onkeydown onkeyup onfocus onblur onload \
111 onunload onsubmit onreset onselect onchange
113 # Limit all Proxy connections to authenticated sessions by default
114 PerlAccessHandler OpenILS::WWW::AccessHandler
116 # Strip out Evergreen cookies before sending to remote server
117 RequestHeader edit Cookie "^(.*?)ses=.*?(?:$|;)(.*)$" $1$2
118 RequestHeader edit Cookie "^(.*?)eg_loggedin=.*?(?:$|;)(.*)$" $1$2
121 <Location /proxy/example/>
123 ProxyPass http://www.example.net/
124 ProxyPassReverse http://www.example.net/
125 ProxyPassReverseCookieDomain example.net example.com
126 ProxyPassReverseCookiePath / /proxy/example/
129 ProxyHTMLURLMap http://www.example.net/ /proxy/example/
130 ProxyHTMLURLMap / /proxy/mail/
131 ProxyHTMLCharsetOut *
133 # Limit to BR1 and BR3 users
134 PerlSetVar OILSAccessHandlerHomeOU "BR1,BR3"
138 As mentioned above, this can be used for multiple reasons. In addition to
139 websites such as online databases for patron use you may wish to proxy software
140 for staff or patron use to make it appear on your catalog domain, or perhaps to
141 keep from needing to open extra ports in a firewall.