- Use squid.conf with squid 3.2+
export HTTP_PROXY=http://user:allow@localhost:3128/
- run your
$HTTP_PROXY
aware test for success case export HTTP_PROXY=http://user:fail@localhost:3128/
- run your
$HTTP_PROXY
aware test for auth failure case export HTTP_PROXY=http://user:error@localhost:3128/
- run your
$HTTP_PROXY
aware test for auth error case
Created
May 6, 2014 20:54
-
-
Save rmg/9c6fff4ebb4cc7b6ede7 to your computer and use it in GitHub Desktop.
Testing basic auth proxy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/local/bin/node | |
process.stdin.on('data', function data(input) { | |
console.error(input); | |
switch(input.toString()) { | |
case 'user allow\n': | |
case 'user pass\n': | |
process.stdout.write('OK\n'); | |
break; | |
case 'user error\n': | |
process.stdout.write('BH\n'); | |
break; | |
default: | |
process.stdout.write('ERR\n'); | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
auth_param basic program /path/to/basic_auth.js | |
acl authenticated proxy_auth REQUIRED | |
http_access allow authenticated | |
http_access deny all | |
http_port 3128 | |
cache deny all |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment