*** Settings *** Force Tags tsg_adc_wp adc_api security_policy Library OperatingSystem Resource ../../../02-Keyword/tsg_adc/SystemCommand.robot Resource ../../../02-Keyword/tsg_bfapi/PolicyObject.robot Resource ../../../02-Keyword/tsg_bfapi/LogVariable.robot Resource ../../../02-Keyword/tsg_adc/FileOperation.robot Resource ../../../02-Keyword/tsg_adc/FileOperation.robot Resource ../../../02-Keyword/tsg_bfapi/policy_object/Policy.robot *** Variables *** ${url} /v1/policy/profile/responsepages *** Test Cases *** SecurityPolicy-Deny-Http-00001 [Tags] fqdn Comment 创建fqdn ${objectDict} Create Dictionary objectType=fqdn isValid=${1} addItemList=$webalta.ru ${rescode} ${objectId} AddObject2 ${1} ${objectDict} Comment 创建安全策略 ${policyDict} Create Dictionary policyName=SecurityPolicy-Deny-Http-00001 policyType=tsg_security policyDesc=autotest action=deny userRegion={"protocol":"HTTP","method":"drop"} filterList=${objectId}|TSG_FIELD_HTTP_HOST isValid=${1} appIdObjects=2 log ${policyDict} ${rescode} ${policyId} AddPolicies 1 ${policyDict} v2 insert_policyId_to_file1 deny_http_objectId ${objectId} insert_policyId_to_file1 deny_http_policyId ${policyId} SecurityPolicy-Deny-Http-00002 [Tags] cat Comment 创建cat ${objectDict} Create Dictionary objectType=fqdn_category isValid=${1} addItemList=*nymbler.com ${rescode} ${objectId} AddObject2 ${1} ${objectDict} Comment 创建安全策略 ${policyDict} Create Dictionary policyName=SecurityPolicy-Deny-Http-00002 policyType=tsg_security policyDesc=autotest action=deny userRegion={"protocol":"HTTP","method":"rst"} filterList=${objectId}|TSG_FIELD_HTTP_HOST isValid=${1} appIdObjects=2 log ${policyDict} ${rescode} ${policyId} AddPolicies 1 ${policyDict} v2 insert_policyId_to_file1 deny_http_objectId1 ${objectId} insert_policyId_to_file1 deny_http_policyId1 ${policyId} SecurityPolicy-Deny-Http-00003 [Tags] url Comment 创建url ${objectDict} Create Dictionary objectType=url isValid=${1} addItemList=*/news/,$www.icbc.com.cn/icbc/,www.gotohoroscope*,indexv ${rescode} ${objectId} AddObject2 ${1} ${objectDict} #创建引用文件 ${response} CreatePolicyFile2 ${url} ${responsePageFiles} 404english.html resPages ${profiledId} Get From Dictionary ${response} profileId Comment 创建安全策略 ${policyDict} Create Dictionary policyName=SecurityPolicy-Deny-Http-00003 policyType=tsg_security policyDesc=autotest action=deny userRegion={"protocol":"HTTP","method":"block","code":403,"html_profile":${profiledId}} filterList=${objectId}|TSG_FIELD_HTTP_URL isValid=${1} appIdObjects=2 log ${policyDict} ${rescode} ${policyId} AddPolicies 1 ${policyDict} v2 insert_policyId_to_file1 deny_http_objectId2 ${objectId} insert_policyId_to_file1 deny_http_policyId2 ${policyId} insert_policyId_to_file1 deny_http_profiledId ${profiledId} SecurityPolicy-Deny-Http-00004 [Tags] 请求头 Comment 创建请求头 ${objectDict} Create Dictionary objectType=http_signature isValid=${1} addItemList=Mozilla/5.0*|User-Agent ${rescode} ${objectId} AddObject2 ${1} ${objectDict} Comment 创建url ${objectDict} Create Dictionary objectType=url isValid=${1} addItemList=*sveden ${rescode} ${object_url_Id} AddObject2 ${1} ${objectDict} Comment 创建安全策略 ${policyDict} Create Dictionary policyName=SecurityPolicy-Deny-Http-00004 policyType=tsg_security policyDesc=autotest action=deny userRegion={"protocol":"HTTP","method":"block","code":404,"message":"yyyyy"} filterList=${objectId}|TSG_FIELD_HTTP_REQ_HDR,${object_url_Id}|TSG_FIELD_HTTP_URL isValid=${1} appIdObjects=2 log ${policyDict} ${rescode} ${policyId} AddPolicies 1 ${policyDict} v2 insert_policyId_to_file1 deny_http_objectId3 ${object_url_Id} insert_policyId_to_file1 deny_http_objectId4 ${objectId} insert_policyId_to_file1 deny_http_policyId3 ${policyId} SecurityPolicy-Deny-Http-00005 [Tags] 请求头 Comment 创建请求头 ${objectDict} Create Dictionary objectType=http_signature isValid=${1} addItemList=$Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML like Gecko) Chrome/31.0.1650.63 Safari/537.36|User-Agent ${rescode} ${objectId} AddObject2 ${1} ${objectDict} Comment 创建url ${objectDict} Create Dictionary objectType=url isValid=${1} addItemList=*a.com/cn/ ${rescode} ${object_url_Id} AddObject2 ${1} ${objectDict} Comment 创建安全策略 ${policyDict} Create Dictionary policyName=SecurityPolicy-Deny-Http-00005 policyType=tsg_security policyDesc=autotest action=deny userRegion={"protocol":"HTTP","method":"drop"} filterList=${objectId}|TSG_FIELD_HTTP_REQ_HDR,${object_url_Id}|TSG_FIELD_HTTP_URL isValid=${1} appIdObjects=2 log ${policyDict} ${rescode} ${policyId} AddPolicies 1 ${policyDict} v2 insert_policyId_to_file1 deny_http_objectId5 ${object_url_Id} insert_policyId_to_file1 deny_http_objectId6 ${objectId} insert_policyId_to_file1 deny_http_policyId4 ${policyId} SecurityPolicy-Deny-Http-00006 [Tags] 请求头 Comment 创建请求头 ${objectDict} Create Dictionary objectType=http_signature isValid=${1} addItemList=AppleWebKit|User-Agent ${rescode} ${objectId} AddObject2 ${1} ${objectDict} Comment 创建url ${objectDict} Create Dictionary objectType=url isValid=${1} addItemList=*vel/ru ${rescode} ${object_url_Id} AddObject2 ${1} ${objectDict} Comment 创建安全策略 ${policyDict} Create Dictionary policyName=SecurityPolicy-Deny-Http-00006 policyType=tsg_security policyDesc=autotest action=deny userRegion={"protocol":"HTTP","method":"alert","code":200,"message":"网站被阻断"} filterList=${objectId}|TSG_FIELD_HTTP_REQ_HDR,${object_url_Id}|TSG_FIELD_HTTP_URL isValid=${1} appIdObjects=2 log ${policyDict} ${rescode} ${policyId} AddPolicies 1 ${policyDict} v2 insert_policyId_to_file1 deny_http_objectId7 ${object_url_Id} insert_policyId_to_file1 deny_http_objectId8 ${objectId} insert_policyId_to_file1 deny_http_policyId5 ${policyId} SecurityPolicy-Deny-Http-00007 [Tags] 请求头 Comment 创建请求头 ${objectDict} Create Dictionary objectType=http_signature isValid=${1} addItemList=*Safari/537.36|User-Agent ${rescode} ${objectId} AddObject2 ${1} ${objectDict} Comment 创建url ${objectDict} Create Dictionary objectType=url isValid=${1} addItemList=*destinations ${rescode} ${object_url_Id} AddObject2 ${1} ${objectDict} #创建引用文件 ${response} CreatePolicyFile2 ${url} ${responsePageFiles} 404china.html resPages ${profiledId} Get From Dictionary ${response} profileId Comment 创建安全策略 ${policyDict} Create Dictionary policyName=SecurityPolicy-Deny-Http-00007 policyType=tsg_security policyDesc=autotest action=deny userRegion={"protocol":"HTTP","method":"alert","code":200,"html_profile":${profiledId}} filterList=${objectId}|TSG_FIELD_HTTP_REQ_HDR,${object_url_Id}|TSG_FIELD_HTTP_URL isValid=${1} appIdObjects=2 log ${policyDict} ${rescode} ${policyId} AddPolicies 1 ${policyDict} v2 insert_policyId_to_file1 deny_http_objectId9 ${object_url_Id} insert_policyId_to_file1 deny_http_objectId10 ${objectId} insert_policyId_to_file1 deny_http_policyId6 ${policyId} insert_policyId_to_file1 deny_http_profiledId1 ${profiledId} SecurityPolicy-Deny-Http-00008 [Tags] 应答头 Comment 创建url ${objectDict} Create Dictionary objectType=url isValid=${1} addItemList=*index.aspx ${rescode} ${object_url_Id} AddObject2 ${1} ${objectDict} Comment 创建应答头 ${objectDict} Create Dictionary objectType=http_signature isValid=${1} addItemList=*utf-8|Content-Type ${rescode} ${objectId} AddObject2 ${1} ${objectDict} Comment 创建安全策略 ${policyDict} Create Dictionary policyName=SecurityPolicy-Deny-Http-00008 policyType=tsg_security policyDesc=autotest action=deny userRegion={"protocol":"HTTP","method":"rst"} filterList=${objectId}|TSG_FIELD_HTTP_RES_HDR,${object_url_Id}|TSG_FIELD_HTTP_URL isValid=${1} appIdObjects=2 log ${policyDict} ${rescode} ${policyId} AddPolicies 1 ${policyDict} v2 insert_policyId_to_file1 deny_http_objectId11 ${object_url_Id} insert_policyId_to_file1 deny_http_objectId12 ${objectId} insert_policyId_to_file1 deny_http_policyId7 ${policyId} SecurityPolicy-Deny-Http-00009 [Tags] 应答头 Comment 创建url ${objectDict} Create Dictionary objectType=url isValid=${1} addItemList=www.skycn.com ${rescode} ${object_url_Id} AddObject2 ${1} ${objectDict} Comment 创建应答头 ${objectDict} Create Dictionary objectType=http_signature isValid=${1} addItemList=$text/html|Content-Type ${rescode} ${objectId} AddObject2 ${1} ${objectDict} Comment 创建安全策略 ${policyDict} Create Dictionary policyName=SecurityPolicy-Deny-Http-00009 policyType=tsg_security policyDesc=autotest action=deny userRegion={"protocol":"HTTP","method":"drop"} filterList=${objectId}|TSG_FIELD_HTTP_RES_HDR,${object_url_Id}|TSG_FIELD_HTTP_URL isValid=${1} appIdObjects=2 log ${policyDict} ${rescode} ${policyId} AddPolicies 1 ${policyDict} v2 insert_policyId_to_file1 deny_http_objectId13 ${object_url_Id} insert_policyId_to_file1 deny_http_objectId14 ${objectId} insert_policyId_to_file1 deny_http_policyId8 ${policyId} SecurityPolicy-Deny-Http-00010 [Tags] 应答头 Comment 创建url ${objectDict} Create Dictionary objectType=url isValid=${1} addItemList=www.avaxsearch.com ${rescode} ${object_url_Id} AddObject2 ${1} ${objectDict} Comment 创建应答头 ${objectDict} Create Dictionary objectType=http_signature isValid=${1} addItemList=text/html|Content-Type ${rescode} ${objectId} AddObject2 ${1} ${objectDict} Comment 创建安全策略 ${policyDict} Create Dictionary policyName=SecurityPolicy-Deny-Http-00010 policyType=tsg_security policyDesc=autotest action=deny userRegion={"protocol":"HTTP","method":"drop"} filterList=${objectId}|TSG_FIELD_HTTP_RES_HDR,${object_url_Id}|TSG_FIELD_HTTP_URL isValid=${1} appIdObjects=2 log ${policyDict} ${rescode} ${policyId} AddPolicies 1 ${policyDict} v2 insert_policyId_to_file1 deny_http_objectId15 ${object_url_Id} insert_policyId_to_file1 deny_http_objectId16 ${objectId} insert_policyId_to_file1 deny_http_policyId9 ${policyId} SecurityPolicy-Deny-Http-00011 [Tags] 应答头 Comment 创建url ${objectDict} Create Dictionary objectType=url isValid=${1} addItemList=finestquotes.com ${rescode} ${object_url_Id} AddObject2 ${1} ${objectDict} Comment 创建应答头 ${objectDict} Create Dictionary objectType=http_signature isValid=${1} addItemList=text*|Content-Type ${rescode} ${objectId} AddObject2 ${1} ${objectDict} Comment 创建安全策略 ${policyDict} Create Dictionary policyName=SecurityPolicy-Deny-Http-00010 policyType=tsg_security policyDesc=autotest action=deny userRegion={"protocol":"HTTP","method":"drop"} filterList=${objectId}|TSG_FIELD_HTTP_RES_HDR,${object_url_Id}|TSG_FIELD_HTTP_URL isValid=${1} appIdObjects=2 log ${policyDict} ${rescode} ${policyId} AddPolicies 1 ${policyDict} v2 insert_policyId_to_file1 deny_http_objectId17 ${object_url_Id} insert_policyId_to_file1 deny_http_objectId18 ${objectId} insert_policyId_to_file1 deny_http_policyId10 ${policyId} SecurityPolicy-Deny-Http-00012 [Tags] cookie Comment 创建cookie ${objectDict} Create Dictionary objectType=http_signature isValid=${1} addItemList=_ym_isad=2|Cookie ${rescode} ${objectId} AddObject2 ${1} ${objectDict} Comment 创建安全策略 ${policyDict} Create Dictionary policyName=SecurityPolicy-Deny-Http-00012 policyType=tsg_security policyDesc=autotest action=deny userRegion={"protocol":"HTTP","method":"block","code":404,"message":"马上到周末"} filterList=${objectId}|TSG_FIELD_HTTP_REQ_HDR isValid=${1} appIdObjects=2 log ${policyDict} ${rescode} ${policyId} AddPolicies 1 ${policyDict} v2 insert_policyId_to_file1 deny_http_objectId19 ${objectId} insert_policyId_to_file1 deny_http_policyId11 ${policyId} SecurityPolicy-Deny-Http-00013 [Tags] set-cookie Comment 创建set-cookie ${objectDict} Create Dictionary objectType=http_signature isValid=${1} addItemList=CURRENT_CITY_CODE*|Set-Cookie,*domain=.xiaozhu.com|Set-Cookie,PHPSESSID|Set-Cookie,oKD0_802a*|Set-Cookie ${rescode} ${objectId} AddObject2 ${1} ${objectDict} Comment 创建安全策略 ${policyDict} Create Dictionary policyName=SecurityPolicy-Deny-Http-00013 policyType=tsg_security policyDesc=autotest action=deny userRegion={"protocol":"HTTP","method":"drop"} filterList=${objectId}|TSG_FIELD_HTTP_RES_HDR isValid=${1} appIdObjects=2 log ${policyDict} ${rescode} ${policyId} AddPolicies 1 ${policyDict} v2 insert_policyId_to_file1 deny_http_objectId20 ${objectId} insert_policyId_to_file1 deny_http_policyId12 ${policyId} SecurityPolicy-Deny-Http-00014 [Tags] 请求体 Comment 创建请求体 ${objectDict} Create Dictionary objectType=keywords isValid=${1} addItemList=test ${rescode} ${objectId} AddObject2 ${1} ${objectDict} Comment 创建安全策略 ${policyDict} Create Dictionary policyName=SecurityPolicy-Deny-Http-00014 policyType=tsg_security policyDesc=autotest action=deny userRegion={"protocol":"HTTP","method":"drop"} filterList=${objectId}|TSG_FIELD_HTTP_REQ_CONTENT isValid=${1} appIdObjects=2 log ${policyDict} ${rescode} ${policyId} AddPolicies 1 ${policyDict} v2 insert_policyId_to_file1 deny_http_objectId21 ${objectId} insert_policyId_to_file1 deny_http_policyId13 ${policyId} SecurityPolicy-Deny-Http-00015 [Tags] 应答体 Comment 创建应答体 ${objectDict} Create Dictionary objectType=keywords isValid=${1} addItemList=华彤公司 ${rescode} ${objectId} AddObject2 ${1} ${objectDict} Comment 创建安全策略 ${policyDict} Create Dictionary policyName=SecurityPolicy-Deny-Http-00015 policyType=tsg_security policyDesc=autotest action=deny userRegion={"protocol":"HTTP","method":"drop"} filterList=${objectId}|TSG_FIELD_HTTP_RES_CONTENT isValid=${1} appIdObjects=2 log ${policyDict} ${rescode} ${policyId} AddPolicies 1 ${policyDict} v2 insert_policyId_to_file1 deny_http_objectId22 ${objectId} insert_policyId_to_file1 deny_http_policyId14 ${policyId} SecurityPolicy-Deny-Http-00016 [Tags] 最大组合1 Comment 创建fqdn ${objectDict} Create Dictionary objectType=fqdn isValid=${1} addItemList=*open.node.com ${rescode} ${object_fqdn_Id} AddObject2 ${1} ${objectDict} Comment 创建url ${objectDict} Create Dictionary objectType=url isValid=${1} addItemList=*action ${rescode} ${object_url_Id} AddObject2 ${1} ${objectDict} Comment 创建请求头 ${objectDict} Create Dictionary objectType=http_signature isValid=${1} addItemList=Mozilla/5.0*|User-Agent ${rescode} ${object_qq_Id} AddObject2 ${1} ${objectDict} Comment 创建应答头 ${objectDict} Create Dictionary objectType=http_signature isValid=${1} addItemList=charset|Content-Type ${rescode} ${object_yd_Id} AddObject2 ${1} ${objectDict} Comment 创建请求体 ${objectDict} Create Dictionary objectType=keywords isValid=${1} addItemList=qazxsw ${rescode} ${object_body_Id} AddObject2 ${1} ${objectDict} Comment 创建安全策略 ${policyDict} Create Dictionary policyName=SecurityPolicy-Deny-Http-00016 policyType=tsg_security policyDesc=autotest action=deny userRegion={"protocol":"HTTP","method":"drop"} filterList=${object_fqdn_Id}|TSG_FIELD_HTTP_HOST,${object_url_Id}|TSG_FIELD_HTTP_URL,${object_qq_Id}|TSG_FIELD_HTTP_REQ_HDR,${object_yd_Id}|TSG_FIELD_HTTP_RES_HDR,${object_body_Id}|TSG_FIELD_HTTP_REQ_CONTENT isValid=${1} appIdObjects=2 log ${policyDict} ${rescode} ${policyId} AddPolicies 1 ${policyDict} v2 insert_policyId_to_file1 deny_http_objectId23 ${object_fqdn_Id} insert_policyId_to_file1 deny_http_objectId24 ${object_url_Id} insert_policyId_to_file1 deny_http_objectId25 ${object_qq_Id} insert_policyId_to_file1 deny_http_objectId26 ${object_yd_Id} insert_policyId_to_file1 deny_http_objectId27 ${object_body_Id} insert_policyId_to_file1 deny_http_policyId15 ${policyId} SecurityPolicy-Deny-Http-00017 [Tags] 最大组合2 Comment 创建fqdn ${objectDict} Create Dictionary objectType=fqdn isValid=${1} addItemList=*smspunch.net ${rescode} ${object_fqdn_Id} AddObject2 ${1} ${objectDict} Comment 创建url ${objectDict} Create Dictionary objectType=url isValid=${1} addItemList=*send-free-sms.aspx ${rescode} ${object_url_Id} AddObject2 ${1} ${objectDict} Comment 创建cookie ${objectDict} Create Dictionary objectType=http_signature isValid=${1} addItemList=_ym_isad=2|Cookie ${rescode} ${object_qq_Id} AddObject2 ${1} ${objectDict} Comment 创建set-cookie ${objectDict} Create Dictionary objectType=http_signature isValid=${1} addItemList=NET_SessionId|Set-Cookie ${rescode} ${object_yd_Id} AddObject2 ${1} ${objectDict} Comment 创建应答体 ${objectDict} Create Dictionary objectType=keywords isValid=${1} addItemList=Cell No ${rescode} ${object_body_Id} AddObject2 ${1} ${objectDict} Comment 创建安全策略 ${policyDict} Create Dictionary policyName=SecurityPolicy-Deny-Http-00017 policyType=tsg_security policyDesc=autotest action=deny userRegion={"protocol":"HTTP","method":"drop"} filterList=${object_fqdn_Id}|TSG_FIELD_HTTP_HOST,${object_url_Id}|TSG_FIELD_HTTP_URL,${object_qq_Id}|TSG_FIELD_HTTP_REQ_HDR,${object_yd_Id}|TSG_FIELD_HTTP_RES_HDR,${object_body_Id}|TSG_FIELD_HTTP_RES_CONTENT isValid=${1} appIdObjects=2 log ${policyDict} ${rescode} ${policyId} AddPolicies 1 ${policyDict} v2 insert_policyId_to_file1 deny_http_objectId28 ${object_fqdn_Id} insert_policyId_to_file1 deny_http_objectId29 ${object_url_Id} insert_policyId_to_file1 deny_http_objectId30 ${object_qq_Id} insert_policyId_to_file1 deny_http_objectId31 ${object_yd_Id} insert_policyId_to_file1 deny_http_objectId32 ${object_body_Id} insert_policyId_to_file1 deny_http_policyId16 ${policyId}