PDA

توجه ! این یک نسخه آرشیو شده میباشد و در این حالت شما عکسی را مشاهده نمیکنید برای مشاهده کامل متن و عکسها بر روی لینک مقابل کلیک کنید : آموزش اسکویید قدم به قدم قسمت چهارم :انواع access-list



hadi-110
December 8th, 2012, 19:04
Regular Expression match of requested domain

برای ***** کردن url هایی که نمی خواهیم حاوی یک یا چند کلمه باشن:
کد PHP:
acl badUrl url_regex -i nami.
i- برای اینه که چون پیش فرض case sensitive هست با این پارامتر insensitive میشه

acl badUrl url_regex -i \.avi
این هم که مشخصه

میشه جفتشون رو یکجا نوشت:
acl badUrl url_regex -i nami.\*\.avi

که در آخر با این دستور ***** میشن:
http_access deny badUrl

acl filterlist url_regex -i /etc/squid/blacklist

داخل این فایل می تونید url های مورد نظر رو بزارید


MIME type

*****ینگ میتونه بر اساس mime type باشه

کد PHP:
acl mp3 reg_mime_type "audio/mp3"

Current time/date


میشه acl رو بر اساس زمان نوشت:
کد PHP:
acl name time [day-list] [start_hour:minute-end_hour:minute

S – Sunday, M – Monday,T – Tuesday, W – Wednesday, H – Thursday
F – Friday, A – Saturday

مثلا :
acl saate-edari time ASMTW 8:00-16:00
http_access allow saate-edari



Destination port


پورتهای مقصد که کاربران اجازه دسترسی دارند
acl Safe_ports port 80 21 443 563 70 210 1025-65535
و بقیه بلاک میشن با دستور زیر :

http_access deny !Safe_ports

****نکته: علامت ! یعنی به جز (کل دستور یعنی همه بسته بجز safe ports


Method


متد get برای دانلود
متد post برای آپلود
متد connect برای ssl

مثال :
acl connect_method method CONNECT
acl SSL_PORTS port 443 563
http_access deny connect_method !SSL_PORTS

یعنی به کانکشن های غیر ssl اجازه دسترسی نمیده

Browser type

میشه acl رو بر اساس browser کاربر ها نوشت که مثلا با firefox بشه با ie نشه

acl aclname browser MOZILLA

***** خدایی تا کجا هارو فکر کردن ***********



Username


ident_lookup on
acl friends omid mohsen reza morteza
http_access allow friends
http_access deny all

میتونید اسمهای مورد نظر رو بدید که از روی دستگاه مقصد auth میشن

***** زیاد در مورد نحوه احراز هویت این مورد اطلاعی ندارم


Autonomous System (AS) Number



Squid is often used by large ISPs. These ISPs want all of their customers to have access to their caches without having incredibly long manually-maintained ACL lists (don't forget that such long lists of IPs generally increase the CPU usage of Squid too). Large ISP's all have AS (Autonomous System) numbers which are used by other Internet routers which run the BGP (Border Gateway Protocol) routing protocol.
The whois server whois.ra.net keeps a (supposedly authoritive) list of all the IP ranges that are in each AS. Squid can query this server and get a list of all IP addresses that the ISP controls, reducing the number of rules required. The data returned is also stored in a radix tree, for more cpu-friendly retrieval.
Sometimes the whois server is updated only sporadically. This could lead to problems with new networks being denied access incorrectly. It's probably best to automate the process of adding new IP ranges to the whois server if you are going to use this function.
If your region has some sort of local whois server that handles queries in the same way, you can use the as_whois_server Squid config file option to query a different server.
**** اینم برای isp دار ها خوشون ترجمه کنن زیاده



Username and Password

روشهای مختلفی برای ***** کردن یوزرها هست مثلا smb-خواندن از روی فایل و ....
من خودم از ntlm استفاده کردم برای خوندن یوزرهای AD



Using the NCSA authentication module

اینم روش جالبیه برای خوندن یوزر و پسوردها از روی یک فایل:
داخل squid.conf اضافه میکنیم:
authenticate_program /usr/local/squid/bin/ncsa_auth /usr/local/squid/etc/passwd

فایل passwd رو در مسیر بالا میسازیم و با فرمت زیر یوزر اضافه میکنیم:

nami:lKdpxbNzhlo.w


Using the RADIUS authentication module


acl external_traffic *****_auth REQUIRED
http_access allow external_traffic
auth_param basic program /usr/local/squid/libexec/squid_radius_auth -f /usr/local/squid/etc/squid_radius_auth.conf
auth_param basic children 5
auth_param basic realm This is the realm
auth_param basic credentialsttl 45 minutes


acl بازهم هست ولی کمتر مورد استفاده قرار میگیره و موردی هست

**** مثالهایی هم که نوشتم فقط نمونه خیلی کوچکی از نحوه syntax نوشتن اونهاست و میشه هزاران جور دیگه تغییر داد یا ترکیب کرد و اینجا فقط به سر فصل اشاره شد.




refresh pattern ها

مشخص میکنند که چه چیزهایی باید کش بشن و تا چه مدت و اینکار رو با خوندن هدری که در html قرار داده میشه میغهمه ولی خیلی سایتها از tag default استفاده میکنن و زیاد توی سرعت باز شدن اینگونه سایتها تاثیری حاصل نمیشه

نمونه های زیادی از refresh pattern توی اینترنت هست و با یاد***ی روش میشه دستی هم نوشت:

کد PHP:
refresh_pattern [-i] regex min percent max [options]
refresh_pattern -i \.gif$ 1440 20% 10080

نمونه:

کد PHP:
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern -i .(gif|png|jpg|jpeg|ico)$ 10080 90% 43200 override-expire ignore-no-cache ignore-no-store ignore-private
refresh_pattern -i .(iso|avi|wav|mp3|mp4|mpeg|swf|flv|x-flv)$ 43200 90% 432000 override-expire ignore-no-cache ignore-no-store ignore-private
refresh_pattern -i .(deb|rpm|exe|zip|tar|tgz|ram|rar|bin|ppt|doc|tif f)$ 10080 90% 43200 override-expire ignore-no-cache ignore-no-store ignore-private
refresh_pattern -i .index.(html|htm)$ 0 40% 10080
refresh_pattern -i .(html|htm|css|js)$ 1440 40% 40320
refresh_pattern . 0 40% 40320
********مهم

داینامیک content ها رو کش نمیکنه مثلا عکسهای کوچک کد امنیتی:

کد PHP:
refresh_pattern (/cgi-bin/|?) 0 0% 0
پایان
اگه مفید بود دکمه تشکر رو بفشارید

hadi-110
December 10th, 2012, 08:07
مرسی. استفاده بردم

بهتر نبود بجای نوشتن این جمله دکمه تشکر رامیفشردید؟