【问题标题】:How to configure Squid to return custom error pages based on result of eCAP adapters?如何配置 Squid 以根据 eCAP 适配器的结果返回自定义错误页面?
【发布时间】:2017-11-10 06:41:12
【问题描述】:

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/。目前,我不是在错误页面上查找病毒详细信息,它可以是任何静态页面。

提前致谢!

【问题讨论】:

    标签: proxy configuration http-proxy squid icap


    【解决方案1】:

    我找到了解决方案:

    /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 是要显示的自定义页面。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-03-21
      • 1970-01-01
      • 1970-01-01
      • 2013-03-20
      • 2013-10-24
      • 1970-01-01
      相关资源
      最近更新 更多