簡體   English   中英

如何配置Squid以根據eCAP適配器的結果返回自定義錯誤頁面?

[英]How to configure Squid to return custom error pages based on result of eCAP adapters?

eCAP適配器在squid.conf配置為:

acl bypass_scan_types_req req_mime_type -i ^text/     
acl bypass_scan_types_req req_mime_type -i ^application/x-javascript 
acl bypass_scan_types_req req_mime_type -i ^application/x-shockwave-flash  
acl bypass_scan_types_req req_mime_type -i ^image/ 
acl bypass_scan_types_req req_mime_type -i ^video     
acl bypass_scan_types_req req_mime_type -i ^audio 

acl bypass_scan_types_req req_mime_type -i ^.*application\/x-mms-framed.*$
acl bypass_scan_types_rep rep_mime_type -i ^text/ 
acl bypass_scan_types_rep rep_mime_type -i ^application/x-javascript 
acl bypass_scan_types_rep rep_mime_type -i ^application/x-shockwave-flash 
acl bypass_scan_types_rep rep_mime_type -i ^image/ 
acl bypass_scan_types_rep rep_mime_type -i ^video 
acl bypass_scan_types_rep rep_mime_type -i ^audio 
acl bypass_scan_types_rep rep_mime_type -i ^.*application\/x-mms-framed.*$

loadable_modules /usr/local/lib/ecap_clamav_adapter.so 

ecap_service clamav_service_req reqmod_precache uri=ecap://e-cap.org/ecap/services/clamav?mode=REQMOD bypass=off 
ecap_service clamav_service_resp respmod_precache uri=ecap://e-cap.org/ecap/services/clamav?mode=RESPMOD bypass=on 

adaptation_access clamav_service_req allow !bypass_scan_types_req all 
adaptation_access clamav_service_resp allow !bypass_scan_types_rep all

如果檢測到病毒,適配器將返回一些病毒詳細信息,並且Squid會生成默認錯誤頁面。 我想顯示自定義錯誤頁面,而不是默認頁面。

我嘗試通過添加deny_info嘗試,但在這種情況下我不知道該如何指定acl 我嘗試的deny_info是:

deny_info custom_error.html <my_acl_here>

custom_error.html是存在的~/ecap/squid-XXXX/errors/en/ 目前,我不在錯誤頁面上查找病毒詳細信息,它可以是任何靜態頁面。

提前致謝!

我發現解決方案為:

/usr/local/squid/share/errors/templates/ERR_ANY_NAME創建一個頁面。 然后在squid.conf的末尾添加以下行:

deny_info ERR_ANY_NAME clamav_service_req

clamav_service_reqecap_service指令中給出的相同,並且ERR_ANY_NAME是要顯示的自定義頁面。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM