1 It's a bit inconvenient that one also has to type in the
2 *Login - Confirm Password* if one only wants to change
3 the *Preferences -- Subscriptions*. --[[tschwinge]]
5 > You don't. The password fields on the preferences fields are only needed
6 > if you want to change your password and should otherwise be left blank.
9 >> Aha, then the problem is Firefox, which is automatically filling the
10 >> *Password* field with its previous value, but not filling the
11 >> *Confirm Password* one. --[[tschwinge]]
13 ## easy access to the userdb for apache auth?
18 * read/edit only allowed from the local network (done with apache restrictions)
19 * edit only for people authenticated (done with vanilla ikiwiki passwordauth)
21 I would like to allow people to read/edit the wiki from outside of the
22 local network, if and only if they already have an ikiwiki account.
24 [[httpauth]] doesn't fit since it doesn't allow anonymous local users
25 to create their own account. I want a single, local, simple auth
28 My (naïve?) idea would be:
30 * keep the [[passwordauth]] system
31 * provide a way for Apache to use the userdb for authentication if
32 people want to connect from outside
34 I looked at the various auth modules for apache2. It seems that none
35 can use a "perl Storable data" file. So, I think some solutions could
38 * use a sqlite database instead of a perl Storable file
40 [mod_auth_dbd](http://httpd.apache.org/docs/2.2/mod/mod_authn_dbd.html)
41 * requires a change in ikiwiki module [[passwordauth]]
42 * use an external program to read the userdb and talk with
43 [mod_auth_external](http://unixpapa.com/mod_auth_external.html)
44 * requires the maintainance of this external auth proxy over ikiwiki
47 * include this wrapper in ikiwiki
48 * something like `ikiwiki --auth user:pass:userdb` check the
49 `user:pass` pair in `userdb` and returns an Accept/Reject flag to
51 * requires a change in ikiwiki core
53 [mod_auth_external](http://unixpapa.com/mod_auth_external.html)
54 * do it with Apache perl sections
57 Any opinion/suggestion/solution to this is welcome and appreciated.
62 For a similar use case, I've been intending to implement
63 [[todo/httpauth_feature_parity_with_passwordauth]], but your idea may
64 actually be the way to go. IMHO, the Perl sections idea is the
65 easiest to setup, but on the long run, I'd prefer ikiwiki to optionnally
66 use a userdb storage backend supported at least by Apache and lighttpd.
69 Tons of CPAN modules may help, but most of them are specific to `mod_perl`,
70 and AFAIK, ikiwiki is generally not run with `mod_perl`. It's not clear to me
71 wether these modules depend on the webapp to be run with `mod_perl` set
72 as the script handler, or only on `mod_perl` to be installed and loaded.
74 * CPAN's `Apache::AuthenHook` allows to plug arbitrary Perl handlers as
75 Apache authentication providers.
76 * CPAN's `Apache::Authen::Program` (`mod_perl`)
77 * [http://www.openfusion.com.au/labs/mod_auth_tkt/](mod_auth_tkt) along with CPAN's
81 I've more or less managed to implement something based on `mod_perl` and
82 `Apache::AuthenHook`, respectively in Debian packages `libapache2-mod-perl2`
83 and `libapache-authenhook-perl`.
85 In the Apache VirtualHost configuration, I have added the following:
87 PerlLoadModule Apache::AuthenHook
88 PerlModule My::IkiWikiBasicProvider
93 AuthBasicProvider My::IkiWikiBasicProvider
95 ErrorDocument 401 /test/ikiwiki.cgi?do=signin
97 <LocationMatch "^/test/(ikiwiki\.cgi$|.*\.css$|wikiicons/)">
101 The perl module lies in `/etc/apache2/My/IkiWikiBasicProvider.pm`:
103 package My::IkiWikiBasicProvider;
107 use Apache2::Const -compile => qw(OK DECLINED HTTP_UNAUTHORIZED);
109 use Authen::Passphrase;
111 sub userinfo_retrieve () {
112 my $userinfo=eval{ Storable::lock_retrieve("/var/lib/ikiwiki/test/.ikiwiki/userdb") };
117 my ($r, $user, $password) = @_;
118 my $field = "password";
120 if (! defined $password || ! length $password) {
121 return Apache2::Const::DECLINED;
123 my $userinfo = userinfo_retrieve();
124 if (! length $user || ! defined $userinfo ||
125 ! exists $userinfo->{$user} || ! ref $userinfo->{$user}) {
126 return Apache2::Const::DECLINED;
129 if (exists $userinfo->{$user}->{"crypt".$field}) {
131 my $p = Authen::Passphrase->from_crypt($userinfo->{$user}->{"crypt".$field});
132 $ret=$p->match($password);
134 elsif (exists $userinfo->{$user}->{$field}) {
135 $ret=$password eq $userinfo->{$user}->{$field};
138 return Apache2::Const::OK;
140 return Apache2::Const::DECLINED;
145 This setup also allows people with the master password to create their own
148 I'm not really fluent in Perl, and all this can probably be improved (*or
149 might destroy your computer as it is* and YMMV).