Author Topic: install squid support sarg on freebsd 7.0  (Read 6909 times)

golfreeze

  • Administrator
  • Hero Member
  • *****
  • Posts: 2141
    • View Profile
    • นั่งสมาธิ สติปัฏฐานสี่ พาเที่ยววัด แนะนำวัด แจกcd ธรรมะฟรี
    • Email
install squid support sarg on freebsd 7.0
« on: มกราคม 24, 2011, 01:34:31 PM »
### Log hashing
md5sum vsftpd.log.1 > xxx.MD5
md5sum -c xxx.MD5




## Openldap + Squid + Sarg + apache

cd /usr/ports/www/apache22

make install clean

cd /usr/ports/lang/php5

make config

make install clean

cd /usr/ports/lang/php5-extension

make config เลือก gd , ldap , mysql , pcre = จำเป็นกับ phpldapadmin

----------------------------------------------


#cd /usr/ports/net/openldap23-server

#make config

#make install clean

----------------------------

#cd /usr/ports/net/openldap23-client

#make config

#make install clean

---------------------------

#cd /usr/ports/net/phpldapadmin

#make install clean

---------------------------

#cd /usr/ports/www/squid

#make config

เลือก
squid_ldap_auth
SQUID_IDENT
SQUID_REFERER_LOG
SQUID_USERAGENT_LOG
SQUID_ARP_ACL

#make install clean

-----------------------------------------
Chillispot
http://mrkohkoh.exteen.com/20061010/freebsd-6-1
http://www.howtoforge.com/forums/showthread.php?t=2441
chillispot webboard + log พรบ
http://mamboeasy.psu.ac.th/~wiboon.w/content/category/5/23/40/
Setup a proxy server with web content filtering: squid+rejik+squint+sqstat

http://www.video4admin.com/setup-a-proxy-server-with-web-content-filtering-squidrejiksquintsqstat.html





ลง ldap
http://www.bloggang.com/viewdiary.php?id=naigod&month=02-2006&date=12&group=4&gblog=34


### ลง sarg ดู stat

#Cd /usr/ports/www/sarg

#Make install clean
-----------------------------------------------------------
การปรับปรุง SARG ให้รายงานผลเป็น Daily/Weekly/Monthly
เขียนโดย kom เมื่อ อาทิตย์, 09/23/2007 - 12:21.

 
ติดตั้ง Sarg Daily (SARG แสดงผลแบบรายวัน)
1. ดาวน์โหลดไฟล์จากที่นี่http://prdownloads.sourceforge.net/sarg/sarg-2.0.9.tar.gz?download
2. ติดตั้งตามขั้นตอนดังนี้
www # gzip -cd sarg-2.0.9.tar.gz | tar xvf –
www # cd sarg-2.0.9
www # ./configure --enable-htmldir=/usr/local/www/apache22/data
www # make
www # make install
การติดตั้งนี้มันจะติดตั้งไฟล์ทั้งหมด ยกเว้น ตัวที่ใช้รัน ไปไว้ที่ /usr/local/sarg
จะเสร็จขั้นตอนการติดตั้ง ต่อไปจะเป็นการปรับแต่ง
cd /usr/local/sarg
pico sarg.conf
แก้บรรทัดต่อไปนี้ ให้มีส่วนที่ต้องตั้งค่าดังต่อไปนี้
access_log /usr/local/squid/var/logs/access.log ที่เก็บ log ของ squid
output_dir /usr/local/www/apache22/data/sarg ตรงนี้จะตั้งเป็นชื่ออะไรก็ได้ครับ
resolve_ip no ตรงนี้ถ้าต้องการให้แสดงชื่อเครื่องแทนเบอร์ ip ก็ให้เปลี่ยนเป็น yes ครับ
user_ip yes ตรงนี้สำหรับเซ็ตให้ใช้ ip แทน user id ครับ
remove_temp_files yes ตั้งค่าให้ลบไฟล์ชั่วคราวอัตโนมัติ
index yes ตั้งค่าให้ใส่ไฟล์ index.html อัตโนมัติใน sub folder
overwrite_report no ตั้งค่าให้เขียนรายงานทับอัตโนมัติ ปกติจะเป็น no (ถ้าต้องการทดสอบการทำงาน ให้ตั้งเป็น yes ครับ)
records_without_userid ip ตั้งค่าให้ใช้ ip หากไม่มี user id
use_comma yes ใช้เครื่องหมายลูกน้ำคั่นหลักพัน
mail_utility mail กำหนดโปรแกรมที่ใช้ส่งอีเมล
displayed_values abbreviation กำหนดให้ใช้หน่วย K M แทนการแสดงผลเป็นหน่วย byte ตรงๆ ครับ
www_document_root /usr/local/www/apache22/data/sarg กำหนดที่เก็บไฟล์ html ของ apache ครับ
ดาวน์โหลด Script จาก
http://www.initzero.it/products/opensource/sarg-reports/download/sarg-reports
- แก้ชื่อไฟล์เป็น sarg.report
- copy ไปไว้ที่ /usr/local/bin/sarg.reports
- chmod 755 /usr/local/bin/sarg.reports
- แก้ไข script ส่วนต่างๆ เป็นดังนี้
## English Language
SARG=/usr/local/bin/sarg # ที่อยู่ของ sarg
CONFIG=/usr/local/etc/sarg/sarg.conf # ที่อยู่ของ config file
HTMLOUT=/usr/local/www/sarg # ที่อยู่ของ sarg ใน apache
PAGETITLE="sarg-reports for $(hostname)" # Title ที่จะให้แสดงในหน้าแรกของ script
LOGOIMG=/usr/local/etc/sarg/images/sarg.png # Logo สำหรับหน้าแรกของ script
LOGOLINK=http://sarg.sourceforge.net/ # Link เมื่อคลิกที่โลโก้
DAILY=Daily # ข้อความในหน้าแรกของ script Daily ปิดได้ เมื่อไม่ใช้งาน
WEEKLY=Weekly # ข้อความในหน้าแรกของ script Weekly ปิดได้ เมื่อไม่ใช้งาน
MONTHLY=Monthly # ข้อความในหน้าแรกของ script Monthly ปิดได้ เมื่อไม่ใช้งาน
EXCLUDELOG1="SARG: Records not found."
EXCLUDELOG2="SARG: Fine"
- เพิ่มการทำงานของ script ใน crontab ตามการใช้งานที่ต้องการ
- คำสั่ง crontab-e
00 08-18/1 * * * /usr/local/bin/sarg.reports today
00 00 * * * /usr/local/bin/sarg.reports daily
00 01 * * 1 /usr/local/bin/sarg.reports weekly
30 02 1 * * /usr/local/bin/sarg.reports monthly
- ทดลองเรียก script เพื่อสร้างรายงาน
ด้วยคำสั่ง
/usr/local/bin/sarg.reports daily
- หรือรอให้ crontab ทำงานตามเวลาที่ตั้ง

golfreeze

  • Administrator
  • Hero Member
  • *****
  • Posts: 2141
    • View Profile
    • นั่งสมาธิ สติปัฏฐานสี่ พาเที่ยววัด แนะนำวัด แจกcd ธรรมะฟรี
    • Email
Re: install squid support sarg on freebsd 7.0
« Reply #1 on: กรกฎาคม 26, 2011, 05:31:27 PM »
ต้องการที่จะ by-pass url เหล่านี้ โดยที่ user ไม่ต้องทำ authentication ผ่าน squid ครับ

ใช้ในกรณี url เป็นพวก auto update , window update ไรงี้ ครับ

เข้าไปแก้ไขไฟล์ /etc/squid/squid.conf

# Allow a user accessing particular site without authentication required
acl updateSites dstdomain .oscex-en.url.trendmicro.com .osce10.icrc.trendmicro.com .activeupdate.trendmicro.com
acl updateSites dstdomain .desktop.google.com .desktop5.google.com .desktop2.google.com
acl updateSites dstdomain .microsoft.com
acl updateSites dstdomain .windowsupdate.com .wustat.windows.com
acl updateSites dstdomain .webroot.com
acl updateSites dstdomain .adobe.com
http_access allow updateSites


#squid -k reconfigure

ก็เรียบร้อยครับ
« Last Edit: กรกฎาคม 26, 2011, 05:33:02 PM by golfreeze »

golfreeze

  • Administrator
  • Hero Member
  • *****
  • Posts: 2141
    • View Profile
    • นั่งสมาธิ สติปัฏฐานสี่ พาเที่ยววัด แนะนำวัด แจกcd ธรรมะฟรี
    • Email
Re: install squid support sarg on freebsd 7.0
« Reply #2 on: กรกฎาคม 26, 2011, 05:35:48 PM »
ถ้าต้องการทำการ block msn ใน office ที่มี proxy เป็น squid สามารถจัดการได้ดังนี้ครับ

1. เปิดไฟล์ squid.conf
# vi /etc/squid/squid.conf
2. เพิ่มบรรทัด
acl MSN req_mime_type ^application/x-msn-messenger$
ให้เลื่อนมาแถวบรรทัดที่เขียนว่า
# http_access allow configuration
ให้เพิ่มบรรทัดนี้ข้างล่างนี้เข้าไป
http_access deny MSN
3. ทำการ save
4. ทำการ reload squid
#squid -k reconfigure