Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_waf_profile.py

raw symbols SCIP
1 #!/usr/bin/python
2 from __future__ import absolute_import, division, print_function
3 # Copyright 2019-2024 Fortinet, Inc.
4 # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
5
6 __metaclass__ = type
7
8 ANSIBLE_METADATA = {'status': ['preview'],
9 'supported_by': 'community',
10 'metadata_version': '1.1'}
11
12 DOCUMENTATION = '''
13 ---
14 module: fmgr_waf_profile
15 short_description: Web application firewall configuration.
16 version_added: "1.0.0"
17 extends_documentation_fragment:
18 - fortinet.fortimanager.general
19 - fortinet.fortimanager.general.full_crud
20 options:
21 revision_note:
22 description: The change note that can be specified when an object is created or updated.
23 type: str
24 adom:
25 description: The parameter (adom) in requested url.
26 type: str
27 required: true
28 waf_profile:
29 description: The top level parameters set.
30 required: false
31 type: dict
32 suboptions:
33 comment:
34 type: str
35 description: Comment.
36 extended_log:
37 aliases: ['extended-log']
38 type: str
39 description: Enable/disable extended logging.
40 choices: ['disable', 'enable']
41 external:
42 type: str
43 description: Disable/Enable external HTTP Inspection.
44 choices: ['disable', 'enable']
45 name:
46 type: str
47 description: WAF Profile name.
48 required: true
49 url_access:
50 aliases: ['url-access']
51 type: list
52 elements: dict
53 description: Url access.
54 suboptions:
55 access_pattern:
56 aliases: ['access-pattern']
57 type: list
58 elements: dict
59 description: Access pattern.
60 suboptions:
61 id:
62 type: int
63 description: URL access pattern ID.
64 negate:
65 type: str
66 description: Enable/disable match negation.
67 choices: ['disable', 'enable']
68 pattern:
69 type: str
70 description: URL pattern.
71 regex:
72 type: str
73 description: Enable/disable regular expression based pattern match.
74 choices: ['disable', 'enable']
75 srcaddr:
76 type: str
77 description: Source address.
78 action:
79 type: str
80 description: Action.
81 choices: ['bypass', 'permit', 'block']
82 address:
83 type: str
84 description: Host address.
85 id:
86 type: int
87 description: URL access ID.
88 log:
89 type: str
90 description: Enable/disable logging.
91 choices: ['disable', 'enable']
92 severity:
93 type: str
94 description: Severity.
95 choices: ['low', 'medium', 'high']
96 address_list:
97 aliases: ['address-list']
98 type: dict
99 description: Address list.
100 suboptions:
101 blocked_address:
102 aliases: ['blocked-address']
103 type: raw
104 description: (list or str) Blocked address.
105 blocked_log:
106 aliases: ['blocked-log']
107 type: str
108 description: Enable/disable logging on blocked addresses.
109 choices: ['disable', 'enable']
110 severity:
111 type: str
112 description: Severity.
113 choices: ['low', 'medium', 'high']
114 status:
115 type: str
116 description: Status.
117 choices: ['disable', 'enable']
118 trusted_address:
119 aliases: ['trusted-address']
120 type: raw
121 description: (list or str) Trusted address.
122 constraint:
123 type: dict
124 description: Constraint.
125 suboptions:
126 content_length:
127 aliases: ['content-length']
128 type: dict
129 description: Content length.
130 suboptions:
131 action:
132 type: str
133 description: Action.
134 choices: ['allow', 'block']
135 length:
136 type: int
137 description: Length of HTTP content in bytes
138 log:
139 type: str
140 description: Enable/disable logging.
141 choices: ['disable', 'enable']
142 severity:
143 type: str
144 description: Severity.
145 choices: ['low', 'medium', 'high']
146 status:
147 type: str
148 description: Enable/disable the constraint.
149 choices: ['disable', 'enable']
150 exception:
151 type: list
152 elements: dict
153 description: Exception.
154 suboptions:
155 address:
156 type: str
157 description: Host address.
158 content_length:
159 aliases: ['content-length']
160 type: str
161 description: HTTP content length in request.
162 choices: ['disable', 'enable']
163 header_length:
164 aliases: ['header-length']
165 type: str
166 description: HTTP header length in request.
167 choices: ['disable', 'enable']
168 hostname:
169 type: str
170 description: Enable/disable hostname check.
171 choices: ['disable', 'enable']
172 id:
173 type: int
174 description: Exception ID.
175 line_length:
176 aliases: ['line-length']
177 type: str
178 description: HTTP line length in request.
179 choices: ['disable', 'enable']
180 malformed:
181 type: str
182 description: Enable/disable malformed HTTP request check.
183 choices: ['disable', 'enable']
184 max_cookie:
185 aliases: ['max-cookie']
186 type: str
187 description: Maximum number of cookies in HTTP request.
188 choices: ['disable', 'enable']
189 max_header_line:
190 aliases: ['max-header-line']
191 type: str
192 description: Maximum number of HTTP header line.
193 choices: ['disable', 'enable']
194 max_range_segment:
195 aliases: ['max-range-segment']
196 type: str
197 description: Maximum number of range segments in HTTP range line.
198 choices: ['disable', 'enable']
199 max_url_param:
200 aliases: ['max-url-param']
201 type: str
202 description: Maximum number of parameters in URL.
203 choices: ['disable', 'enable']
204 method:
205 type: str
206 description: Enable/disable HTTP method check.
207 choices: ['disable', 'enable']
208 param_length:
209 aliases: ['param-length']
210 type: str
211 description: Maximum length of parameter in URL, HTTP POST request or HTTP body.
212 choices: ['disable', 'enable']
213 pattern:
214 type: str
215 description: URL pattern.
216 regex:
217 type: str
218 description: Enable/disable regular expression based pattern match.
219 choices: ['disable', 'enable']
220 url_param_length:
221 aliases: ['url-param-length']
222 type: str
223 description: Maximum length of parameter in URL.
224 choices: ['disable', 'enable']
225 version:
226 type: str
227 description: Enable/disable HTTP version check.
228 choices: ['disable', 'enable']
229 header_length:
230 aliases: ['header-length']
231 type: dict
232 description: Header length.
233 suboptions:
234 action:
235 type: str
236 description: Action.
237 choices: ['allow', 'block']
238 length:
239 type: int
240 description: Length of HTTP header in bytes
241 log:
242 type: str
243 description: Enable/disable logging.
244 choices: ['disable', 'enable']
245 severity:
246 type: str
247 description: Severity.
248 choices: ['low', 'medium', 'high']
249 status:
250 type: str
251 description: Enable/disable the constraint.
252 choices: ['disable', 'enable']
253 hostname:
254 type: dict
255 description: Hostname.
256 suboptions:
257 action:
258 type: str
259 description: Action.
260 choices: ['allow', 'block']
261 log:
262 type: str
263 description: Enable/disable logging.
264 choices: ['disable', 'enable']
265 severity:
266 type: str
267 description: Severity.
268 choices: ['low', 'medium', 'high']
269 status:
270 type: str
271 description: Enable/disable the constraint.
272 choices: ['disable', 'enable']
273 line_length:
274 aliases: ['line-length']
275 type: dict
276 description: Line length.
277 suboptions:
278 action:
279 type: str
280 description: Action.
281 choices: ['allow', 'block']
282 length:
283 type: int
284 description: Length of HTTP line in bytes
285 log:
286 type: str
287 description: Enable/disable logging.
288 choices: ['disable', 'enable']
289 severity:
290 type: str
291 description: Severity.
292 choices: ['low', 'medium', 'high']
293 status:
294 type: str
295 description: Enable/disable the constraint.
296 choices: ['disable', 'enable']
297 malformed:
298 type: dict
299 description: Malformed.
300 suboptions:
301 action:
302 type: str
303 description: Action.
304 choices: ['allow', 'block']
305 log:
306 type: str
307 description: Enable/disable logging.
308 choices: ['disable', 'enable']
309 severity:
310 type: str
311 description: Severity.
312 choices: ['low', 'medium', 'high']
313 status:
314 type: str
315 description: Enable/disable the constraint.
316 choices: ['disable', 'enable']
317 max_cookie:
318 aliases: ['max-cookie']
319 type: dict
320 description: Max cookie.
321 suboptions:
322 action:
323 type: str
324 description: Action.
325 choices: ['allow', 'block']
326 log:
327 type: str
328 description: Enable/disable logging.
329 choices: ['disable', 'enable']
330 max_cookie:
331 aliases: ['max-cookie']
332 type: int
333 description: Maximum number of cookies in HTTP request
334 severity:
335 type: str
336 description: Severity.
337 choices: ['low', 'medium', 'high']
338 status:
339 type: str
340 description: Enable/disable the constraint.
341 choices: ['disable', 'enable']
342 max_header_line:
343 aliases: ['max-header-line']
344 type: dict
345 description: Max header line.
346 suboptions:
347 action:
348 type: str
349 description: Action.
350 choices: ['allow', 'block']
351 log:
352 type: str
353 description: Enable/disable logging.
354 choices: ['disable', 'enable']
355 max_header_line:
356 aliases: ['max-header-line']
357 type: int
358 description: Maximum number HTTP header lines
359 severity:
360 type: str
361 description: Severity.
362 choices: ['low', 'medium', 'high']
363 status:
364 type: str
365 description: Enable/disable the constraint.
366 choices: ['disable', 'enable']
367 max_range_segment:
368 aliases: ['max-range-segment']
369 type: dict
370 description: Max range segment.
371 suboptions:
372 action:
373 type: str
374 description: Action.
375 choices: ['allow', 'block']
376 log:
377 type: str
378 description: Enable/disable logging.
379 choices: ['disable', 'enable']
380 max_range_segment:
381 aliases: ['max-range-segment']
382 type: int
383 description: Maximum number of range segments in HTTP range line
384 severity:
385 type: str
386 description: Severity.
387 choices: ['low', 'medium', 'high']
388 status:
389 type: str
390 description: Enable/disable the constraint.
391 choices: ['disable', 'enable']
392 max_url_param:
393 aliases: ['max-url-param']
394 type: dict
395 description: Max url param.
396 suboptions:
397 action:
398 type: str
399 description: Action.
400 choices: ['allow', 'block']
401 log:
402 type: str
403 description: Enable/disable logging.
404 choices: ['disable', 'enable']
405 max_url_param:
406 aliases: ['max-url-param']
407 type: int
408 description: Maximum number of parameters in URL
409 severity:
410 type: str
411 description: Severity.
412 choices: ['low', 'medium', 'high']
413 status:
414 type: str
415 description: Enable/disable the constraint.
416 choices: ['disable', 'enable']
417 method:
418 type: dict
419 description: Method.
420 suboptions:
421 action:
422 type: str
423 description: Action.
424 choices: ['allow', 'block']
425 log:
426 type: str
427 description: Enable/disable logging.
428 choices: ['disable', 'enable']
429 severity:
430 type: str
431 description: Severity.
432 choices: ['low', 'medium', 'high']
433 status:
434 type: str
435 description: Enable/disable the constraint.
436 choices: ['disable', 'enable']
437 param_length:
438 aliases: ['param-length']
439 type: dict
440 description: Param length.
441 suboptions:
442 action:
443 type: str
444 description: Action.
445 choices: ['allow', 'block']
446 length:
447 type: int
448 description: Maximum length of parameter in URL, HTTP POST request or HTTP body in bytes
449 log:
450 type: str
451 description: Enable/disable logging.
452 choices: ['disable', 'enable']
453 severity:
454 type: str
455 description: Severity.
456 choices: ['low', 'medium', 'high']
457 status:
458 type: str
459 description: Enable/disable the constraint.
460 choices: ['disable', 'enable']
461 url_param_length:
462 aliases: ['url-param-length']
463 type: dict
464 description: Url param length.
465 suboptions:
466 action:
467 type: str
468 description: Action.
469 choices: ['allow', 'block']
470 length:
471 type: int
472 description: Maximum length of URL parameter in bytes
473 log:
474 type: str
475 description: Enable/disable logging.
476 choices: ['disable', 'enable']
477 severity:
478 type: str
479 description: Severity.
480 choices: ['low', 'medium', 'high']
481 status:
482 type: str
483 description: Enable/disable the constraint.
484 choices: ['disable', 'enable']
485 version:
486 type: dict
487 description: Version.
488 suboptions:
489 action:
490 type: str
491 description: Action.
492 choices: ['allow', 'block']
493 log:
494 type: str
495 description: Enable/disable logging.
496 choices: ['disable', 'enable']
497 severity:
498 type: str
499 description: Severity.
500 choices: ['low', 'medium', 'high']
501 status:
502 type: str
503 description: Enable/disable the constraint.
504 choices: ['disable', 'enable']
505 method:
506 type: dict
507 description: Method.
508 suboptions:
509 default_allowed_methods:
510 aliases: ['default-allowed-methods']
511 type: list
512 elements: str
513 description: Methods.
514 choices: ['delete', 'get', 'head', 'options', 'post', 'put', 'trace',
515 'others', 'connect']
516 log:
517 type: str
518 description: Enable/disable logging.
519 choices: ['disable', 'enable']
520 method_policy:
521 aliases: ['method-policy']
522 type: list
523 elements: dict
524 description: Method policy.
525 suboptions:
526 address:
527 type: str
528 description: Host address.
529 allowed_methods:
530 aliases: ['allowed-methods']
531 type: list
532 elements: str
533 description: Allowed Methods.
534 choices: ['delete', 'get', 'head', 'options', 'post', 'put',
535 'trace', 'others', 'connect']
536 id:
537 type: int
538 description: HTTP method policy ID.
539 pattern:
540 type: str
541 description: URL pattern.
542 regex:
543 type: str
544 description: Enable/disable regular expression based pattern match.
545 choices: ['disable', 'enable']
546 severity:
547 type: str
548 description: Severity.
549 choices: ['low', 'medium', 'high']
550 status:
551 type: str
552 description: Status.
553 choices: ['disable', 'enable']
554 signature:
555 type: dict
556 description: Signature.
557 suboptions:
558 credit_card_detection_threshold:
559 aliases: ['credit-card-detection-threshold']
560 type: int
561 description: The minimum number of Credit cards to detect violation.
562 custom_signature:
563 aliases: ['custom-signature']
564 type: list
565 elements: dict
566 description: Custom signature.
567 suboptions:
568 action:
569 type: str
570 description: Action.
571 choices: ['allow', 'block', 'erase']
572 case_sensitivity:
573 aliases: ['case-sensitivity']
574 type: str
575 description: Case sensitivity in pattern.
576 choices: ['disable', 'enable']
577 direction:
578 type: str
579 description: Traffic direction.
580 choices: ['request', 'response']
581 log:
582 type: str
583 description: Enable/disable logging.
584 choices: ['disable', 'enable']
585 name:
586 type: str
587 description: Signature name.
588 pattern:
589 type: str
590 description: Match pattern.
591 severity:
592 type: str
593 description: Severity.
594 choices: ['low', 'medium', 'high']
595 status:
596 type: str
597 description: Status.
598 choices: ['disable', 'enable']
599 target:
600 type: list
601 elements: str
602 description: Match HTTP target.
603 choices: ['arg', 'arg-name', 'req-body', 'req-cookie',
604 'req-cookie-name', 'req-filename', 'req-header',
605 'req-header-name', 'req-raw-uri', 'req-uri',
606 'resp-body', 'resp-hdr', 'resp-status']
607 disabled_signature:
608 aliases: ['disabled-signature']
609 type: raw
610 description: (list or str) Disabled signatures
611 disabled_sub_class:
612 aliases: ['disabled-sub-class']
613 type: raw
614 description: (list or str) Disabled signature subclasses.
615 main_class:
616 aliases: ['main-class']
617 type: dict
618 description: Main class.
619 suboptions:
620 action:
621 type: str
622 description: Action.
623 choices: ['allow', 'block', 'erase']
624 id:
625 type: int
626 description: Main signature class ID.
627 log:
628 type: str
629 description: Enable/disable logging.
630 choices: ['disable', 'enable']
631 severity:
632 type: str
633 description: Severity.
634 choices: ['low', 'medium', 'high']
635 status:
636 type: str
637 description: Status.
638 choices: ['disable', 'enable']
639 '''
640
641 EXAMPLES = '''
642 - name: Example playbook (generated based on argument schema)
643 hosts: fortimanagers
644 connection: httpapi
645 gather_facts: false
646 tasks:
647 - name: Web application firewall configuration.
648 fortinet.fortimanager.fmgr_waf_profile:
649 # workspace_locking_adom: <global or your adom name>
650 adom: <your own value>
651 state: present # <value in [present, absent]>
652 waf_profile:
653 name: "your value" # Required variable, string
654 # comment: <string>
655 # extended_log: <value in [disable, enable]>
656 # external: <value in [disable, enable]>
657 # url_access:
658 # - access_pattern:
659 # - id: <integer>
660 # negate: <value in [disable, enable]>
661 # pattern: <string>
662 # regex: <value in [disable, enable]>
663 # srcaddr: <string>
664 # action: <value in [bypass, permit, block]>
665 # address: <string>
666 # id: <integer>
667 # log: <value in [disable, enable]>
668 # severity: <value in [low, medium, high]>
669 # address_list:
670 # blocked_address: <list or string>
671 # blocked_log: <value in [disable, enable]>
672 # severity: <value in [low, medium, high]>
673 # status: <value in [disable, enable]>
674 # trusted_address: <list or string>
675 # constraint:
676 # content_length:
677 # action: <value in [allow, block]>
678 # length: <integer>
679 # log: <value in [disable, enable]>
680 # severity: <value in [low, medium, high]>
681 # status: <value in [disable, enable]>
682 # exception:
683 # - address: <string>
684 # content_length: <value in [disable, enable]>
685 # header_length: <value in [disable, enable]>
686 # hostname: <value in [disable, enable]>
687 # id: <integer>
688 # line_length: <value in [disable, enable]>
689 # malformed: <value in [disable, enable]>
690 # max_cookie: <value in [disable, enable]>
691 # max_header_line: <value in [disable, enable]>
692 # max_range_segment: <value in [disable, enable]>
693 # max_url_param: <value in [disable, enable]>
694 # method: <value in [disable, enable]>
695 # param_length: <value in [disable, enable]>
696 # pattern: <string>
697 # regex: <value in [disable, enable]>
698 # url_param_length: <value in [disable, enable]>
699 # version: <value in [disable, enable]>
700 # header_length:
701 # action: <value in [allow, block]>
702 # length: <integer>
703 # log: <value in [disable, enable]>
704 # severity: <value in [low, medium, high]>
705 # status: <value in [disable, enable]>
706 # hostname:
707 # action: <value in [allow, block]>
708 # log: <value in [disable, enable]>
709 # severity: <value in [low, medium, high]>
710 # status: <value in [disable, enable]>
711 # line_length:
712 # action: <value in [allow, block]>
713 # length: <integer>
714 # log: <value in [disable, enable]>
715 # severity: <value in [low, medium, high]>
716 # status: <value in [disable, enable]>
717 # malformed:
718 # action: <value in [allow, block]>
719 # log: <value in [disable, enable]>
720 # severity: <value in [low, medium, high]>
721 # status: <value in [disable, enable]>
722 # max_cookie:
723 # action: <value in [allow, block]>
724 # log: <value in [disable, enable]>
725 # max_cookie: <integer>
726 # severity: <value in [low, medium, high]>
727 # status: <value in [disable, enable]>
728 # max_header_line:
729 # action: <value in [allow, block]>
730 # log: <value in [disable, enable]>
731 # max_header_line: <integer>
732 # severity: <value in [low, medium, high]>
733 # status: <value in [disable, enable]>
734 # max_range_segment:
735 # action: <value in [allow, block]>
736 # log: <value in [disable, enable]>
737 # max_range_segment: <integer>
738 # severity: <value in [low, medium, high]>
739 # status: <value in [disable, enable]>
740 # max_url_param:
741 # action: <value in [allow, block]>
742 # log: <value in [disable, enable]>
743 # max_url_param: <integer>
744 # severity: <value in [low, medium, high]>
745 # status: <value in [disable, enable]>
746 # method:
747 # action: <value in [allow, block]>
748 # log: <value in [disable, enable]>
749 # severity: <value in [low, medium, high]>
750 # status: <value in [disable, enable]>
751 # param_length:
752 # action: <value in [allow, block]>
753 # length: <integer>
754 # log: <value in [disable, enable]>
755 # severity: <value in [low, medium, high]>
756 # status: <value in [disable, enable]>
757 # url_param_length:
758 # action: <value in [allow, block]>
759 # length: <integer>
760 # log: <value in [disable, enable]>
761 # severity: <value in [low, medium, high]>
762 # status: <value in [disable, enable]>
763 # version:
764 # action: <value in [allow, block]>
765 # log: <value in [disable, enable]>
766 # severity: <value in [low, medium, high]>
767 # status: <value in [disable, enable]>
768 # method:
769 # default_allowed_methods: ["delete", "get", "head", "options", "post", "put",
770 # "trace", "others", "connect"]
771 # log: <value in [disable, enable]>
772 # method_policy:
773 # - address: <string>
774 # allowed_methods: ["delete", "get", "head", "options", "post", "put", "trace",
775 # "others", "connect"]
776 # id: <integer>
777 # pattern: <string>
778 # regex: <value in [disable, enable]>
779 # severity: <value in [low, medium, high]>
780 # status: <value in [disable, enable]>
781 # signature:
782 # credit_card_detection_threshold: <integer>
783 # custom_signature:
784 # - action: <value in [allow, block, erase]>
785 # case_sensitivity: <value in [disable, enable]>
786 # direction: <value in [request, response]>
787 # log: <value in [disable, enable]>
788 # name: <string>
789 # pattern: <string>
790 # severity: <value in [low, medium, high]>
791 # status: <value in [disable, enable]>
792 # target: ["arg", "arg-name", "req-body", "req-cookie", "req-cookie-name",
793 # "req-filename", "req-header", "req-header-name", "req-raw-uri",
794 # "req-uri", "resp-body", "resp-hdr", "resp-status"]
795 # disabled_signature: <list or string>
796 # disabled_sub_class: <list or string>
797 # main_class:
798 # action: <value in [allow, block, erase]>
799 # id: <integer>
800 # log: <value in [disable, enable]>
801 # severity: <value in [low, medium, high]>
802 # status: <value in [disable, enable]>
803 '''
804
805 RETURN = '''
806 meta:
807 description: The result of the request.
808 type: dict
809 returned: always
810 contains:
811 request_url:
812 description: The full url requested.
813 returned: always
814 type: str
815 sample: /sys/login/user
816 response_code:
817 description: The status of api request.
818 returned: always
819 type: int
820 sample: 0
821 response_data:
822 description: The api response.
823 type: list
824 returned: always
825 response_message:
826 description: The descriptive message of the api response.
827 type: str
828 returned: always
829 sample: OK.
830 system_information:
831 description: The information of the target system.
832 type: dict
833 returned: always
834 rc:
835 description: The status the request.
836 type: int
837 returned: always
838 sample: 0
839 version_check_warning:
840 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
841 type: list
842 returned: complex
843 '''
844 from ansible.module_utils.basic import AnsibleModule
845 from ansible.module_utils.connection import Connection
846 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
847 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
848
849
850 def main():
851 urls_list = [
852 '/pm/config/adom/{adom}/obj/waf/profile',
853 '/pm/config/global/obj/waf/profile'
854 ]
855 module_arg_spec = {
856 'adom': {'required': True, 'type': 'str'},
857 'revision_note': {'type': 'str'},
858 'waf_profile': {
859 'type': 'dict', 'v_range': [['6.0.0', '']],
860 'options': {
861 'comment': {'type': 'str'},
862 'extended-log': {'choices': ['disable', 'enable'], 'type': 'str'},
863 'external': {'choices': ['disable', 'enable'], 'type': 'str'},
864 'name': {'required': True, 'type': 'str'},
865 'url-access': {
866 'type': 'list',
867 'options': {
868 'access-pattern': {
869 'type': 'list',
870 'options': {
871 'id': {'type': 'int'},
872 'negate': {'choices': ['disable', 'enable'], 'type': 'str'},
873 'pattern': {'type': 'str'},
874 'regex': {'choices': ['disable', 'enable'], 'type': 'str'},
875 'srcaddr': {'type': 'str'}
876 },
877 'elements': 'dict'
878 },
879 'action': {'choices': ['bypass', 'permit', 'block'], 'type': 'str'},
880 'address': {'type': 'str'},
881 'id': {'type': 'int'},
882 'log': {'choices': ['disable', 'enable'], 'type': 'str'},
883 'severity': {'choices': ['low', 'medium', 'high'], 'type': 'str'}
884 },
885 'elements': 'dict'
886 },
887 'address-list': {
888 'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']],
889 'type': 'dict',
890 'options': {
891 'blocked-address': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'type': 'raw'},
892 'blocked-log': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
893 'severity': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'choices': ['low', 'medium', 'high'], 'type': 'str'},
894 'status': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
895 'trusted-address': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'type': 'raw'}
896 }
897 },
898 'constraint': {
899 'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']],
900 'type': 'dict',
901 'options': {
902 'content-length': {
903 'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']],
904 'type': 'dict',
905 'options': {
906 'action': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'choices': ['allow', 'block'], 'type': 'str'},
907 'length': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'type': 'int'},
908 'log': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
909 'severity': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'choices': ['low', 'medium', 'high'], 'type': 'str'},
910 'status': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'choices': ['disable', 'enable'], 'type': 'str'}
911 }
912 },
913 'exception': {
914 'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']],
915 'type': 'list',
916 'options': {
917 'address': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'type': 'str'},
918 'content-length': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
919 'header-length': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
920 'hostname': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
921 'id': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'type': 'int'},
922 'line-length': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
923 'malformed': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
924 'max-cookie': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
925 'max-header-line': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
926 'max-range-segment': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
927 'max-url-param': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
928 'method': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
929 'param-length': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
930 'pattern': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'type': 'str'},
931 'regex': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
932 'url-param-length': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
933 'version': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'choices': ['disable', 'enable'], 'type': 'str'}
934 },
935 'elements': 'dict'
936 },
937 'header-length': {
938 'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']],
939 'type': 'dict',
940 'options': {
941 'action': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'choices': ['allow', 'block'], 'type': 'str'},
942 'length': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'type': 'int'},
943 'log': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
944 'severity': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'choices': ['low', 'medium', 'high'], 'type': 'str'},
945 'status': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'choices': ['disable', 'enable'], 'type': 'str'}
946 }
947 },
948 'hostname': {
949 'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']],
950 'type': 'dict',
951 'options': {
952 'action': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'choices': ['allow', 'block'], 'type': 'str'},
953 'log': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
954 'severity': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'choices': ['low', 'medium', 'high'], 'type': 'str'},
955 'status': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'choices': ['disable', 'enable'], 'type': 'str'}
956 }
957 },
958 'line-length': {
959 'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']],
960 'type': 'dict',
961 'options': {
962 'action': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'choices': ['allow', 'block'], 'type': 'str'},
963 'length': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'type': 'int'},
964 'log': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
965 'severity': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'choices': ['low', 'medium', 'high'], 'type': 'str'},
966 'status': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'choices': ['disable', 'enable'], 'type': 'str'}
967 }
968 },
969 'malformed': {
970 'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']],
971 'type': 'dict',
972 'options': {
973 'action': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'choices': ['allow', 'block'], 'type': 'str'},
974 'log': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
975 'severity': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'choices': ['low', 'medium', 'high'], 'type': 'str'},
976 'status': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'choices': ['disable', 'enable'], 'type': 'str'}
977 }
978 },
979 'max-cookie': {
980 'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']],
981 'type': 'dict',
982 'options': {
983 'action': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'choices': ['allow', 'block'], 'type': 'str'},
984 'log': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
985 'max-cookie': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'type': 'int'},
986 'severity': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'choices': ['low', 'medium', 'high'], 'type': 'str'},
987 'status': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'choices': ['disable', 'enable'], 'type': 'str'}
988 }
989 },
990 'max-header-line': {
991 'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']],
992 'type': 'dict',
993 'options': {
994 'action': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'choices': ['allow', 'block'], 'type': 'str'},
995 'log': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
996 'max-header-line': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'type': 'int'},
997 'severity': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'choices': ['low', 'medium', 'high'], 'type': 'str'},
998 'status': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'choices': ['disable', 'enable'], 'type': 'str'}
999 }
1000 },
1001 'max-range-segment': {
1002 'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']],
1003 'type': 'dict',
1004 'options': {
1005 'action': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'choices': ['allow', 'block'], 'type': 'str'},
1006 'log': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
1007 'max-range-segment': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'type': 'int'},
1008 'severity': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'choices': ['low', 'medium', 'high'], 'type': 'str'},
1009 'status': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'choices': ['disable', 'enable'], 'type': 'str'}
1010 }
1011 },
1012 'max-url-param': {
1013 'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']],
1014 'type': 'dict',
1015 'options': {
1016 'action': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'choices': ['allow', 'block'], 'type': 'str'},
1017 'log': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
1018 'max-url-param': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'type': 'int'},
1019 'severity': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'choices': ['low', 'medium', 'high'], 'type': 'str'},
1020 'status': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'choices': ['disable', 'enable'], 'type': 'str'}
1021 }
1022 },
1023 'method': {
1024 'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']],
1025 'type': 'dict',
1026 'options': {
1027 'action': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'choices': ['allow', 'block'], 'type': 'str'},
1028 'log': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
1029 'severity': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'choices': ['low', 'medium', 'high'], 'type': 'str'},
1030 'status': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'choices': ['disable', 'enable'], 'type': 'str'}
1031 }
1032 },
1033 'param-length': {
1034 'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']],
1035 'type': 'dict',
1036 'options': {
1037 'action': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'choices': ['allow', 'block'], 'type': 'str'},
1038 'length': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'type': 'int'},
1039 'log': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
1040 'severity': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'choices': ['low', 'medium', 'high'], 'type': 'str'},
1041 'status': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'choices': ['disable', 'enable'], 'type': 'str'}
1042 }
1043 },
1044 'url-param-length': {
1045 'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']],
1046 'type': 'dict',
1047 'options': {
1048 'action': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'choices': ['allow', 'block'], 'type': 'str'},
1049 'length': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'type': 'int'},
1050 'log': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
1051 'severity': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'choices': ['low', 'medium', 'high'], 'type': 'str'},
1052 'status': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'choices': ['disable', 'enable'], 'type': 'str'}
1053 }
1054 },
1055 'version': {
1056 'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']],
1057 'type': 'dict',
1058 'options': {
1059 'action': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'choices': ['allow', 'block'], 'type': 'str'},
1060 'log': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
1061 'severity': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'choices': ['low', 'medium', 'high'], 'type': 'str'},
1062 'status': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'choices': ['disable', 'enable'], 'type': 'str'}
1063 }
1064 }
1065 }
1066 },
1067 'method': {
1068 'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']],
1069 'type': 'dict',
1070 'options': {
1071 'default-allowed-methods': {
1072 'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']],
1073 'type': 'list',
1074 'choices': ['delete', 'get', 'head', 'options', 'post', 'put', 'trace', 'others', 'connect'],
1075 'elements': 'str'
1076 },
1077 'log': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
1078 'method-policy': {
1079 'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']],
1080 'type': 'list',
1081 'options': {
1082 'address': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'type': 'str'},
1083 'allowed-methods': {
1084 'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']],
1085 'type': 'list',
1086 'choices': ['delete', 'get', 'head', 'options', 'post', 'put', 'trace', 'others', 'connect'],
1087 'elements': 'str'
1088 },
1089 'id': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'type': 'int'},
1090 'pattern': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'type': 'str'},
1091 'regex': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'choices': ['disable', 'enable'], 'type': 'str'}
1092 },
1093 'elements': 'dict'
1094 },
1095 'severity': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'choices': ['low', 'medium', 'high'], 'type': 'str'},
1096 'status': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'choices': ['disable', 'enable'], 'type': 'str'}
1097 }
1098 },
1099 'signature': {
1100 'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']],
1101 'type': 'dict',
1102 'options': {
1103 'credit-card-detection-threshold': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'type': 'int'},
1104 'custom-signature': {
1105 'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']],
1106 'type': 'list',
1107 'options': {
1108 'action': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'choices': ['allow', 'block', 'erase'], 'type': 'str'},
1109 'case-sensitivity': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
1110 'direction': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'choices': ['request', 'response'], 'type': 'str'},
1111 'log': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
1112 'name': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'type': 'str'},
1113 'pattern': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'type': 'str'},
1114 'severity': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'choices': ['low', 'medium', 'high'], 'type': 'str'},
1115 'status': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
1116 'target': {
1117 'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']],
1118 'type': 'list',
1119 'choices': [
1120 'arg', 'arg-name', 'req-body', 'req-cookie', 'req-cookie-name', 'req-filename', 'req-header', 'req-header-name',
1121 'req-raw-uri', 'req-uri', 'resp-body', 'resp-hdr', 'resp-status'
1122 ],
1123 'elements': 'str'
1124 }
1125 },
1126 'elements': 'dict'
1127 },
1128 'disabled-signature': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'type': 'raw'},
1129 'disabled-sub-class': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'type': 'raw'},
1130 'main-class': {
1131 'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']],
1132 'type': 'dict',
1133 'options': {
1134 'action': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'choices': ['allow', 'block', 'erase'], 'type': 'str'},
1135 'id': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'type': 'int'},
1136 'log': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
1137 'severity': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'choices': ['low', 'medium', 'high'], 'type': 'str'},
1138 'status': {'v_range': [['6.2.8', '6.2.13'], ['6.4.5', '']], 'choices': ['disable', 'enable'], 'type': 'str'}
1139 }
1140 }
1141 }
1142 }
1143 }
1144 }
1145 }
1146
1147 module_option_spec = get_module_arg_spec('full crud')
1148 module_arg_spec.update(module_option_spec)
1149 check_galaxy_version(module_arg_spec)
1150 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'waf_profile'),
1151 supports_check_mode=True)
1152 if not module._socket_path:
1153 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
1154 connection = Connection(module._socket_path)
1155 fmgr = NAPIManager('full crud', module_arg_spec, urls_list,
1156 'name', 'data', module, connection)
1157 fmgr.process_crud()
1158 module.exit_json(meta=module.params)
1159
1160
1161 if __name__ == '__main__':
1162 main()