VMOD-BASICAUTH

NAME
SYNOPSIS
DESCRIPTION
DOWNLOADS
SEE ALSO
AUTHORS
BUG REPORTS
COPYRIGHT

NAME

vmod-basicauth - Basic HTTP authentication

SYNOPSIS

import basicauth;

BOOL basicauth.match(STRING passfile, STRING authstr);

DESCRIPTION

The vmod-basicauth module implements basic HTTP authentication against the password file created using the htpasswd(1) command.

Four kinds of password hashes are supported: Apache MD5 ($apr1$), crypt(3), SHA1, and plaintext.

The match function returns TRUE or FALSE depending on whether the authentication succeeds or not. The passfile argument supplies the name of the password file to use. The authstr argument is the authentication string (normally, the value of the Authorization HTTP header.

Example:
sub vcl_recv {
if (!basicauth.match("/var/www/.htpasswd",
req.http.Authorization)) {
return (synth(401, "Restricted"));
}
}

sub vcl_synth {
if (resp.status == 401) {
set resp.http.WWW-Authenticate =
{"Basic realm="Restricted area""};
}
}

DOWNLOADS

Vmod-basicauth is available for download from this location.

The latest version is vmod-basicauth-2.0.

Recent news, changes and bugfixes can be tracked from the project's development page.

SEE ALSO

vcl(7), varnishd(1).

AUTHORS

Sergey Poznyakoff

BUG REPORTS

Report bugs to <gray@gnu.org>.

COPYRIGHT

Copyright © 2013-2022 Sergey Poznyakoff
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.


Manpage server at man.gnu.org.ua.

Powered by mansrv 1.1