如何根据 eCAP 适配器的结果将 Squid 配置为 return 自定义错误页面?
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
如果检测到病毒,适配器 returns 一些病毒详细信息和 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_req
与 ecap_service
指令中给出的相同,ERR_ANY_NAME
是要显示的自定义页面。
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
如果检测到病毒,适配器 returns 一些病毒详细信息和 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_req
与 ecap_service
指令中给出的相同,ERR_ANY_NAME
是要显示的自定义页面。