Anons79 Mini Shell

Directory : /lib/python2.7/site-packages/ansible/modules/network/f5/
Upload File :
Current File : //lib/python2.7/site-packages/ansible/modules/network/f5/bigip_asm_policy_signature_set.pyc

�
�Udac@`s�ddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
mZddl
mZdd
l
mZy�ddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZWn�ek
r�ddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZnXdefd��YZdefd��YZ defd��YZ!defd��YZ"de"fd ��YZ#d!e"fd"��YZ$d#e%fd$��YZ&d%e%fd&��YZ'd'e%fd(��YZ(d)�Z)e*d*kr�e)�nd+S(,i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	certifiedtsupported_bys=
---
module: bigip_asm_policy_signature_set
short_description: Manages Signature Sets on ASM policy
description:
  - Manages Signature Sets on ASM policy.
version_added: 2.8
options:
  name:
    description:
      - Specifies the name of the signature sets to apply on or remove from the ASM policy.
      - Apart from built-in signature sets that ship with the device, users can use user created
        signature sets.
      - When C(All Response Signatures), configures all signatures in the attack signature
        pool that can review responses.
      - When C(All Signatures), configures all attack signatures in the attack signature pool.
      - When C(Apache Struts Signatures), configures signatures that target attacks against
        the Apache Struts web servers. Only available in version 13.x and up.
      - When C(Apache Tomcat Signatures), configures signatures that target attacks against
        the Apache Tomcat web servers. Only available in version 13.x and up.
      - When C(Cisco Signatures), configures signatures that target attacks against Cisco systems.
        Only available in version 13.x and up.
      - When C(Command Execution Signatures), configures signatures involving attacks perpetrated by executing commands.
      - When C(Cross Site Scripting Signatures), configures signatures that target attacks caused
        by cross-site scripting techniques.
      - When C(Directory Indexing Signatures), configures signatures targeting attacks that browse directory listings.
      - When C(Generic Detection Signatures), configures signatures targeting well-known
        or common web and application attacks.
      - When C(HTTP Response Splitting Signatures), configures signatures targeting attacks that
        take advantage of responses for which input values have not been sanitized.
      - When C(High Accuracy Detection Evasion Signatures), configures signatures with a high level of accuracy
        that produce few false positives when identifying evasion attacks. Only available in version 13.x and up.
      - When C(High Accuracy Signatures), configures signatures with a high level of accuracy
        that produce few false positives when identifying evasion attacks.
      - When C(IIS and Windows Signatures), configures signatures that target attacks against IIS
        and Windows based systems. Only available in version 13.x and up.
      - When C(Information Leakage Signatures), configures signatures targeting attacks that are looking for system data
        or debugging information that shows where the system is vulnerable to attack.
      - When C(Java Servlets/JSP Signatures), configures signatures that target attacks against Java Servlets
        and Java Server Pages (JSP) based applications. Only available in version 13.x and up.
      - When C(Low Accuracy Signatures), configures signatures that may result in more false positives
        when identifying attacks.
      - When C(Medium Accuracy Signatures), configures signatures with a medium level of accuracy
        when identifying attacks.
      - When C(OS Command Injection Signatures), configures signatures targeting attacks
        that attempt to run system level commands through a vulnerable application.
      - When C(OWA Signatures), configures signatures that target attacks against
        the Microsoft Outlook Web Access (OWA) application.
      - When C(Other Application Attacks Signatures), configures signatures targeting miscellaneous attacks,
        including session fixation, local file access, injection attempts, header tampering
        and so on, affecting many applications.
      - When C(Path Traversal Signatures), configures signatures targeting attacks that attempt to access files
        and directories that are stored outside the web root folder.
      - When C(Predictable Resource Location Signatures), configures signatures targeting attacks that attempt
        to uncover hidden website content and functionality by forceful browsing, or by directory and file enumeration.
      - When C(Remote File Include Signatures), configures signatures targeting attacks that attempt to exploit
        a remote file include vulnerability that could enable a remote attacker to execute arbitrary commands
        on the server hosting the application.
      - When C(SQL Injection Signatures), configures signatures targeting attacks that attempt to insert (inject)
        a SQL query using the input data from a client to an application.
      - When C(Server Side Code Injection Signatures), configures signatures targeting code injection attacks
        on the server side.
      - When C(WebSphere signatures), configures signatures targeting attacks on many computing platforms
        that are integrated using WebSphere including general database, Microsoft Windows, IIS,
        Microsoft SQL Server, Apache, Oracle, Unix/Linux, IBM DB2, PostgreSQL, and XML.
      - When C(XPath Injection Signatures), configures signatures targeting attacks that attempt to gain access
        to data structures or bypass permissions when a web site uses user-supplied information
        to construct XPath queries for XML data.
    type: str
    required: True
  policy_name:
    description:
      - Specifies the name of an existing ASM policy to add or remove signature sets.
    type: str
    required: True
  alarm:
    description:
      - Specifies if the security policy logs the request data in the Statistics screen,
        when a request matches a signature that is included in the signature set.
    type: bool
  block:
    description:
      - Effective when the security policy`s enforcement mode is Blocking.
      - Determines how the system treats requests that match a signature included in the signature set.
      - When C(yes) the system blocks all requests that match a signature,
        and provides the client with a support ID number.
      - When C(no) the system accepts those requests.
    type: bool
  learn:
    description:
      - Specifies if the security policy learns all requests that match a signature
        that is included in the signature set.
    type: bool
  state:
    description:
      - When C(present), ensures that the resource exists.
      - When C(absent), ensures the resource is removed.
    type: str
    default: present
    choices:
      - present
      - absent
  partition:
    description:
      - This parameter is only used when identifying ASM policy.
    type: str
    default: Common
notes:
  - This module is primarily used as a component of configuring ASM policy in Ansible Galaxy ASM Policy Role.
extends_documentation_fragment: f5
author:
  - Wojciech Wypior (@wojtek0806)
s
- name: Add Signature Set to ASM Policy
  bigip_asm_policy_signature_set:
    name: IIS and Windows Signatures
    policy_name: FooPolicy
    provider:
      password: secret
      server: lb.mydomain.com
      user: admin
  delegate_to: localhost
- name: Remove Signature Set to ASM Policy
  bigip_asm_policy_signature_set:
    name: IIS and Windows Signatures
    policy_name: FooPolicy
    state: absent
    provider:
      password: secret
      server: lb.mydomain.com
      user: admin
  delegate_to: localhost
s�
policy_name:
  description: The name of the ASM policy
  returned: changed
  type: str
  sample: FooPolicy
name:
  description: The name of Signature Set added/removed on ASM policy
  returned: changed
  type: str
  sample: Cisco Signatures
alarm:
  description: Specifies whether the security policy logs the request data in the Statistics screen
  returned: changed
  type: bool
  sample: yes
block:
  description: Determines how the system treats requests that match a signature included in the signature set
  returned: changed
  type: bool
  sample: no
learn:
  description: Specifies if the policy learns all requests that match a signature that is included in the signature set
  returned: changed
  type: bool
  sample: yes
(t
AnsibleModule(tenv_fallback(tLooseVersion(tF5RestClient(t
F5ModuleError(tAnsibleF5Parameters(tfq_name(ttransform_name(tf5_argument_spec(tflatten_boolean(ttmos_version(tmodule_provisionedt
ParameterscB`sAeZiZdddgZdddddgZdddgZRS(talarmtblocktlearntpolicy_nametname(t__name__t
__module__tapi_maptapi_attributestreturnablest
updatables(((s]/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_asm_policy_signature_set.pyR�s		t
ApiParameterscB`seZRS((RR(((s]/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_asm_policy_signature_set.pyR �stModuleParameterscB`sMeZed��Zed��Zed��Zd�Zed��ZRS(cC`s1t|jd�}|r-|dkr)tStSdS(NRtyes(Rt_valuestTruetFalse(tselftresult((s]/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_asm_policy_signature_set.pyR�s
cC`s1t|jd�}|r-|dkr)tStSdS(NRR"(RR#R$R%(R&R'((s]/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_asm_policy_signature_set.pyR�s
cC`s1t|jd�}|r-|dkr)tStSdS(NRR"(RR#R$R%(R&R'((s]/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_asm_policy_signature_set.pyR�s
c`s�dj|jjd|jjd�}d}|jjj||�}y|j�}Wn%tk
r|}tt|���nXd|kr�|ddkr�d|kr�t|d��q�t|j	��nt
�fd�|d	D��r�tStS(
Ns*https://{0}:{1}/mgmt/tm/asm/signature-setstservertserver_ports
?$select=nametcodei�tmessagec3`s|]}|d�kVqdS(RN((t.0tp(R(s]/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_asm_policy_signature_set.pys	<genexpr>stitems(
tformattclienttprovidertapitgettjsont
ValueErrorRtstrtcontenttanyR$R%(R&Rturitquerytresptresponsetex((Rs]/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_asm_policy_signature_set.pyt_signature_set_exists_on_devices 
 cC`s<|jddkrdSt|j�}t|�td�kr�ddddddd	d
ddd
ddddddddddg}nWdddddddddd	dd
ddddd
ddddddddddg}|jd|kr�|jdS|j|jd�r|jdStdj|jd���dS(NRs13.0.0sAll Response SignaturessAll SignaturessCommand Execution SignaturessCross Site Scripting SignaturessDirectory Indexing SignaturessGeneric Detection Signaturess"HTTP Response Splitting SignaturessHigh Accuracy SignaturessInformation Leakage SignaturessLow Accuracy SignaturessMedium Accuracy SignaturessOS Command Injection SignaturessOWA Signaturess$Other Application Attacks SignaturessPath Traversal Signaturess(Predictable Resource Location SignaturessRemote File Include SignaturessSQL Injection Signaturess%Server Side Code Injection SignaturessWebSphere signaturessXPath Injection SignaturessApache Struts SignaturessApache Tomcat SignaturessCisco Signaturess*High Accuracy Detection Evasion SignaturessIIS and Windows SignaturessJava Servlets/JSP Signaturess/The specified signature {0} set does not exist.(R#tNoneRR0R
R>RR/(R&tversiont	name_list((s]/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_asm_policy_signature_set.pyRsv	(RRtpropertyRRRR>R(((s]/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_asm_policy_signature_set.pyR!�s
	tChangescB`seZd�ZRS(cC`sXi}y:x$|jD]}t||�||<qW|j|�}Wntk
rSnX|S(N(Rtgetattrt_filter_paramst	Exception(R&R't
returnable((s]/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_asm_policy_signature_set.pyt	to_returnjs
(RRRH(((s]/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_asm_policy_signature_set.pyRCist
UsableChangescB`seZRS((RR(((s]/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_asm_policy_signature_set.pyRIustReportableChangescB`s5eZed��Zed��Zed��ZRS(cC`st|jd�S(NR(RR#(R&((s]/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_asm_policy_signature_set.pyRzscC`st|jd�S(NR(RR#(R&((s]/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_asm_policy_signature_set.pyR~scC`st|jd�S(NR(RR#(R&((s]/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_asm_policy_signature_set.pyR�s(RRRBRRR(((s]/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_asm_policy_signature_set.pyRJyst
DifferencecB`s&eZdd�Zd�Zd�ZRS(cC`s||_||_dS(N(twantthave(R&RLRM((s]/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_asm_policy_signature_set.pyt__init__�s	cC`s9yt||�}|SWntk
r4|j|�SXdS(N(RDtAttributeErrort_Difference__default(R&tparamR'((s]/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_asm_policy_signature_set.pytcompare�s

cC`sQt|j|�}y&t|j|�}||kr7|SWntk
rL|SXdS(N(RDRLRMRO(R&RQtattr1tattr2((s]/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_asm_policy_signature_set.pyt	__default�s
N(RRR?RNRRRP(((s]/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_asm_policy_signature_set.pyRK�s	t
ModuleManagercB`s�eZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�ZRS(cO`sg|jdd�|_t|jj�|_td|jjd|j�|_t�|_	t
�|_dS(NtmoduletparamsR0(R3R?RWRRXR0R!RLR RMRItchanges(R&targstkwargs((s]/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_asm_policy_signature_set.pyRN�s
!cC`sji}xBtjD]7}t|j|�dk	rt|j|�||<qqW|rftd|�|_ndS(NRX(RRRDRLR?RIRY(R&tchangedtkey((s]/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_asm_policy_signature_set.pyt_set_changed_options�scC`s�t|j|j�}tj}t�}xX|D]P}|j|�}|dkrUq.q.t|t�rt|j	|�q.|||<q.W|r�t
d|�|_tSt
S(NRX(RKRLRMRRtdictRRR?t
isinstancetupdateRIRYR$R%(R&tdiffRR\tktchange((s]/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_asm_policy_signature_set.pyt_update_changed_options�s		
cC`sK|jdg�}x2|D]*}|jjjd|dd|d�qWdS(Nt
__warningstmsgR@(tpopR0RWt	deprecate(R&R'twarningstwarning((s]/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_asm_policy_signature_set.pyt_announce_deprecations�s


cC`s�t|jd�s!td��nt}t�}|jj}|dkrW|j�}n|dkrr|j�}nt	d|j
j��}|j�}|j|�|jtd|��|j
|�|S(Ntasms+ASM must be provisioned to use this module.tpresenttabsentRXR\(RR0RR%R_RLtstateRnRoRJRYRHRaRl(R&R\R'Rpt
reportableRY((s]/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_asm_policy_signature_set.pytexec_module�s 	

cC`s$|j�r|j�S|j�SdS(N(texistsRatcreate(R&((s]/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_asm_policy_signature_set.pyRn�s
cC`s|j�r|j�StS(N(RstremoveR%(R&((s]/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_asm_policy_signature_set.pyRo�s
cC`s|j�}|rtStS(N(ReR$R%(R&R'((s]/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_asm_policy_signature_set.pyt
should_update�scC`s=|j�|_|j�stS|jjr/tS|j�tS(N(tread_current_from_deviceRMRvR%RWt
check_modeR$tupdate_on_device(R&((s]/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_asm_policy_signature_set.pyRa�s
cC`s9|jjrtS|j�|j�r5td��ntS(NsFailed to delete the resource.(RWRxR$tremove_from_deviceRsR(R&((s]/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_asm_policy_signature_set.pyRu�s
cC`s(|j�|jjrtS|j�tS(N(R^RWRxR$tcreate_on_device(R&((s]/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_asm_policy_signature_set.pyRt�s


cC`s�|j�}|j�}dj|jjd|jjd|�}|jjj|�}y|j�}Wn%tk
r�}t	t
|���nXd|kr�|dgkr�x9|dD]*}|d|kr�|d|j_t
Sq�WntS(Ns8https://{0}:{1}/mgmt/tm/asm/policies/{2}/signature-sets/R(R)R.tsignatureSetReferencetid(t_get_policy_idt_get_signature_set_linkR/R0R1R2R3R4R5RR6RLtss_idR$R%(R&t	policy_idtset_linkR9R;R<R=tst((s]/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_asm_policy_signature_set.pyRss"

	c	C`s:d}|jj}dj|jjd|jjd�}d}|jjj||�}y|j�}Wn%t	k
r�}t
t|���nXd|kr�|ddkr�d|kr�t
|d��q�t
|j��nd|kr6|dgkr6x;|dD],}|d	|krt
d
|d�}qqWn|S(Ns*https://{0}:{1}/mgmt/tm/asm/signature-setsR(R)s
?$select=nameR*i�R+R.RtlinktselfLink(R?RLRR/R0R1R2R3R4R5RR6R7R_(	R&R't
signature_setR9R:R;R<R=titem((s]/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_asm_policy_signature_set.pyRs(
cC`s�d}dj|jjd|jjd�}dj|jj|jj�}|jjj||�}y|j	�}Wn%t
k
r�}tt|���nXd|kr�|dgkr�|ddd}n|s�tdj|jj���n|S(	Ns%https://{0}:{1}/mgmt/tm/asm/policies/R(R)sK?$filter=contains(name,'{0}')+and+contains(partition,'{1}')&$select=name,idR.iR}s+The policy with the name {0} does not exist(
R?R/R0R1RLRt	partitionR2R3R4R5RR6(R&R�R9R:R;R<R=((s]/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_asm_policy_signature_set.pyR~8s"
cC`s�|j�}|jj�}|j�|d<dj|jjd|jjd|�}|jjj|d|�}y|j	�}Wn%t
k
r�}tt|���nXd|kr�|dd
kr�d	|kr�t|d	��q�t|j
��ntS(NR|s8https://{0}:{1}/mgmt/tm/asm/policies/{2}/signature-sets/R(R)R4R*i�i�R+(i�i�(R~RYt
api_paramsRR/R0R1R2tpostR4R5RR6R7R$(R&R�RXR9R;R<R=((s]/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_asm_policy_signature_set.pyR{Qs"

	cC`s�|j�}|jj�}dj|jjd|jjd||jj�}|jjj	|d|�}y|j
�}Wn%tk
r�}tt
|���nXd|kr�|ddkr�d|kr�t|d��q�t|j��ndS(Ns;https://{0}:{1}/mgmt/tm/asm/policies/{2}/signature-sets/{3}R(R)R4R*i�R+(R~RYR�R/R0R1RLR�R2tpatchR4R5RR6R7(R&R�RXR9R;R<R=((s]/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_asm_policy_signature_set.pyRygs 

cC`sy|j�}dj|jjd|jjd||jj�}|jjj|�}|jdkrft	St
|j��dS(Ns;https://{0}:{1}/mgmt/tm/asm/policies/{2}/signature-sets/{3}R(R)i�i�(i�i�(R~R/R0R1RLR�R2tdeleteRR$RR7(R&R�R9R<((s]/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_asm_policy_signature_set.pyRz|s

cC`s�|j�}dj|jjd|jjd||jj�}|jjj|�}y|j�}Wn%t	k
r�}t
t|���nXd|kr�|ddkr�d|kr�t
|d��q�t
|j��nt
d|�S(Ns;https://{0}:{1}/mgmt/tm/asm/policies/{2}/signature-sets/{3}R(R)R*i�R+RX(R~R/R0R1RLR�R2R3R4R5RR6R7R (R&R�R9R;R<R=((s]/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_asm_policy_signature_set.pyRw�s 

(RRRNR^ReRlRrRnRoRvRaRuRtRsRR~R{RyRzRw(((s]/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_asm_policy_signature_set.pyRV�s$																		
tArgumentSpeccB`seZd�ZRS(cC`s�t|_tdtdt�dtdt�dtdd�dtdd�dtdd�d	td
dddd
g�dtd
ddtdgf��}i|_|jjt�|jj|�dS(NRtrequiredRRttypetboolRRRptdefaultRntchoicesRoR�tCommontfallbacktF5_PARTITION(R$tsupports_check_modeR_R	t
argument_specRaR(R&R�((s]/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_asm_policy_signature_set.pyRN�s*							(RRRN(((s]/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_asm_policy_signature_set.pyR��scC`s�t�}td|jd|j�}y,td|�}|j�}|j|�Wn)tk
r{}|jdt	|��nXdS(NR�R�RWRg(
R�RR�R�RVRrt	exit_jsonRt	fail_jsonR6(tspecRWtmmtresultsR=((s]/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_asm_policy_signature_set.pytmain�s		t__main__N(+t
__future__RRRR�t
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNtansible.module_utils.basicRR	tdistutils.versionR
t%library.module_utils.network.f5.bigipRt&library.module_utils.network.f5.commonRR
RRRRt(library.module_utils.network.f5.icontrolRRtImportErrort%ansible.module_utils.network.f5.bigipt&ansible.module_utils.network.f5.commont(ansible.module_utils.network.f5.icontrolRR R!RCRIRJtobjectRKRVR�R�R(((s]/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_asm_policy_signature_set.pyt<module>sV


r
|�!	

Anons79 File Manager Version 1.0, Coded By Anons79
Email: [email protected]