SquidGuard is a URL redirector used to use blacklists with the proxysoftware Squid. There are two big advantages to squidguard: it is fast and it is free.
Authentication
Rather than using htpasswd
from an Apache install, there is an online htpasswd generator which can be used to create the htpasswd file.
Add mod_auth
to /service/lighttpd/root/lighttpd.conf
:
server.modules = (
"mod_auth",
)
Create /var/websites/www.example.com/.htpasswd
with the username and encrypted password from the online generator:
someuser:$apr1$A1NKq.Nf$emfdeavRayFSHYieX9EgP0
Edit your site's config file (/service/lighttpd/root/sites/www.example.com.conf
) and enable the htpasswd backend:
## debugging
# 0 for off, 1 for 'auth-ok' messages, 2 for verbose debugging
auth.debug = 0
## type of backend - plain, htpasswd, ldap or htdigest
auth.backend = "htpasswd"
## for htpasswd
auth.backend.htpasswd.userfile = basedir + ".htpasswd"
Then add the authentication details. There's a couple ways of doing it:
auth.require = ( "/download/" =>
(
# method must be either basic or digest
"method" => "basic",
"realm" => "protected",
"require" => "user=agent007|user=agent008"
),
"/protected-folder/" =>
(
# limit access to server information
"method" => "basic",
"realm" => "protected",
"require" => "valid-user"
)
)
$HTTP["url"] =~ "^/download|^/protected-folder" {
auth.require = ( "" =>
(
"method" => "basic",
"realm" => "download archiv",
"require" => "user=agent007|user=agent008"
)
)
}
Restart lighttpd:
svc -t /service/lighttpd
- Log in to post comments