security

راه اندازی Web Analyzer در IBSng A1.24

امتیاز کاربران

ستاره فعالستاره فعالستاره فعالستاره غیر فعالستاره غیر فعال
 

در این مقاله راه اندازی Web Analyzer در IBSng ( Centos) می پردازیم بر فرض اینکه که کاربر ها بر روی روتر میکروتیک می باشند.

مثال :

رنج IP کاربران ما ۱۹۲.۱۶۸.۵۰.۰/۲۴ هست و IP اکانتینگ IBSng 192.168.0.29

 

در میکروتیک

ابتدا نوشتن یک منگل برای مارک کردن بسته های وب در میکروتیک

/ip firewall mangle

add action=mark-routing chain=prerouting comment="" disabled=no dst-port=80 new-routing-mark=Cache passthrough=yes protocol=tcp src-address=192.168.50.0/24

 

رنج IP کاربران و اکانتینگ رو در NAT قرار میدیدم

/ip firewall nat

add action=masquerade chain=srcnat comment="" disabled=no src-address=192.168.0.29

add action=masquerade chain=srcnat comment="" disabled=no src-address=192.168.50.0/24

 

نکته :

ترافیک وب سایت ها رو از حالت نت در بیارید

/ip firewall nat

add action=accept chain=srcnat disabled=no dst-port=80 protocol=tcp src-address=192.168.50.0/24

 

روت کردن ترافیک ارسالی به IBSng در میکروتیک

/ip route

add disabled=no distance=1 dst-address=0.0.0.0/0 gateway=192.168.0.29 routing-mark=Cache scope=30 target-scope=10

 

در IBSng ( Centos)

ابتدا بسته اسکوید رو نصب کنید

yum install squid

chkconfig squid on

 

فایل squid.conf به شرح زیر تغییر بدید

### Squid normally listens to port 3128
http_port 3128 transparent

### Recommended minimum configuration:
acl manager proto cache_object
acl localhost src 127.0.0.1/32
acl to_localhost dst 127.0.0.0/8

### Access Control List
acl users src 192.168.50.0/24

### Recommended minimum Access Permission configuration:
# Only allow cachemgr access from localhost
http_access allow users
http_access allow manager localhost
http_reply_access allow all

### LOGS
access_log /var/log/squid/access.log squid

 

 

squid analyzer در IBSng رو اجرا و حالت Auto رو انتخاب کنید

usr/local/IBSng/addons/squid_analyzer/setup.sh

 

نکته :

اگر به صورت Auto اجرا نشد از حالت دستی استفاده کنید

cd /usr/local/IBSng/addons/squid_analyzer/

cp init.d/squid_analyzer /etc/init.d

chkconfig --add squid_analyzer

chkconfig squid_analyzer on

cd /usr/local/IBSng/addons/squid_analyzer/logrotate.d

cp squid /etc/logrotate.d

cp squid_analyzer /etc/logrotate.d

حالا سرویس های مورد نظر را استارت کنید

/etc/init.d/squid_analyzer start

/etc/init.d/squid start

اعمال قوانین بر روی iptables لینوکس شما

iptables -t nat -A POSTROUTING -s 192.168.50.0/24 -j MASQUERADE

iptables -A PREROUTING -t nat -s 192.168.50.0/24 -p tcp --dport 80 -j REDIRECT --to-port 3128

حتما این ip forward در لینوکس رو روشن کنید