• <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>
  • 帶用戶驗證的SQUID源碼編譯安裝

    發表于:2007-05-25來源:作者:點擊數: 標簽:
    [b:08a74b3ab3]首先升級openssl(為了系統更 安全 )[/b:08a74b3ab3] 詳見http://blog.platinum.net.cn/index.php?op=ViewArticleblogId=1 [b:08a74b3ab3]編譯squid[/b:08a74b3ab3] ./configure--prefix=/usr/local/squid--mandir=/usr/share/man--enable-ca

    [b:08a74b3ab3]首先升級openssl(為了系統更安全)[/b:08a74b3ab3]
    詳見 http://blog.platinum.net.cn/index.php?op=ViewArticle&articleId=16&blogId=1

     

    [b:08a74b3ab3]編譯squid[/b:08a74b3ab3]

    ./configure --prefix=/usr/local/squid --mandir=/usr/share/man --enable-carp --with-dl --enable-storeio=aufs,ufs,diskd,coss,null --with-pthreads --enable-icmp --enable-delay-pools --enable-useragent-log --enable-referer-log --enable-kill-parent-hack --enable-snmp --enable-arp-acl --enable-htcp --enable-ssl --with-openssl=/usr/local/openssl-0.9.7e --enable-external-acl-helpers=ip_user --enable-err-language="Simplify_Chinese" --enable-err-language="Simplify_Chinese" --enable-linux-netfilter --enable-auth="basic" --enable-baisc-auth-helpers="NCSA" --enable-underscores --enable-x-aclearcase/" target="_blank" >ccelerator-vary --disable-internal-dns

    [b:08a74b3ab3]修改src/fs/aufs/store_asyncufs.h,使其可以用異步IO寫文件,以提高存儲速度
    將#define ASYNC_WRITE改為1[/b:08a74b3ab3]

    make

    make install

    [b:08a74b3ab3]進入helpers/basic_auth/NCSA,編譯出nasa_auth[/b:08a74b3ab3]

    make

    make install


    [b:08a74b3ab3]利用apache里面的htpasswd生成密碼文件[/b:08a74b3ab3]
    /path/htpasswd -c /etc/squid.pass test
    123
    123

     

    [b:08a74b3ab3]配置squid.conf[/b:08a74b3ab3]
    [code:1:08a74b3ab3]
    hierarchy_stoplist cgi-bin ?
    acl QUERY urlpath_regex cgi-bin \?
    no_cache deny QUERY
    emulate_httpd_log on
    auth_param basic program /usr/local/squid/libexec/ncsa_auth /etc/squid.pass
    auth_param basic children 5
    auth_param basic realm Platinum proxy-caching server
    auth_param basic credentialsttl 1 minutes
    auth_param basic casesensitive off
    refresh_pattern ^ftp: & & & & & 1440 & &20% & & 10080
    refresh_pattern ^gopher: & & & &1440 & &0% & & &1440
    refresh_pattern . & & & & & & & 0 & & & 20% & & 4320
    cachemgr_passwd platinum all

    acl all src 0.0.0.0/0.0.0.0
    acl localhost src 127.0.0.1/255.255.255.255
    acl to_localhost dst 127.0.0.0/8
    acl AUTHUSER proxy_auth REQUIRED

    http_access allow AUTHUSER
    http_access allow localhost
    http_access allow to_localhost
    http_access deny &all

    http_reply_access allow all
    icp_access allow all
    cache_effective_user squid
    visible_hostname platinum

    httpd_accel_host platinum
    httpd_accel_with_proxy on
    httpd_accel_uses_host_header on
    error_directory /usr/local/squid/share/errors/Simplify_Chinese
    coredump_dir /usr/local/squid/var/cache

    cache_dir aufs /usr/local/squid/var/cache 100 16 256
    cache_access_log /usr/local/squid/var/logs/access.log
    cache_log /usr/local/squid/var/logs/cache.log
    cache_store_log /usr/local/squid/var/logs/store.log
    cache_mem 32 MB
    [/code:1:08a74b3ab3]
     

    [b:08a74b3ab3]創建交換文件[/b:08a74b3ab3]

    useradd squid -s /sbin/nologin

    mkdir -p /usr/local/squid/var/cache

    chown -R squid.squid /usr/local/squid/var

    /usr/local/squid/sbin/squid -z

     

    [b:08a74b3ab3]運行squid[/b:08a74b3ab3]

    /usr/local/squid/sbin/squid

    若使開機自動運行,在/etc/rc.local里添加即可

     

    [color=red:08a74b3ab3]注意:

       用戶認證模式不能與透明模式一起使用,否則會出錯,用戶驗證無法通過[/color:08a74b3ab3]

     ljily000 回復于:2005-03-13 12:54:28
    對每個用戶能否綁定一個ip,該用戶只能在指定ip的機器上通過squid代理出去。

     platinum 回復于:2005-03-13 14:00:35
    可以用acl控制
    也可以結合iptables來實現

     wingger 回復于:2005-03-13 18:14:42
    External ACLs

    squid2.5版本,有一個ACL擴展功能ip_user,應該可以滿足你的要求

    如:可能安裝的時候要編譯進去
    [code:1:2707935133]./configure —enable-external-acl-helpers=ip_user[/code:1:2707935133]

    配置時要在squid.conf加入如下一行:

    [code:1:2707935133]external_acl_type ip_user_helper %SRC %LOGIN

     usr/local/squid/libexec/ip_user -f /usr/local/squid/etc/ip_user.conf

    acl AclName external ip_user_helper[/code:1:2707935133]

    %SRC 指客戶IP地址,%LOGIN指用戶名. 在ip_user.conf 中的配置 格式如下:

    ip_addr[/mask] user|@group|ALL|NONE

    例如:

    [code:1:2707935133]127.0.0.1 ALL

    192.168.1.0/24 bob

    10.8.1.0/24  @lusers

    172.16.0.0/16  NONE[/code:1:2707935133]

    上面的語句意思如下(我就不翻譯了):
    This configuration file causes ip_user to return OK for any request coming from 127.0.0.1, for Bob's requests coming from the 192.168.1.0/24 network, for any name in the luser group when the request comes from the 10.8.1.0/24 network, and returns ERR for any request from the 172.16.0.0/16 network. It also returns ERR for any address and username pair that doesn't appear in the list.

     段譽 回復于:2005-03-13 18:26:41
    受教,學習ing

     ljily000 回復于:2005-03-22 14:15:42
    [quote:c478550dd1="wingger"]
    上面的語句意思如下(我就不翻譯了):
    This configuration file causes ip_user to return OK for any request coming from 127.0.0.1, for Bob's requests coming from the 192.168.1.0/24 network, for any na..........[/quote:c478550dd1]


     :P  :P 
    [code:1:c478550dd1][code]external_acl_type ip_user_helper %SRC %LOGIN 

    usr/local/squid/libexec/ip_user -f /usr/local/squid/etc/ip_user.conf 

    acl AclName external ip_user_helper [/code][/code:1:c478550dd1]

    好像差點東西 :P ,

    [code:1:c478550dd1]external_acl_type ip_user_helper %SRC %LOGIN
    /usr/local/squid/libexec/ip_user_check -f /usr/local/squid/etc/ip_user.conf
    acl AclName external ip_user_helper [/code:1:c478550dd1]

    找了好半天! :em06:

    原文轉自:http://www.kjueaiud.com

    老湿亚洲永久精品ww47香蕉图片_日韩欧美中文字幕北美法律_国产AV永久无码天堂影院_久久婷婷综合色丁香五月

  • <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>