FreeBSD 7.3 PF + Squid 3.1.8 + Squidguard 1.4
вырезки из конфигов только относящиеся к сабжуpf.conf:
--------------
rdr on $int_if proto tcp from $localnet to any port 80 -> $int_if port 3128
--------------
squid.conf
--------------
acl manager proto cache_object
acl localhost src 127.0.0.1/32
acl localnet src 172.16.1.0/24
http_access allow manager localhost
http_access allow localnet
http_access allow localhost
http_access deny all
http_port 3128 intercept
hierarchy_stoplist cgi-bin ?
coredump_dir /usr/local/squid/cache
refresh_pattern ^ftp: &n... 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern -i (/cgi-bin/|\?) 0 0% 0
refresh_pattern . 0 20% 4320
cache_mem 128 MB
maximum_object_size 64 MB
cache_dir ufs /usr/local/squid/cache 256 16 256
cache_store_log /usr/local/squid/logs/store.log
cache_access_log /usr/local/squid/logs/access.log
cache_log /usr/local/squid/logs/cache.log
logformat squid %tl.%03tu %6tr %>a %Ss/%03>Hs %<st %rm %ru %un %Sh/%<A %mt
visible_hostname pavlik
url_rewrite_program /usr/local/bin/squidGuard -c /usr/local/etc/squid/squidGuard.conf
url_rewrite_children 5
----------------------
связка pf и squid работает прекрасно, все проверено, а вот дальше...
squidGuard.conf
-------------------
dbhome /var/db/squidGuard
logdir /var/log
source localnet {
ip 172.16.1.0/24
}
dest adult {
domainlist adult/domains
urllist adult/urls
redirect https://172.16.1.1/xams/restrict.html
}
acl {
localnet {
pass !adult any
}
default {
pass none
redirect http://172.16.1.1/xams/restrict.html
}
}
-------------------------
все базы инициированы
смотрим вывод squidGuard:
# squidGuard -d
2010-10-29 14:57:55 [1827] New setting: dbhome: /var/db/squidGuard
2010-10-29 14:57:55 [1827] New setting: logdir: /var/log
2010-10-29 14:57:55 [1827] init domainlist /var/db/squidGuard/adult/domains
2010-10-29 14:57:55 [1827] loading dbfile /var/db/squidGuard/adult/domains.db
2010-10-29 14:57:55 [1827] init urllist /var/db/squidGuard/adult/urls
2010-10-29 14:57:55 [1827] loading dbfile /var/db/squidGuard/adult/urls.db
2010-10-29 14:57:55 [1827] squidGuard 1.4 started (1288339075.760)
2010-10-29 14:57:55 [1827] Info: recalculating alarm in 10925 seconds
2010-10-29 14:57:55 [1827] squidGuard ready for requests (1288339075.764)
делаю проверку squidGuarda:
# echo "http://adult.com 172.16.1.2/ - - GET" | squidGuard -c /usr/local/etc/squid/squidGuard.conf
https://172.16.1.1/xams/restrict.html 172.16.1.2/- - -
# echo "http://freebsd.org 172.16.1.2/ - - GET" | squidGuard -c /usr/local/etc/squid/squidGuard.conf
конфиг отрабатывает корректно, но захожу с клиентской машины (172.16.1.2) на http://adult.com и наслаждаюсь порнухой :)
логи сквида:
cache.log
-----------------
2010/10/29 15:02:43| Starting Squid Cache version 3.1.8 for i386-portbld-freebsd7.3...
2010/10/29 15:02:43| Process ID 1927
2010/10/29 15:02:43| With 4442 file descriptors available
2010/10/29 15:02:43| Initializing IP Cache...
2010/10/29 15:02:43| DNS Socket created at 0.0.0.0, FD 6
2010/10/29 15:02:43| Adding nameserver 127.0.0.1 from /etc/resolv.conf
2010/10/29 15:02:43| helperOpenServers: Starting 5/5 'squidGuard' processes
2010/10/29 15:02:44| Unlinkd pipe opened on FD 21
2010/10/29 15:02:44| Swap maxSize 262144 + 131072 KB, estimated 30247 objects
2010/10/29 15:02:44| Target number of buckets: 1512
2010/10/29 15:02:44| Using 8192 Store buckets
2010/10/29 15:02:44| Max Mem size: 131072 KB
2010/10/29 15:02:44| Max Swap size: 262144 KB
2010/10/29 15:02:44| Version 1 of swap file with LFS support detected...
2010/10/29 15:02:44| Rebuilding storage in /usr/local/squid/cache (CLEAN)
2010/10/29 15:02:44| Using Least Load store dir selection
2010/10/29 15:02:44| Set Current Directory to /usr/local/squid/cache
2010/10/29 15:02:44| Loaded Icons.
2010/10/29 15:02:44| Accepting intercepted HTTP connections at 0.0.0.0:3128, FD 25.
2010/10/29 15:02:44| HTCP Disabled.
2010/10/29 15:02:44| Adaptation support is off.
2010/10/29 15:02:44| Ready to serve requests.
2010/10/29 15:02:44| Done reading /usr/local/squid/cache swaplog (55 entries)
2010/10/29 15:02:44| Finished rebuilding storage from disk.
2010/10/29 15:02:44| 55 Entries scanned
2010/10/29 15:02:44| 0 Invalid entries.
2010/10/29 15:02:44| 0 With invalid flags.
2010/10/29 15:02:44| 55 Objects loaded.
2010/10/29 15:02:44| 0 Objects expired.
2010/10/29 15:02:44| 0 Objects cancelled.
2010/10/29 15:02:44| 0 Duplicate URLs purged.
2010/10/29 15:02:44| 0 Swapfile clashes avoided.
2010/10/29 15:02:44| Took 0.02 seconds (2774.27 objects/sec).
2010/10/29 15:02:44| Beginning Validation Procedure
2010/10/29 15:02:44| Validated 135 Entries
2010/10/29 15:02:44| store_swap_size = 668
2010/10/29 15:02:45| storeLateRelease: released 0 objects
-------------------------------------------------------
access.log
-----------------
1288339388.276 2 172.16.1.2 TCP_HIT/301 502 GET http://adult.com/ - NONE/- text/html
1288339388.768 449 172.16.1.2 TCP_MISS/404 227 GET http://www.adult.com/wp-content/themes/Adultcom/scripts/jque...
1288339389.320 550 172.16.1.2 TCP_MISS/200 3739 GET http://pei-ads.playboy.com/RealMedia/ads/adstream_mjx.ads/ww...
1288339390.022 553 172.16.1.2 TCP_MISS/200 584 GET http://www.adult.com/wp-content/themes/Adultcom/images/nav_a...
1288339390.023 554 172.16.1.2 TCP_MISS/200 360 GET http://www.adult.com/wp-content/themes/Adultcom/images/nav_a...
1288339390.508 1164 172.16.1.2 TCP_MISS/200 1462 GET http://rc.brandreachsys.com/www/delivery/afr.php? - DIRECT/208.78.92.2
1288339390.511 1180 172.16.1.2 TCP_MISS/200 1494 GET http://rc.brandreachsys.com/www/delivery/afr.php? - DIRECT/208.78.92.2
1288339390.521 604 172.16.1.2 TCP_MISS/302 571 GET http://d1.playboy.com/cm? - DIRECT/199.255.33.116 text/plain
1288339390.807 551 172.16.1.2 TCP_MISS/200 44953 GET http://rkcache.brandreachsys.com/realitykings/m_1102rk_728x9...
1288339390.883 358 172.16.1.2 TCP_MISS/200 604 GET http://d1.playboy.com/cm? - DIRECT/199.255.33.116 image/gif
1288339390.910 395 172.16.1.2 TCP_MISS/200 1504 GET http://rc.brandreachsys.com/www/delivery/afr.php? - DIRECT/208.78.92.2
1288339390.913 400 172.16.1.2 TCP_MISS/200 1476 GET http://rc.brandreachsys.com/www/delivery/afr.php? - DIRECT/208.78.92.2
1288339391.161 910 172.16.1.2 TCP_MISS/200 524 GET http://rc.brandreachsys.com/www/delivery/lg.php? - DIRECT/208.78.92.25
1288339391.183 927 172.16.1.2 TCP_MISS/200 524 GET http://rc.brandreachsys.com/www/delivery/lg.php? - DIRECT/208.78.92.25
1288339391.298 380 172.16.1.2 TCP_MISS/200 524 GET http://rc.brandreachsys.com/www/delivery/lg.php? - DIRECT/208.78.92.25
1288339391.300 383 172.16.1.2 TCP_MISS/200 524 GET http://rc.brandreachsys.com/www/delivery/lg.php? - DIRECT/208.78.92.25
1288339391.536 612 172.16.1.2 TCP_MISS/200 60125 GET http://ptrcache.brandreachsys.com/naughtyamerica/t_0322na_30...
1288339464.115 1 172.16.1.2 TCP_MEM_HIT/200 592 GET http://www.adult.com/wp-content/themes/Adultcom/images/nav_a...
1288339464.116 1 172.16.1.2 TCP_MEM_HIT/200 487 GET http://www.adult.com/wp-content/themes/Adultcom/images/nav_a...
1288339464.566 437 172.16.1.2 TCP_MISS/200 360 GET http://www.adult.com/wp-content/themes/Adultcom/images/tab_h...
1288339464.566 435 172.16.1.2 TCP_MISS/000 0 GET http://www.adult.com/wp-content/themes/Adultcom/images/tab_h...
-------------------------------------