鱿鱼会河豚——基于OpenBSD的代理服务器

OpenBSD FAQ中文版、PF指南中文版、OpenBSD用户手册...
回复
头像
leo
帖子: 2465
注册时间: 2010-01-21 3:27

鱿鱼会河豚——基于OpenBSD的代理服务器

帖子 leo » 2010-04-05 12:38

原文链接:http://www.kernel-panic.it/openbsd/proxy/
感谢原作者的辛勤劳动。
译文仅供在JR社区学习讨论之用,谢绝修改、转发,多谢!
1. 介绍
我们的公司里的Internet访问量大增, 以至于很难想象以前人们在工作岗位上一整天都在干什么!
通过提供几乎无限量信息的访问,Internet很快变成了一个重要工作工具; 甚至重要到很多公司离开它就什么也干不了。但是除了提供海量的信息, Internet也变成了病毒的主要传播媒介 (与e-mail一起) ,而且并非只提供符合企业策略的内容。这也是为什么一个代理服务器往往和Internet连接本身一样重要的原因。


代理的主要优点是:
  • 内容过滤: 代理服务器可以被配置为过滤病毒文件、广告、以及限制对不受欢迎的某些网站的访问;
  • 网络带宽保护: 代理服务器本身可提供页面缓存服务, 因此节省带宽并提供更快的访问时间;
  • 认证: 可以设置基于“用户名/密码, IP地址, 域名以及更多”的Internet访问的认证 (和过滤)。
下面是我们需要的软件:
OpenBSD
[INDENT]一个强健的, 原生安全的操作系统, "在很长的时间内默认安装情况下仅发现两个远程安全漏洞!";!;
[/INDENT]Squid
[INDENT]一个应用于web支持缓存代理,支持 HTTP, HTTPS, FTP以及更多;
[/INDENT]SquidGuard
[INDENT]一个整合了过滤、重定向以及访问控制器的Squid插件;
[/INDENT]ClamAV
[INDENT]一个Unix系统的开源 (GPL) 反病毒工具包;
[/INDENT]SquidClamav
[INDENT]一个为Squid代理服务器设计的反病毒重定向程序,它基于备受赞誉的 ClamAv 反病毒工具包;
[/INDENT]AdZapper
[INDENT]一个为Squid设计的重定向程序,它可以阻止广告 (横幅广告, 弹窗, flash动画等), 页面计数器以及一下web bugs (已发现的).
[/INDENT]因为要选择使用自由的软件,所以我无法使用 DansGuardian, 它也是一个开源的web内容过滤程序, 可以运行在很多OSes上,并可以使用多种方案过滤实际的页面内容,它的方案包括短语匹配, PICS过滤和URL过滤。非常棒, 可惜它不能自由地进行 商业应用
我们这里假设你具备了良好的OpenBSD知识, 我们这里不探讨OS安装和基本的配置, packages/ports安装或者PF语法。

头像
leo
帖子: 2465
注册时间: 2010-01-21 3:27

回复: The Squid and the Blowfish

帖子 leo » 2011-04-28 7:32

2. Squid
Squid是一个全功能的 HTTP/1.0 代理,而且它提供了丰富的访问控制, 认证和日志环境以开发web代理和内容服务应用。

2.1 安装
我们从网络里的缓存服务器开始: 根据此 文档, 最合适的位置是DMZ; 这应该可以保证缓存服务器的安全的同时仍旧可以与其它的、外部的、caches (例如ISP的)联络。(leo:没搞明白这里啥意思。先放在这吧。)

这篇 文档 还推荐为尽快为缓存服务器设置一个DNS名称 (比如 "cache.mydomain.tld" 或者 "proxy.mydomain.tld") : 一个简单的 DNS 项可以免去数小时的之多的掉线。将客户端机器配置为通过IP地址访问缓存服务器就意味着以后的修改是长期的和痛苦的。

Squid安装特简单; 你只需add一个Squid package。有效的版本是 "ldap" (允许 LDAP认证) 和 "snmp" (包含 SNMP 支持)。

代码: 全选

# export PKG_PATH=/path/to/your/favourite/OpenBSD/mirror
# pkg_add squid-x.x.STABLExx-snmp.tgz
squid-x.x.STABLExx-snmp: complete
--- squid-x.x.STABLExx-snmp -------------------
NOTES ON OpenBSD POST-INSTALLATION OF SQUID x.x
 
The local (OpenBSD) differences are:
configuration files are in              /etc/squid
sample configuration files are in       /usr/local/share/examples/squid
error message files are in              /usr/local/share/squid/errors
sample error message files are in       /usr/local/share/examples/squid/errors
icons are in                            /usr/local/share/squid/icons
sample icons are in                     /usr/local/share/examples/squid/icons
the cache is in                         /var/squid/cache
logs are stored in                      /var/squid/logs
the ugid squid runs as is               _squid:_squid
 
Please remember to initialize the cache by running "squid -z" before
trying to run Squid for the first time.
 
You can also edit /etc/rc.local so that Squid is started automatically:
 
    if [ -x /usr/local/sbin/squid ]; then
        echo -n ' squid';       /usr/local/sbin/squid
    fi
 
#

2.2 基本配置
Squid的配置基于数十个参数, 因而马上会让你觉得很棘手。所以, 最好的方法可能是先从一个简单的配置开始,然后一点点地调整, 在保证工作正常的同时,逐渐调整为适合自己需要的配置。
实际上, 要让Squid启动并运行仅需设置几个参数 (理论上, Squid甚至可以在没有配置文件时运行): 对那些不不熟悉的参数还是保留默认值为好。不过, 至少肯定有一个参数需要修改: 默认的配置拒绝访问所有的浏览器; 而这也许有点.....太严格了!

我们的第一个配置很简单: 我们将把代理服务器放置在DMZ (172.16.240.0/24, 是网络结构),并且仅允许来自LAN (172.16.0.0/24)的请求。不考虑 ISP的上级代理。

主要的Squid配置文件是 /etc/squid/squid.conf。我们看一下。

这里的 http_port 选项设置了Squid将监听进站HTTP请求的端口。有三种格式: 端口 (例如 "http_port 3128"), 主机名和端口 (例如 "http_port proxy.kernel-panic.it:3128"), 以及IP地址和端口 (例如 "http_port 172.16.240.151:3128"); 你可以指定多个socket地址, 每个在单独的线上。如果你的Squid机器是多线(ISP)连入的且直接连接到internet上, 这里强烈推荐你强制Squid将socket绑定到internal地址上。这种情况下, Squid仅对Internet网络可见且不会为代理整个世界! Squid的默认HTTP端口是3128, 但是许多管理员更愿意使用一个好记的端口。例如:8080。

代码: 全选

http_port 3128
这里的 cache_dir 参数允许你指定缓存文件储存的的路径、大小、深度。Squid 允许你在配置文件里使用多个 cache_dir 标签。

代码: 全选

cache_dir ufs /var/squid/cache 100 16 256
上行将缓存目录设置路径设置为 /var/squid/cache, 大小为100MB以及各包含256个二级子目录的16个以及子目录。这里的缓存目录必须存在且可被Squid写入,而且其大小不能超出整个磁盘的80%。更多细节请参阅 文档

这里的 cache_mgr 参数包含了Squid管理员的 e-mail 地址, 这个地址将显示在错误页面的尾部; 例如:

代码: 全选

cache_mgr webmaster@kernel-panic.it

这里的 cache_effective_user 和 cache_effective_group 选项, 允许你设定Squid一旦被绑定到进站网络端口后将丢弃自己的特权而使用的 UID 和 GID 。安装 package 时已经创建了名为 _squid 的用户和组。

代码: 全选

cache_effective_user _squid
cache_effective_group _squid
这里的 ftp_user 选项设置了Squid将作为匿名ftp用户登录的密码使用 e-mail 地址 。 最好使用一个现有的地址:

代码: 全选

ftp_user webmaster@kernel-panic.it
下面的选项设置log文件路径; 访问log文件的格式, logs的每次请求被保留在缓存里, 可以使用一个 logformat 指令来指定 (请参考 文档 以便了解有效的格式代码):

代码: 全选

# Define the access log format
logformat squid  %ts.%03tu %6tr %>a %Ss/%03Hs %<st %rm %ru %un %Sh/%<A %mt
# Log client request activities ('squid' is the name of the log format to use)
access_log       /var/squid/logs/access.log squid
 
# Log information about the cache's behavior
cache_log        /var/squid/logs/cache.log
# Log the activities of the storage manager
cache_store_log  /var/squid/logs/store.log
现在我们将面临配置中最棘手的部分: 访问控制清单。最简单的限制访问的方式为仅接受来自内部网络的访问。这个基本控制足以应付小型网络, 特别是如果你不希望使用类似 username/password 认证或 URL 过滤。

ACLs 被通常分成两部分: acl 行的开头是关键字 acl 并且定义了类别及基于类别的允许和禁止请求的 acl 操作符。Acl操作符将被从头至尾检查,并且按照第一个匹配的设定来操作。下面是非常基本的规则集:

代码: 全选

# Classes
acl  all           src    all               # Any IP address
acl  localhost     src    127.0.0.0/8       # Localhost
acl  lan           src    172.16.0.0/24     # LAN where authorized clients reside
acl  manager       proto  cache_object      # Cache object protocol
acl  to_localhost  dst    127.0.0.0/8       # Requests to localhost
acl  SSL_ports     port   443               # https port
acl  Safe_ports    port   80 21 443         # http, ftp, https ports
acl  CONNECT       method CONNECT           # SSL CONNECT method
 
# Only allow cachemgr access from localhost
http_access  allow  manager localhost
http_access  deny   manager
 
# Deny requests to unknown ports
http_access  deny   !Safe_ports
 
# Deny CONNECT to other than SSL ports
http_access  deny   CONNECT !SSL_ports
 
# Prevent access to local web applications from remote users
http_access  deny   to_localhost
 
# Allow access from the local network
http_access  allow  lan
 
# Default deny (this must be the last rule)
http_access  deny   all

2.3 开始Squid
现在哦我们的缓存服务器差一步就可以初次运行了。我们首先需要创建Squid用来保存缓存页面的缓存交换目录。 "squid -z" 命令会依据 squid.conf 文件 (参 上面) 里 cache_dir 参数的设定以cache_effective_user 和 cache_effective_group 参数指定的用户和组来创建全部的所需目录。

代码: 全选

# /usr/local/sbin/squid -z
2009/10/30 18:04:35| Creating Swap Directories
#
我们现在已经可以启动Squid了。用debug模式 (-d 1 选项) 启动它,以及使用前台模式 (-N flag) 将让我们更简单地判断出是否一切正常。

代码: 全选

# /usr/local/sbin/squid -d 1 -N
2009/10/30 18:05:19| Starting Squid Cache version 2.7.STABLE6 for i386-unknown-openbsd4.6...
[ ... ]
2009/10/30 18:05:19| Accepting proxy HTTP connections at 0.0.0.0, port 3128, FD 10.
2009/10/30 18:05:19| Accepting ICP messages at 0.0.0.0, port 3130, FD 11.
2009/10/30 18:05:19| Accepting SNMP messages on port 3401, FD 12.
2009/10/30 18:05:19| WCCP Disabled.
2009/10/30 18:05:19| Ready to serve requests.
2009/10/30 18:05:22| Done scanning /var/squid/cache (0 entries)
2009/10/30 18:05:22| Finished rebuilding storage from disk.
2009/10/30 18:05:22|         0 Entries scanned
2009/10/30 18:05:22|         0 Invalid entries.
2009/10/30 18:05:22|         0 With invalid flags.
2009/10/30 18:05:22|         0 Objects loaded.
2009/10/30 18:05:22|         0 Objects expired.
2009/10/30 18:05:22|         0 Objects cancelled.
2009/10/30 18:05:22|         0 Duplicate URLs purged.
2009/10/30 18:05:22|         0 Swapfile clashes avoided.
2009/10/30 18:05:22|   Took 2.9 seconds (   0.0 objects/sec).
2009/10/30 18:05:22| Beginning Validation Procedure
2009/10/30 18:05:22|   Completed Validation Procedure
2009/10/30 18:05:22|   Validated 0 Entries
2009/10/30 18:05:22|   store_swap_size = 0k
2009/10/30 18:05:22| storeLateRelease: released 0 objects
一旦你看到了 "Ready to serve requests" 信息, 你就可以使用缓存服务器了。一旦它启动并运行, Squid就开始读取保存的缓存: 第一次运行你应该看到的都是如上所示的一堆"0", 因为还没有缓存内容。
现在, 为了确保一切正常, 我们将配置浏览器以使用全新的代理服务器,然后我们将尝试访问喜爱的web站点。在文件 /var/squid/logs/access.log 里, 你应该看见类似这样的信息:
文件/var/squid/logs/access.log

代码: 全选

1242419601.435   6735 172.16.0.13 TCP_MISS/200 11810 GET http://www.kernel-panic.it/ - DIRECT/62.149.140.23 text/html
1242419849.536     14 172.16.0.13 TCP_HIT/200 11820 GET http://www.kernel-panic.it/ - NONE/- text/html
[...]
有关 access.log 里每条信息的细节请阅读 文档 。不过, 这里的 TCP_MISS 是指未保存在缓存里的请求页面 (无论其不存在或者已经过期); 而 TCP_HIT 则表示由缓存提供的页面。 第二个区块是Squid提供此服务所所花费的时间 (以毫秒计) : 你可以看见, 如果页面已被缓存,时间短很多。第五个区块是页面大小: 缓存的页面可能会大一些,因为Squid增加了额外的headers。
如果一切正常, 我们可以先停止Squid:

代码: 全选

# /usr/local/sbin/squid -k shutdown
然后将其配置为随系统启动。
文件 /etc/rc.local

代码: 全选

if [ -x /usr/local/sbin/squid ]; then
    echo -n ' squid'
    /usr/local/sbin/squid
fi
你可能也希望通过 RunCache 脚本启动Squid, 这个脚本会在失败后自动重新启动Squid,并且同时向 /var/squid/squid.out 和 syslog 文件输出log。别忘了,要让其在后台运行需要添加一个 "&", 否则,系统在启动时hang在那里。

头像
leo
帖子: 2465
注册时间: 2010-01-21 3:27

回复: The Squid and the Blowfish

帖子 leo » 2011-04-28 8:05

3. Squid高级配置
很多情况下, 我们上面所说的基本配置足以保证浏览提速和保护网络了, 但是Squid的功能远不止于此。下面我们仅讨论其中的很小一部分。

3.1 更多的访问控制
尽管多数人仅使用最基本的访问控制方案, 但是Squid的访问控制系统功能非常强大灵活, 允许你从更深层控制对缓存内容的访问。到目前为止,我们主要接触了ACLs,它的过滤规则基于源IP地址或者目标端口, 但是还有很多其它的 ACL 类型。在这里, 我们将粗略地说一下主要的, 仅仅是让读者了解一下Squid的 ACLs 可以做什么; 更详尽的信息请自行参阅 文档
Squid的一个 ACL 由至少4区块构成: acl 关键字, 后面跟一个 (也有可能是描述) 唯一的名称, ACL 类型和一个或多个判断字符串。所以, Squid的ACL大致的语法像这样:

代码: 全选

acl name type (string|"filename") [string2] [string3] ["filename2"]
一个 ACL 包含多个判断字符串,如果匹配任何判断字符串则会返回 (也就是说,判断字符串之间的关系是“或”)。为了避免数百行ACL规则搞乱配置文件,你可以用绝对路径指定一个文件 (在双引号内) ,这个文件里每个每个判断字符串占用一行。

下面列出的是一些最常用的 ACL 类型:
源/目标 IP地址
[INDENT]过滤基于源IP地址 (src 类) 或者目标IP地址 (dst 类)。既可以使用传统的l "IP/Netmask" 也可以使用CIDR "IP/Bits" 这两种表示法。例如:

代码: 全选

# "Traditional" notation
acl  myNet1  src 192.168.0.0/255.255.255.0
 
# Address range with CIDR notation
acl  myNet2  src 172.16.0.0-172.16.2.0/24
 
# Filtering on destination address
acl  badNet  dst 10.0.0.0/24
[/INDENT]源/目标 域名
[INDENT]Squid可以允许/拒绝那些去往/来自特定域名的请求 (类型分别是dstdomain 和 srcdomain )。如果你想拒绝到一个站点的访问, 别忘了同时也拒绝访问其IP地址, 否则这条规则会被轻松突破。例如:

代码: 全选

# Match a specific site
acl badDomain dstdomain forbidden.site
 
# Match the IP address of "forbidden.site"
acl badDomainIP dst 1.2.3.4
也可以使用正则表达式来检查一个请求的源域名 (srcdom_regex 类型) 和目标域名 (dstdom_regex 类) 。例如:

代码: 全选

# Match domains containing the word "sex" and a ".com" TLD (the match is case
# insensitive because of the '-i' flag)
acl  badSites  dstdom_regex -i sex.*\.com$
[/INDENT]包含在请求的URL里面的词汇
[INDENT]Squid可使用正则表达式过滤URL里匹配的特征(url_regex 类); 如果你不关心具体是什么 URL-类型以及域名, 你可以用 urlpath_regex 类来代替。

代码: 全选

# Match the most common video files extensions
acl  movies  urlpath_regex -i  \.avi$ \.mpg$ \.mpeg$ \.wmv$ \.asf$ \.mov$
 
# Match JPG images from URLs containing the word "sex"
acl  sexImg  url_regex -i  sex.*\.jpg$
[/INDENT]当前的 日期/时间
[INDENT]Squid允许根据时间来允许/拒绝访问特定的站点。语法是:

代码: 全选

acl name time [day-list] [start_hour:minute-end_hour:minute]
这里的 day-list 是一个用单个字符表示的 acl 具体应用在哪些“day”的清单 (Sunday, Monday, Tuesday, Wednesday, THhursday, Friday, SAturday). E.g.:

代码: 全选

acl workhours time MTWHF 08:00-18:00acl weekend time SAacl morning time 07:00-13:00
[/INDENT]目标端口
[INDENT]Squid的过滤可以基于目标端口。例如: acl SSL_ports port 443 563acl Safe_ports port 80 21 443 563 70 210 280 488 591 777 1024-65535
其中协议 (FTP, HTTP, SSL)是Squid的acl协议类型,它允许Squid 根据 acl 类型来 允许/拒绝 访问请求。例如:

代码: 全选

acl SSL_ports  port  443 563
acl Safe_ports port  80 21 443 563 70 210 280 488 591 777 1024-65535
[/INDENT]方式 (HTTP GET, POST 或 CONNECT)
[INDENT]ACL方式类可以让你基于请求的HTTP方式限制访问, 也就是 GET (用于下载), POST (用于上传) 和 CONNECT (用于SSL数据传输)。例如:

代码: 全选

# Deny CONNECT to other than SSL ports
acl connect method CONNECT
http_access deny connect !SSL_ports
很重要的方法是你可以阻止CONNECT类的请求访问非SSL端口。这里的 CONNECT方式允许数据在任何时间及方向上的传输, 不管使用的是什么传输协议。否则可能是这样的结果:一个恶意用户可以 telnet(1) 到一个 (非常) 不好的代理服务器, 例如这样:

代码: 全选

$ telnet bad.proxy.tld 3128
Trying 1.2.3.4...
Connected to bad.proxy.tld.
Escape character is '^]'.
CONNECT telnet.server.tld:23 HTTP/1.1
然后结束到远程服务器的连接, 好像连接是来自该服务器原生的。
[/INDENT]浏览器类型
[INDENT]这个acl 浏览器类型允许你指定一个正规表达式用于基于User-Agent header的 允许/拒绝 访问控制。例如:

代码: 全选

# Deny access to MS Internet Explorer
acl MSIE browser MSIE
http_access deny MSIE
[/INDENT]Username/Password pair
[INDENT]用户认证允许你跟踪Internet访问的使用和收集每个用户的统计信息。 最简单的认证机制是使用基本机制, 也就是用储存在一个文件里的 username/password 组。要创建该文件, 你可以使用 htpasswd(1) 命令:

代码: 全选

# /usr/bin/htpasswd -c /etc/squid/squid.passwd danix
New password: dAn1x
Re-type new password: dAn1x
Adding password for user danix
#
认证参数的设定使用 auth_param 标签; 然后, 为了真正激活认证你需要基于http_access (proxy_auth 或 proxy_auth_regex)里的login名称或者用在format标签里面的external_acl_type 带有 %LOGIN 来使用ACL。例如:

代码: 全选

# Configure traditional (basic) proxy authentication
auth_param basic program /usr/local/libexec/ncsa_auth /etc/squid/squid.passwd
 
# Number of authenticator processes to spawn
auth_param basic children 5
 
# Realm to be reported to the client
auth_param basic realm Squid proxy-caching web server
 
# Usernames are case insensitive
auth_param basic casesensitive off
 
# Credentials time to live
auth_param basic credentialsttl 12 hours
 
# Using REQUIRED will accept any valid username
acl AUTH proxy_auth REQUIRED
 
# Don't require authentication to localhost
http_access allow localhost
 
# Only allow authenticated requests coming from the LAN
http_access allow AUTH lan
 
# Default deny
http_access deny all
[/INDENT]SNMP通讯
[INDENT]可以基于请求的SNMP通讯来限制SNMP查询。例如:

代码: 全选

# Address of the cache administrator
acl snmpManager  src  172.16.0.100
 
# Non-sensitive information
acl SNMPPublic  snmp_community public
 
# Allow any request from the cache administrator
snmp_access  allow  snmpManager
 
# Clients on the LAN can only query non-sensitive information
snmp_access  allow  SNMPPublic lan
 
# Default deny
snmp_access  deny  all
[/INDENT]3.2 Http加速器模式 (反向代理)
按照此 文档, 启用Squid的加速模式仅在很有限的环境中才有效果:
  • 加速一台慢速服务器;
  • 用Squid代替一台整合了 cache/web 的服务器;
  • 透明缓存;
  • 保护一个不加密的web服务器。
除了这些情况, 我们强烈不推荐开启加速器模式。加速器模式配置很简单; 下面是一个Squid服务器加速请求到一台慢速服务器的简单配置。
文件 /etc/squid/squid.conf

代码: 全选

# In accelerator mode, Squid usually listens on the standard www port
http_port 80 accel vhost 
 
# Do the SSL work at the accelerator level. To create the certificates, run:
#   openssl req -x509 -newkey rsa:2048 -keyout squid.key -out squid.crt \
#   -days 365 -nodes
https_port  443 cert=/etc/ssl/squid.crt key=/etc/ssl/private/squid.key
 
# Accelerated server address and port
cache_peer 172.16.1.217 parent 80 0 no-query originserver
 
# Do not rewrite 'Host:' headers
url_rewrite_host_header off
# Process multiple requests for the same URI as one request
collapsed_forwarding    on
 
# Allow requests when they are to the accelerated machine AND to the
# right port
acl webSrv    dst   172.16.1.217
acl webPrt    port  80
acl all       src   all
http_access   allow webSrv webPrt
http_access   allow all
always_direct allow webSrv

3.3 透明缓存
透明缓存的意思是有一个过滤设备, 例如一个路由器或者一个防火墙, 默默地将web通讯重定向到缓存服务器。客户端忽略它们和web服务器之间的代理服务器的存在,认为自己直接与web服务器通讯。结果是, 透明缓存不需要在客户端进行任何配置, 因此让维护工作更加简单和快捷和。不过,在另一方面, 一个透明拦截代理无法使用认证或者透明地代理HTTPS协议。
在配置Squid前, 我们需要在我们的 防火墙 (the involved firewalls are those between the LAN, where clients reside, and the DMZ, where the cache server is placed)上启用web通讯重定向. 下面是简单的 pf.conf(5) 规则:
文件/etc/pf.conf

代码: 全选

[...]
# LAN interface
lan_if     = rl1
 
# Cache server and port
cache_srv  = proxy.kernel-panic.it
cache_port = 3128
 
# Transparently redirect web traffic to the cache server
pass in on $lan_if proto tcp from $lan_if:network to any port www \
     rdr-to $cache_srv port $cache_port
[...]
Squid configuration is quite simple:
文件 /etc/squid/squid.conf

代码: 全选

# Port on which connections are redirected
http_port  3128 transparent

3.4 SNMP
SNMP 是一系列用于网络管理和监视的协议。如果你 安装了 带"snmp" 性能的fSquid package, 那么代理服务器将可以通过SNMP提供统计和状态的服务。
SNMP的配额相当简单:
文件 /etc/squid/squid.conf

代码: 全选

# By default, Squid listens for SNMP packets on port 3401, to avoid conflicting
# with any other SNMP agent listening on the standard port 161.
snmp_port  3401
 
# Address to listen on (0.0.0.0 means all interfaces)
snmp_incoming_address 0.0.0.0
 
# Address to reply on (255.255.255.255 means the same as snmp_incoming_address)
# Only change this if you want to have SNMP replies sent using another address
# than where Squid listens for SNMP queries.
# snmp_incoming_address and snmp_outgoing_address can't have the same value
# since they both use port 3401.
snmp_outgoing_address 255.255.255.255
 
# Configuring access control is strongly recommended since some SNMP
# information is confidential
acl  all              src             all
acl  lan              src             172.16.0.0/24
acl  snmpManager      src             172.16.0.100
acl  publicCommunity  snmp_community  public
snmp_access           allow           snmpManager
snmp_access           allow           publicCommunity lan
snmp_access           deny            all
你可以测试一下是否 SNMP 可以和 snmpwalk 程序 (snmpwalk是 NET-SNMP 项目的一部分) 协同工作。例如:

代码: 全选

# snmpwalk -c public -v 1 proxy.kernel-panic.it:3401 .1.3.6.1.4.1.3495.1.1
SNMPv2-SMI::enterprises.3495.1.1.1.0 = INTEGER: 356
SNMPv2-SMI::enterprises.3495.1.1.2.0 = INTEGER: 744
SNMPv2-SMI::enterprises.3495.1.1.3.0 = Timeticks: (540791) 1:30:07.91
#
请参阅这篇 文档 以了解snmpwalk命令输出内容的相关信息。

头像
leo
帖子: 2465
注册时间: 2010-01-21 3:27

回复: The Squid and the Blowfish

帖子 leo » 2011-04-28 9:15

4. 使用SquidGuard进行内容过滤
SquidGuard 是一个组合了过滤器, 重定向器和访问控制器的Squid插件。我们将使用它来阻止到那些令人讨厌的站点的访问, 它可以基于IP地址, URL和正则表达式。 SquidGuard 自带了一份非常广泛的公众屏蔽站点清单, 这些站点按照类被划分,例如 "porn", "drugs", "ads" 等等, 配置很简单和快捷。

4.1 安装
SquidGuard可以从OpenBSD的 packages and ports system 获取,需要安装如下的packages:
  • db-x.x.x.tgz
  • squidGuard-x.x.x.tgz
安装过程在 /usr/local/share/examples/squidguard/dest/ 目录里放置了一份压缩版的黑名单 (blacklists.tar.gz) 。我们将其提取到 /var/squidguard/db 目录:

代码: 全选

# cd /usr/local/share/examples/squidguard/dest/
# mkdir -p /var/squidguard/db
# tar -zxvC /var/squidguard/db -f blacklists.tar.gz
[...]
#

4.2 配置
SquidGuard的配置文件是 /etc/squidguard/squidguard.conf; 它被逻辑地分为6个单元 (请参考这篇 文档 以了解更多squidGuard配置信息选项):
路径声明
[INDENT]指定了logs和黑名单的目录:

代码: 全选

logdir  /var/squidguard/log
dbhome  /var/squidguard/db
[/INDENT]时间空间声明
[INDENT]SquidGuard允许你采用不同的访问规则,可以基于时间 和/或日期。这里有一个简单的实例可最好的说明这些规则的灵活性。

代码: 全选

time workhours {
    weekly  mtwhf  08:00-18:00
}
 
time night {
    weekly  * 18:00-24:00
    weekly  * 00:00-08:00
}
 
time holidays {
    date    *.01.01                 # New Year's Day
    date    *.05.01                 # Labour Day
    date    *.12.24 12:00-24:00     # Christmas Eve (short day)
    date    *.12.25                 # Christmas Day
    date    *.12.26                 # Boxing Day
}
[/INDENT]源组声明
[INDENT]SquidGuard允许你基于源IP地址,域名和用户 (用户资格和URL一同传递给Squid)来过滤; 例如:

代码: 全选

src admin {
    ip      172.16.0.12                # The administrator's PC
    domain  lan.kernel-panic.it        # The LAN domain
    user    root administrator         # The administrator's login names
}
 
src lan {
    ip      172.16.0.0/24              # The internal network
    domain  lan.kernel-panic.it        # The LAN domain
}
[/INDENT]目标组声明
[INDENT]Squid的一个主要特点是可以根据目标地址或域名过滤。我们前面已经提取了相关的数据库,所以很方便。这里的domainlist参数指定了包含域名清单的一个文件的路径 (后面我们会看一下怎样创建db文件以加速SquidGuard的启动时间): 这必须是一个相对于dbhome参数指定的根目录的相对路径。类似的还有 urllist 和 expressionlist 参数,它们分别指定了到包含了URL清单文件的 (相对的) 路径和正则表达式文件的路径。例如:

代码: 全选

dest porn {
    domainlist       blacklists/porn/domains
    urllist       blacklists/porn/urls
    expressionlist blacklists/porn/expressions
    # Logged info is anonymized to protect users' privacy
    log anonymous  dest/porn.log
}
[/INDENT]访问控制规则声明
[INDENT]最后, 我们可以合并所有上述所提规则来创建一份访问控制清单:

代码: 全选

acl {
    admin within workhours {
        # The following rule allows everything except porn, drugs and
        # gambling sites during work hours. '!' is the NOT operator.
        pass !porn !drugs !gambling all
    } else {
        # Outside of work hours drugs and gambling sites are still blocked.
        pass !drugs !gambling all
    }
    lan {
        # The built-in 'in-addr' destination group matches any IP address.
        pass !in-addr !porn !drugs !gambling all
    }
    default {
        # Default deny to reject unknown clients
        pass none
        redirect  http://www.kernel-panic.it/error.html&ip=%a&url=%u
    }
}


这里的重定向 redirect 规则声明了当用户请求阻止的网页时跳转到的 URL 。

SquidGuard可以通过扩展下列宏将一些有用的信息包含在URL里面:
  • %a: the IP address of the client.
  • %n: the domain name of the client or "unknown" if not available.
  • %i: the user ID or "unknown" if not available.
  • %s: the matched source group or "unknown" if no groups were matched.
  • %t: the matched destination group or "unknown" if no groups were matched.
  • %u: the requested URL.
  • %p: the path and the optional query string of %u but without the leading "/".
  • %%: a single "%".
[/INDENT]现在squidGuard已经配置好了, 我们可以用下面的命令为域名创建Berkeley DB文件, URLs和正则表达式:

代码: 全选

# squidGuard -u -C all
# chown -R _squid /var/squidguard/

你可以通过在命令行上模拟一些Squid请求来测定squidGuard配置的正确性; squidGuard希望得到一个单行的标准输入,采用下面的格式 (空格以 "-"代替):

代码: 全选

URL client_ip/fqdn user method urlgroup

然后返回一个配置的重定向URL (如果站点被屏蔽) 或者一个空行; 例如:

代码: 全选

# echo "http://www.blocked.site 1.2.3.4/- user GET -" | squidGuard -c /etc/squidguard/squidguard.conf -d
[ ... ]
2008-12-14 09:57:04 [27349] squidGuard ready for requests (1197622624.065)
http://www.kernel-panic.it/error.html&ip=1.2.3.4&url=http://www.blocked.site 1.2.3.4/- user GET
2008-12-14 09:57:04 [27349] squidGuard stopped (1197622624.067)
# echo "http://www.good.site 1.2.3.4/- user GET -" | squidGuard -c /etc/squidguard/squidguard.conf -d
[ ... ]
2008-12-14 10:30:24 [12046] squidGuard ready for requests (1197624624.421)
 
2008-12-14 10:30:24 [12046] squidGuard stopped (1197624624.423)
如果一切正常, 我们将可以将squidGuard配置为Squid的重定向器了, 方法是在 /etc/squid/squid.conf 文件内编辑一些参数。
文件 /etc/squid/squid.conf

代码: 全选

# Path to the redirector program
url_rewrite_program   /usr/local/bin/squidGuard
 
# Number of redirector processes to spawn
url_rewrite_children  5
 
# To prevent loops, don't send requests from localhost to the redirector
url_rewrite_access    deny  localhost
然后重新加载Squid配置:

代码: 全选

# squid -k reconfigure

头像
leo
帖子: 2465
注册时间: 2010-01-21 3:27

回复: The Squid and the Blowfish

帖子 leo » 2011-04-28 9:47

5. 用SquidClamav扫描病毒
SquidClamav 是一个为Squid开发的 ClamAV 病毒重定向器。它会帮助我们从web通讯里过滤掉恶意软件。

5.1 安装
我们在 上篇文档里 里已经描述了 Clam AntiVirus 的安装过程, 所在在这里不再说了,直接进入SquidClamav安装过程。我们这里假设ClamAV和Squid在同一台机器上, 也许你可能想设置一台独立的反病毒服务器, 这样可能为缓存服务器和邮件服务器这两者都提供服务。



SquidClamav需要 cURL 库来下载需要扫描的文件, 所以我们需要先add一些packages:
  • libiconv-x.x.tgz
  • gettext-x.x.x.tgz
  • libidn-x.x.tgz
  • curl-x.xx.x.tgz
然后我们就可以 下载, 提取和编译SquidClamav的tarball:

代码: 全选

$ tar -zxvf squidclamav-x.x.tar.gz
[...]
$ cd squidclamav-x.x
$ env LDFLAGS=-L/usr/local/lib/ CPPFLAGS=-I/usr/local/include/ ./configure
[...]
$ make
[...]
$ su
Password:
# make install
[ ... ]
# cp etc/squidclamav.conf /etc/
# touch /var/log/squidclamav.log
# chown _squid /var/log/squidclamav.log

5.2 配置
配置文件是 /etc/squidclamav.conf; SquidClamav的一个亮点是在调用它进行任何进一步的HTTP请求处理前,其本身可以与 SquidGuard (或者任何其他的重定向器, 可以在squidguard命令里指定)协同工作。
默认情况下, SquidClamav会扫描所有下载的文件, 但是你可以通过指令来指定信任的域名(whitelist)、用户(trustuser)、客户端(trustclient)以避免扫描和调用连接的重定向器、从而节省系统资源和提高性能。例如:

代码: 全选

# Disable redirector and virus scanning for files from kernel-panic.it
whitelist     .*\.kernel-panic\.it
 
# Disable redirector and virus scanning for requests from a specific user
trustuser     administrator
 
# Disable redirector and virus scanning for requests from specific clients
trustclient   ^172\.16\.0\..*$
trustclient   ^mypc\.lan\.kernel-panic.it$

SquidClamav还允许你基于正则表达式匹配的URL字符串(abort指令)或者反应(abortcontent 指令)的Content-Type来禁用病毒扫描 (但是不调用链接的重定向器) ; 这两个指令都大小写敏感。例如:

代码: 全选

# Disable virus scanning for .png, .gif and .jpg images and documents from
# squid-cache.org
abort \.squid-cache\.org
abort .*\.(png|gif|jpg)$
 
# Disable virus scanning for images and flash videos
abortcontent ^image\/.*$
abortcontent ^video\/x-flv$
下面是一个简单的配置文件:
文件 /etc/squidclamav.conf

代码: 全选

# IP address and port of the Squid proxy
squid_ip      127.0.0.1
squid_port    3128
 
# Path to the log file
logfile       /var/log/squidclamav.log
 
# URL where to redirect a request when a virus is found. SquidClamav will
# append the original URL, virus name, source IP and user the to this URL
redirect      http://www.kernel-panic.it/viruswarn.php
 
# Disable virus scanning if the requested file hits squid cache
trust_cache   1
 
# Timeout when downloading files
timeout       60
 
# Set this to '1' for more verbose logging
debug         0
 
# Set this to '1' to force virus scan of URLs whose content-type can't be
# determined by libcurl
force         1
 
# Set this to '1' to show time statistics of URL processing
stat          0
 
# Don't follow more than 10 redirects
maxredir      10
 
# Uncomment to disable virus scanning for files bigger than the specified
# size (in bytes)
# maxsize      2000000
 
# Uncomment to make cURL pretend to be Internet Explorer
#useragent     Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)
 
# IP address and port of the clamd daemon; you can specify up to 5
# (comma-separated) IPs for failover
clamd_ip      127.0.0.1
clamd_port    3310
# Uncomment if you're using the unix socket to communicate with clamd
#clamd_local   /tmp/clamd
 
# Check rules
abort         ^.*\.(ico|gif|png|jpg)$
abortcontent  ^image\/.*$
abort         ^.*\.(css|xml|xsl|js|html|jsp)$
abortcontent  ^text\/.*$
abortcontent  ^application\/x-javascript$
abortcontent  ^video\/mp4$
abortcontent  ^video\/x-flv$
abort         ^.*\.(pdf|swf)$
whitelist     .*\.kernel-panic\.it
 
# Call another redirector (usually squidGuard) before the antivirus scanner
squidguard    /usr/local/bin/squidGuard
现在我们只需要修改Squid配置文件里参数 url_rewrite_program 的数值:
文件 /etc/squid/squid.conf

代码: 全选

url_rewrite_program /usr/local/bin/squidclamav
然后重新加载Squid.

代码: 全选

# squid -k reconfigure
注意: 要扫描一个文件, SquidClamav需要先下载它; 所以请确认你的 Squid ACLs 允许本地访问web:
文件 /etc/squid/squid.conf

代码: 全选

http_access allow localhost

你可以通过下载 Eicar 反病毒测试文件来确认一切工作正常。在log文件里, 你应该看到这样的类似的信息:
文件 /var/log/squidclamav.log

代码: 全选

[...]
Fri May 15 19:26:49 2009 [29028] DEBUG received from Clamd: stream: Eicar-Test-Signature FOUND
Fri May 15 19:26:49 2009 [29028] LOG Redirecting URL to: http://www.kernel-panic.it/viruswarn.php?
url=http://www.eicar.org/download/eicar.com.txt&source=192.168.1.14/-&user=-&virus=stream:+
Eicar-Test-Signature+FOUND
Fri May 15 19:26:49 2009 [29028] DEBUG End reading clamd scan result.
Fri May 15 19:26:49 2009 [29028] DEBUG Virus found send redirection to Squid.

头像
leo
帖子: 2465
注册时间: 2010-01-21 3:27

回复: The Squid and the Blowfish

帖子 leo » 2011-04-28 9:51

6. 用AdZapper阻击广告
AdZapper 为squid开发的阻击广告的重定向器 ,它可以阻止横幅, 弹窗, flash动画等, 网页计数器和一些web蠕虫 (已发现的)。它可以帮助用户摆脱那些烦人的弹窗, flash动画及恶意的cookies,还有可以帮助你减少带宽和缓存资源。

我们将使用三个脚本:
  • squid_redirect, which performs the actual ad zapping;
  • zapchain, which chains multiple redirectors together (this is necessary because Squid accepts only one redirector_program);
  • wrapzap which is a very simple wrapper script that sets environment variables useful to the redirector and then runs it.
6.1 安装
安装过程很简单。下载 并提取tarball, 然后将 squid_redirect, wrapzap 和 zapchain 脚本拷贝到 /usr/local/bin, 或者任何你喜欢的地方。

代码: 全选

# tar -zxvf adzap-xxxxxxxx.tar.gz
[...]
# cd adzap-xxxxxxxx/scripts
# cp squid_redirect wrapzap zapchain /usr/local/bin/

这个zaps的目录包含了替换广告的图片: 将其拷贝到web服务器可以找到的地方。它们并不精美, 所以你可以自行定制。

代码: 全选

# scp -r ../zaps root@www.kernel-panic.it:/var/www/icons/

6.2 配置
AdZapper可以通过wrapzap脚本完成配置; 下面是一个简单的配置脚本:
文件 /usr/local/bin/wrapzap

代码: 全选

#!/bin/sh
 
squidclamav=/usr/local/bin/squidclamav
zapper=/usr/local/bin/squid_redirect
 
# Setting ZAP_MODE to "CLEAR" will cause the zapper to use transparent images,
# thus completely hiding ads. This may, however, hide useful markup.
ZAP_MODE=
 
# Base URL of the directory containing the replacement images
ZAP_BASE=http://www.kernel-panic.it/icons/zaps
ZAP_BASE_SSL=https://www.kernel-panic.it/icons/zaps
 
# The following variables contain the path to extra pattern files.
# ZAP_PREMATCH patterns are consulted before the main pattern list. Use it to
# prevent overzapping by some erroneous patterns in the main pattern file.
ZAP_PREMATCH=
 
# ZAP_POSTMATCH patterns are consulted after the main pattern list. Use it to
# add extra patterns
ZAP_POSTMATCH=
 
# ZAP_MATCH patterns are consulted instead of the main pattern list. Use it to
# fully customize AdZapper
ZAP_MATCH=
 
# Should you use Apache2 instead of Squid, set this to "NULL"
ZAP_NO_CHANGE=
 
# Placeholder images names. "Clear" versions have "-clear" appended to the root
# portion of the file name; e.g. "ad.gif" becomes "ad-clear.gif".
STUBURL_AD=$ZAP_BASE/ad.gif
STUBURL_ADSSL=$ZAP_BASE_SSL/ad.gif
STUBURL_ADBG=$ZAP_BASE/adbg.gif
STUBURL_ADJS=$ZAP_BASE/no-op.js
STUBURL_ADJSTEXT=
STUBURL_ADHTML=$ZAP_BASE/no-op.html
STUBURL_ADHTMLTEXT=
STUBURL_ADMP3=$ZAP_BASE/ad.mp3
STUBURL_ADPOPUP=$ZAP_BASE/closepopup.html
STUBURL_ADSWF=$ZAP_BASE/ad.swf
STUBURL_COUNTER=$ZAP_BASE/counter.gif
STUBURL_COUNTERJS=$ZAP_BASE/no-op-counter.js
STUBURL_COUNTERHTML=$ZAP_BASE/no-op-counter.html
STUBURL_WEBBUG=$ZAP_BASE/webbug.gif
STUBURL_WEBBUGJS=$ZAP_BASE/webbug.js
STUBURL_WEBBUGHTML=$ZAP_BASE/webbug.html
 
# Set this to "1" to use the rewrite facility to get the printer-friendly
# version of some pages
STUBURL_PRINT=
 
export ZAP_MODE ZAP_BASE ZAP_BASE_SSL ZAP_PREMATCH ZAP_POSTMATCH ZAP_MATCH ZAP_NO_CHANGE
export STUBURL_AD STUBURL_ADSSL STUBURL_ADJS STUBURL_ADHTML STUBURL_ADMP3      \
        STUBURL_ADPOPUP STUBURL_ADSWF STUBURL_COUNTER STUBURL_COUNTERJS        \
        STUBURL_COUNTERHTML STUBURL_WEBBUG STUBURL_WEBBUGJS STUBURL_WEBBUGHTML \
        STUBURL_PRINT STUBURL_ADHTMLTEXT STUBURL_ADJSTEXT
 
 
# Exec the real zapper (chained with SquidClamav)
exec /usr/local/bin/zapchain "$zapper" "$squidclamav"
现在我么您仅需在Squid的配置文件里更新 url_rewrite_program :
文件 /etc/squid/squid.conf

代码: 全选

url_rewrite_program /usr/local/bin/wrapzap
然后重新载入Squid.

代码: 全选

# squid -k reconfigure
现在广告应该已经神奇地从网页上消失了!

头像
leo
帖子: 2465
注册时间: 2010-01-21 3:27

回复: The Squid and the Blowfish

帖子 leo » 2011-04-28 9:56

7. 附录

7.1 Squid下的秘道
那么最终你已经配置了代理服务器, 仅允许一些到标准端口的访问, 屏蔽了黑名单上的站点以及广告和病毒。HTTP CONNECT 方式可以限制到标准的HTTPS端口。你的LAN防火墙规则也非常严格,除了允许到代理服务器的3128端口访问,它已经阻止了一切访问请求。因此, 你觉得如果没有你明确地允许,用户不可能到Internet上做任何事情。不过Squid是一个丑陋的怪兽, 而且如果你并没有非常仔细地研究它的配置 (和日志), 你的用户可能完全不遵循你定义的屏蔽规则。让我们看一个特殊的例子。
Stunnel 程序允许你在SSL里加密任何TCP连接。它的主要通过Stunnel提供的加密来加密那些使用非SSL连接的进程和协议 (像 POP, IMAP, LDAP等), 同时无需修改进程代码。
基本上, Stunnel在两台主机间建立一个加密的而且持续的连接。其中一台机器担当服务器的角色,并转发所有Stunnel收到的连接到用户定义的端口;而另一台机器作为客户端, 绑定到任意的接口,然后转发任何它在那个端口所收到的连接给作为服务器的机器。



我们将使用Stunnel和Squid来绕过防火墙规则,并从公司本地的LAN上 ssh(1) 到远程的服务器 (例如你家里的计算机) 。OpenBSD的ports和packages里收集了一些类似的在代理服务器上打开暗道的工具, 例如:
  • Corkscrew, a tool for tunneling ssh(1) through HTTP proxies;
  • gotthard, a daemon which tunnels ssh(1) sessions through an HTTPS proxy;
  • httptunnel, which creates a bidirectional virtual data connection tunnelled in HTTP requests.
不过, Stunnel可能是功能最多应用最广泛的打洞工具, 因为他可以转发任何类型的网络通讯 (并非仅限于 ssh(1)) 并且提供了额外的 SSL 加密层, 因此保护了明文协议,例如 telnet(1) 或者 ftp(1)

7.1.1 服务器端的配置
远程的计算机必须担当服务器。安装l Stunnel 并建立SSL证书:

代码: 全选

remote# pkg_add stunnel-x.xx.tgz
[...]
remote# openssl req -x509 -newkey rsa:2048 -keyout /etc/ssl/private/stunnel.key \
> -out /etc/ssl/stunnel.crt -days 365 -nodes
[...]
remote# chmod 600 /etc/ssl/private/stunnel.key
然后,配置Stunnel,将其绑定到端口443 (HTTPS) 并且转发进站连接到端口(ssh)。
配置文件是 /etc/stunnel/stunnel.conf:

代码: 全选

cert = /etc/ssl/stunnel.crt
key = /etc/ssl/private/stunnel.key
sslVersion = SSLv3
 
chroot = /var/stunnel/
setuid = _stunnel
setgid = _stunnel
pid = /var/run/stunnel.pid
 
socket = l:TCP_NODELAY=1
socket = r:TCP_NODELAY=1
 
[https]
accept  = 443
connect = 22
TIMEOUTclose = 0
现在我们可以启动它,然后欣赏一下我们开启的暗道l:

代码: 全选

remote# /usr/local/sbin/stunnel

7.1.2 客户端配置
现在我们配置本地网络, 它将作为客户端。SSL通道需要穿越Squid来摆脱防火墙规则, 不过默认情况下, Stunnel不支持web代理。幸运的是, 有些让Stunnel支持SSL代理的补丁。 最新的补丁 可应用于Stunnel 4.05, 所以我建议你在客户端 下载 并安装它。

代码: 全选

local$ tar -zxvf stunnel-4.05.tar.gz
[...]
local$ patch -p0 < connect-proxy.mwald.patch
[...]
local$ cd stunnel-4.05
local$ ./configure
[...]
local$ ln -s /usr/sbin/openssl /usr/bin/openssl
local$ make
[...]
local$ su
Password:
local# make install
[...]
local#
这个补丁引入了另外两个配置参数: httpsproxy_dest (Stunnel 服务器的域名或IP地址) 和 httpsproxy_auth (代理认证证书)。 我们将客户端设置为从任何端口接收连接 (例如:1443) ,然后将它们转发到远程Stunnel服务器的443端口,远程服务器将依次将它们转发到端口22。换句话说, 当你连接本地主机的1443端口时, 实际上你将连接到远程服务器的22端口。
客户端的配置文件像这样:
文件 /etc/stunnel/stunnel.conf

代码: 全选

chroot = /var/stunnel
setuid = _stunnel
setgid = _stunnel
pid = /var/run/stunnel.pid
 
client = yes
 
[https]
accept = 1443
connect = web-proxy:3128
httpsproxy_dest = stunnel-server:443
httpsproxy_auth = username:password
好了,一切都就绪了,我们测试一下:

代码: 全选

local# /usr/local/sbin/stunnel
local# ssh localhost -p 1443
root@localhost's password:
remote#

看到了吧, 尽管有防火墙规则以及Squid的ACLS, 我们仍旧可以连接到远程的计算机。一旦这个通道建立起来, 你甚至可以做反向的操作,也就是秩序在本地开启一个反向的ssh让远程服务器连接到本地的客户端 :

代码: 全选

local# ssh -NR 2443:localhost:22 -p 1443

这种情况下, 远程服务器上的2243端口接收的每个连接将被转发到本地客户端的22端口:

代码: 全选

remote# ssh localhost -p 2443
root@localhost's password:
local#
你甚至可以允许远程的服务器上的X11转发,这样你可以在本地阅览所有的远程环境了 (例如,无需通过代理过滤就可以浏览网页).
总之,我们在这里只是想告诉你仔细检查Squid配置文件的重要性。不过, 通常情况下, 企业的访问限制越多,则你的用户越是想方设法逃避。
顺便说一下, 使用白名单是解决暗道的最佳方式, 但是, 如果你限制的太严了,小心你的汽车锁被愤怒的员工做手脚!



7.2 References
  • OpenBSD, the secure by default operating system
  • Squid, a full-featured Web proxy cache designed to run on Unix systems
  • Squidguard, an ultrafast and free filter, redirector and access controller for Squid
  • ClamAV, a GPL anti-virus toolkit for UNIX
  • SquidClamav, a Clamav Antivirus Redirector for Squid
  • AdZapper, a redirector for squid that intercepts advertising, page counters and some web bugs
  • DansGuardian, true web content filtering for all
  • Stunnel, the universal SSL wrapper
  • HTTP Connect-style proxy patch for Stunnel
  • Corkscrew, a tool for tunneling ssh(1) through HTTP proxies
  • gotthard, a daemon which tunnels ssh(1) sessions through an HTTPS proxy
  • httptunnel, a tool for creating a bidirectional virtual data connection tunnelled in HTTP requests
7.3 Bibliography

头像
leo
帖子: 2465
注册时间: 2010-01-21 3:27

回复: 鱿鱼会河豚——基于OpenBSD的代理服务器

帖子 leo » 2011-04-29 12:15

发现一个非常好的站点,彭勇华先生翻译的《Squid: The Definitive Guide》一书,中文名《Squid权威指南》,想要研究Squid的朋友有福了::)
作者介绍:http://home.arcor.de/pangj/
原文网址: http://home.arcor.de/pangj/squid/index.html

头像
crzyfish
镍 Ni
帖子: 195
注册时间: 2010-02-05 20:11

回复: 鱿鱼会河豚——基于OpenBSD的代理服务器

帖子 crzyfish » 2011-04-30 10:48

我赶紧squid加openbsd-PF,做web集群前端,一定很牛逼又安全稳定啊~

头像
leo
帖子: 2465
注册时间: 2010-01-21 3:27

回复: 鱿鱼会河豚——基于OpenBSD的代理服务器

帖子 leo » 2011-04-30 11:07

也不见得,先看看7#的内容,要看你应用在什么环境里了。

回复

在线用户

正浏览此版面之用户: 没有注册用户 和 28 访客