Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am trying to implement custom authenticator for Squid by having something like

auth_param basic program my_authenticator.sh

in the /etc/squid3/squid.conf file. It all works fine, but I want to make an improvement.

The responsibility of my_authenticator.sh is quite simple: Squid sends user name and password, and expects either OK or ERR back.

The improvement I want to make is to explain users why they have been denied the service, e.g.

ERR You have been browsing too much, come back in 24 hours

According to Squid documentation, this is quite possible:

"ERR" responses may optionally be followed by a error description available as %m in the returned error page.

Can anyone explain what does %m stand for? I have been trying to print a simple text after ERR (without quotes, as shown above) but this text doesn't appear in the browser pop up. Any ideas?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

The %mis used to insert your custom message into the error page that your user sees when squid responds to them. To use it, find out where the squid template error pages are for the language you are using. On my Ubuntu system the English error pages are located at

/usr/share/squid/errors/en

Each of the files is a template html file that you can modify to meet your own needs or you can write your own. To test this I modified my ERR_CACHE_ACCESS_DENIED e.g.

<html>
    <body> 
        <h1>ERROR</h1> 
        <h2>%m</h2>
    </body>
</html>

which displays the message returned by the custom authentication script on the ERR line.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.