I needed to generate new password for proxy user configured on SQUID proxy server configured with digest user authentication.
My dear colleague was kind to provide me with the below script, which generates the one line string which needs to go to the squid user password file:
if [ -z "$1" -o -z "$2" -o -z "$3" ] ; then
echo "Usage: $0 user password 'realm'";
ha1=$(echo -n "$user:$realm:$pass"|md5sum |cut -f1 -d' ')
You can alternatively download the squid_generate_pass.sh script here
The script accepts three arguments;
Usage: ./squid_generate_pass.sh user password 'realm'
Thus to generate a new user and password and insert it immediately into let’s say a squid configured user/pass file in /etc/squid3/users execute command:
proxy-server:~# ./squid_generate_pass.sh admin_user MySecretPassword 'Squid_Configured_Realm'
Where Squid_Configured_Realm depends on the realm name configured in squid.conf, for example if squid.conf includes some auth configuration similar to:
auth_param digest program /usr/lib/squid3/digest_pw_auth -c /etc/squid3/users
auth_param digest children 2
auth_param digest realm My_Proxy_Realm
acl localusers proxy_auth REQUIRED
The realm script argument should be My_Proxy_realm . If squid_generate_pass does completes without errors, it should add a line to /etc/squid3/users file similar to:
proxy-server:~# cat /etc/squid3/users
More helpful Articles
Tags: bbcb, cat, Cheers, command, conf, configured, dear colleague, digest authentication, download, exit 1, fi, fiha, file, kind, lib, line, line string, name, param, password, proxy, proxy server, proxy user, pw, realm, realm name, shuser, squid, sum, Usage, user authentication, usersadmin, usersauth, usr
Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30)
Cool article, I’ve been interested in internet security mechanisms for a few years now.View CommentView Comment