Configure the web-based squid 3.1.23 for CentOS

Source: Internet
Author: User

Configure the web-based squid 3.1.23 for CentOS

Environment list:

Centos 6.4X64

Squid 3.1.23

Squid is still a popular web Proxy Server software. It has been developing for a long time. Of course, in addition to its old-fashioned systems, Squid features are quite complete and cross-platform ...... This is why we are exploring Digest authentication in the auth module (squid supports many authentication modules, such as NCSA, LDAP, NTLM, PAM, SASL, Mysql, SMB, YP, etc, here we will only study Digest, and other follow-up)

I. platform ready

1. System Installation

2. Disable iptables and Selinux.

3. Add gcc, make, wget, perl, and other packages

4. [root @ vqiu] # useradd-M squid-s/sbin/nologin-c "Squid user" // Add a squid user


Ii. Install squid

[Root @ vqiu] # wget http://sourceforge.jp/projects/sfnet_brazilfw/downloads/3.x/source/pool/squid-3.1.23.tar.bz2
[Root @ vqiu] # tar xjf squid-3.1.23.tar.bz2
[Root @ vqiu]) # cdsquid-3.1.23
[Root @ vqiu] #./configure -- prefix =/usr/local/squid \
-- Enable-async-io \
-- Enable-removal-policies = heap, lru \
-- Enable-default-err-ages = "Simplify_Chinese "\
-- Enable-err-extensions ages = "Simplify_Chinese English "\
-- Enable-epoll \
-- Disable-http-violations \
-- With-large-files \
-- Enable-auth = "digest "\
-- Enable-digest-auth-helpers = "password "\
-- With-default-user = squid

[Root @ vqiu] # Make & make install // if no Error is prompted during the process, the installation is complete.

3. Configure squid

[Root @ vqiu] # chown squid/usr/local/squid-R

[Root @ vqiu] # Vi/usr/localhost/squid/etc/squid. conf // Add the following information:

// Specify the authentication type. The-c option encrypts the password and stores it in the specified file (/usr/local/squid/digest. passwd). If the option is not added, the plaintext is used.
Auth_param digest program/usr/local/squid/libexec/digest_pw_auth-c/usr/local/squid/digest. passwd

// Number of auxiliary processes. The default value is 5.
Auth_param digest children 8

// Name of the authenticated Domain Name
Auth_param digest realm vqiu

// How long does it take to clear the nonce cache? The default value is 5 minutes.
Auth_param digest nonce_garbage_interval 5 minutes

// The maximum validity period of the nonce connection between the client and squid is exceeded and re-verified.
Auth_param digest nonce_max_duration 30 minutes

// You can use 50 nonce requests.
Auth_param digest nonce_max_count 50

// Define the number of ip addresses used by an account
Acl FOO max_user_ip 1

// Define the authenticated client
Acl know_cli proxy_auth REQUIRED

// Allow max_user_ip
Http_access allow FOO

// Allow the authentication Client
Http_access allow know_cli

// Define the host name.
Visible_hostname squid_server

4. Add an account

Create a script with the following content:

#! /Bin/bash
User = $1
Pass = $2

Realm = $3 // this option must be consistent with auth_param digest realm XXX in the conf file

If [-z "$1"-o-z "$2"-o-z "$3"]; then
Echo "Usage: $0 user password 'realm '";
Exit 1
Fi
Ha1 = $ (echo-n "$ user: $ realm: $ pass" | md5sum | cut-f1-d '')
Echo "$ user: $ realm: $ ha1">/usr/local/squid/digest. passwd

New User format: sh shell_script username password realm (vqiu in this example)

For example, add a user named "test" --- sh script_name vqiu

5. Start the squid service

Add the/usr/local/squid/bin and sbin directories to the PATH variable.

[Root @ vqiu] # squid-k check or squid-k parse // error squid configuration file

[Root @ vqiu] # Squid-zX // initialize squid

[Root @ vqiu] # squid-s // start the service in the background

Service started successfully

6. Configure the client

Go to internet explorer and set proxy.

Enter the URL, and the following window will pop up. Fill in the added users.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.