[pmwiki-users] Always logged in for my IP (no password requested) : how to ?

Petko Yotov 5ko at 5ko.fr
Fri Sep 7 08:04:15 CDT 2012


ABClf writes:
> but I would like something just easy, as mentioned in PmWiki/Security (1):
>
> How do I take a whitelist approach where users from known or trusted
> IP addresses can edit, and others require a password?
>
> Put these lines to local/config.php:
> ## Allow passwordless editing from own turf, pass for others.
> if ($action=='edit'
>  && !preg_match("/^90\\.68\\./", $_SERVER['REMOTE_ADDR']) )
>  { $DefaultPasswords['edit'] = crypt('foobar'); }
> Replace 90.68. with the preferred network prefix and foobar with the
> default password for others.

This looks good, doesn't it work?

> As for now, in my config, I have (2) :
>
> $DefaultPasswords['admin'] = crypt('xxx');
> $DefaultPasswords['attr'] = crypt('xxx');
> $DefaultPasswords['edit'] = crypt('yyy');
>
> I would like mix (1) & (2), but not sure how to do, nor what order...

To mix 1 and 2, you could have

   $DefaultPasswords['admin'] = $DefaultPasswords['attr'] = crypt('xxx');
   $DefaultPasswords['edit'] = crypt('yyy');

And to make it work in the above setting, place this block in place of the   
"$DefaultPasswords['edit'] = crypt('foobar');" line above, inside the  
{curly} brackets.

> I tried to use AuthDNS cookbook but still dont have found how to do :
> what should i write in SiteAdmin.AuthDNS to have no password for my ip ?
>
> This doesnt work (my mistake, for sure, but havent found the good way
> ; --fake ip here--) :
>  # IP addresses and ranges
>   89.00.00.00: id:gb @admin

This looks good too, if your IP address is fixed, you'll be able to login  
with no password and be added as user "gb" to the group @admin.

Note that there is a login step/action, just go to AnyPage?action=authdns.

Petko




More information about the pmwiki-users mailing list