Debian Codegraph @

ansible_collections/fortinet/fortios/plugins/modules/fortios_firewall_vip6.py

raw symbols SCIP
1 #!/usr/bin/python
2 from __future__ import absolute_import, division, print_function
3
4 # Copyright: (c) 2022 Fortinet
5 # GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)
6 #
7 # This program is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation, either version 3 of the License, or
10 # (at your option) any later version.
11
12 __metaclass__ = type
13
14 ANSIBLE_METADATA = {
15 "status": ["preview"],
16 "supported_by": "community",
17 "metadata_version": "1.1",
18 }
19
20 DOCUMENTATION = """
21 ---
22 module: fortios_firewall_vip6
23 short_description: Configure virtual IP for IPv6 in Fortinet's FortiOS and FortiGate.
24 description:
25 - This module is able to configure a FortiGate or FortiOS (FOS) device by allowing the
26 user to set and modify firewall feature and vip6 category.
27 Examples include all parameters and values need to be adjusted to datasources before usage.
28 Tested with FOS v6.0.0
29 version_added: "2.0.0"
30 author:
31 - Link Zheng (@chillancezen)
32 - Jie Xue (@JieX19)
33 - Hongbin Lu (@fgtdev-hblu)
34 - Frank Shen (@frankshen01)
35 - Miguel Angel Munoz (@mamunozgonzalez)
36 - Nicolas Thomas (@thomnico)
37 notes:
38 - Legacy fortiosapi has been deprecated, httpapi is the preferred way to run playbooks
39
40 - The module supports check_mode.
41
42 requirements:
43 - ansible>=2.16
44 options:
45 access_token:
46 description:
47 - Token-based authentication.
48 Generated from GUI of Fortigate.
49 type: str
50 required: false
51 enable_log:
52 description:
53 - Enable/Disable logging for task.
54 type: bool
55 required: false
56 default: false
57 vdom:
58 description:
59 - Virtual domain, among those defined previously. A vdom is a
60 virtual instance of the FortiGate that can be configured and
61 used as a different unit.
62 type: str
63 default: root
64 member_path:
65 type: str
66 description:
67 - Member attribute path to operate on.
68 - Delimited by a slash character if there are more than one attribute.
69 - Parameter marked with member_path is legitimate for doing member operation.
70 member_state:
71 type: str
72 description:
73 - Add or delete a member under specified attribute path.
74 - When member_state is specified, the state option is ignored.
75 choices:
76 - 'present'
77 - 'absent'
78
79 state:
80 description:
81 - Indicates whether to create or remove the object.
82 type: str
83 required: true
84 choices:
85 - 'present'
86 - 'absent'
87 firewall_vip6:
88 description:
89 - Configure virtual IP for IPv6.
90 default: null
91 type: dict
92 suboptions:
93 add_nat64_route:
94 description:
95 - Enable/disable adding NAT64 route.
96 type: str
97 choices:
98 - 'disable'
99 - 'enable'
100 arp_reply:
101 description:
102 - Enable to respond to ARP requests for this virtual IP address. Enabled by default.
103 type: str
104 choices:
105 - 'disable'
106 - 'enable'
107 client_cert:
108 description:
109 - Enable/disable requesting client certificate.
110 type: str
111 choices:
112 - 'disable'
113 - 'enable'
114 color:
115 description:
116 - Color of icon on the GUI.
117 type: int
118 comment:
119 description:
120 - Comment.
121 type: str
122 embedded_ipv4_address:
123 description:
124 - Enable/disable use of the lower 32 bits of the external IPv6 address as mapped IPv4 address.
125 type: str
126 choices:
127 - 'disable'
128 - 'enable'
129 empty_cert_action:
130 description:
131 - Action for an empty client certificate.
132 type: str
133 choices:
134 - 'accept'
135 - 'block'
136 - 'accept-unmanageable'
137 extip:
138 description:
139 - IPv6 address or address range on the external interface that you want to map to an address or address range on the destination network.
140 type: str
141 extport:
142 description:
143 - Incoming port number range that you want to map to a port number range on the destination network.
144 type: str
145 h2_support:
146 description:
147 - Enable/disable HTTP2 support .
148 type: str
149 choices:
150 - 'enable'
151 - 'disable'
152 h3_support:
153 description:
154 - Enable/disable HTTP3/QUIC support .
155 type: str
156 choices:
157 - 'enable'
158 - 'disable'
159 http_cookie_age:
160 description:
161 - Time in minutes that client web browsers should keep a cookie. Default is 60 minutes. 0 = no time limit.
162 type: int
163 http_cookie_domain:
164 description:
165 - Domain that HTTP cookie persistence should apply to.
166 type: str
167 http_cookie_domain_from_host:
168 description:
169 - Enable/disable use of HTTP cookie domain from host field in HTTP.
170 type: str
171 choices:
172 - 'disable'
173 - 'enable'
174 http_cookie_generation:
175 description:
176 - Generation of HTTP cookie to be accepted. Changing invalidates all existing cookies.
177 type: int
178 http_cookie_path:
179 description:
180 - Limit HTTP cookie persistence to the specified path.
181 type: str
182 http_cookie_share:
183 description:
184 - Control sharing of cookies across virtual servers. Use of same-ip means a cookie from one virtual server can be used by another. Disable
185 stops cookie sharing.
186 type: str
187 choices:
188 - 'disable'
189 - 'same-ip'
190 http_ip_header:
191 description:
192 - For HTTP multiplexing, enable to add the original client IP address in the X-Forwarded-For HTTP header.
193 type: str
194 choices:
195 - 'enable'
196 - 'disable'
197 http_ip_header_name:
198 description:
199 - For HTTP multiplexing, enter a custom HTTPS header name. The original client IP address is added to this header. If empty,
200 X-Forwarded-For is used.
201 type: str
202 http_multiplex:
203 description:
204 - Enable/disable HTTP multiplexing.
205 type: str
206 choices:
207 - 'enable'
208 - 'disable'
209 http_redirect:
210 description:
211 - Enable/disable redirection of HTTP to HTTPS.
212 type: str
213 choices:
214 - 'enable'
215 - 'disable'
216 https_cookie_secure:
217 description:
218 - Enable/disable verification that inserted HTTPS cookies are secure.
219 type: str
220 choices:
221 - 'disable'
222 - 'enable'
223 id:
224 description:
225 - Custom defined ID.
226 type: int
227 ipv4_mappedip:
228 description:
229 - Range of mapped IP addresses. Specify the start IP address followed by a space and the end IP address.
230 type: str
231 ipv4_mappedport:
232 description:
233 - IPv4 port number range on the destination network to which the external port number range is mapped.
234 type: str
235 ldb_method:
236 description:
237 - Method used to distribute sessions to real servers.
238 type: str
239 choices:
240 - 'static'
241 - 'round-robin'
242 - 'weighted'
243 - 'least-session'
244 - 'least-rtt'
245 - 'first-alive'
246 - 'http-host'
247 mappedip:
248 description:
249 - Mapped IPv6 address range in the format startIP-endIP.
250 type: str
251 mappedport:
252 description:
253 - Port number range on the destination network to which the external port number range is mapped.
254 type: str
255 max_embryonic_connections:
256 description:
257 - Maximum number of incomplete connections.
258 type: int
259 monitor:
260 description:
261 - Name of the health check monitor to use when polling to determine a virtual server"s connectivity status.
262 type: list
263 elements: dict
264 suboptions:
265 name:
266 description:
267 - Health monitor name. Source firewall.ldb-monitor.name.
268 required: true
269 type: str
270 name:
271 description:
272 - Virtual ip6 name.
273 required: true
274 type: str
275 nat_source_vip:
276 description:
277 - Enable to perform SNAT on traffic from mappedip to the extip for all egress interfaces.
278 type: str
279 choices:
280 - 'disable'
281 - 'enable'
282 nat64:
283 description:
284 - Enable/disable DNAT64.
285 type: str
286 choices:
287 - 'disable'
288 - 'enable'
289 nat66:
290 description:
291 - Enable/disable DNAT66.
292 type: str
293 choices:
294 - 'disable'
295 - 'enable'
296 ndp_reply:
297 description:
298 - Enable/disable this FortiGate unit"s ability to respond to NDP requests for this virtual IP address .
299 type: str
300 choices:
301 - 'disable'
302 - 'enable'
303 outlook_web_access:
304 description:
305 - Enable to add the Front-End-Https header for Microsoft Outlook Web Access.
306 type: str
307 choices:
308 - 'disable'
309 - 'enable'
310 persistence:
311 description:
312 - Configure how to make sure that clients connect to the same server every time they make a request that is part of the same session.
313 type: str
314 choices:
315 - 'none'
316 - 'http-cookie'
317 - 'ssl-session-id'
318 portforward:
319 description:
320 - Enable port forwarding.
321 type: str
322 choices:
323 - 'disable'
324 - 'enable'
325 protocol:
326 description:
327 - Protocol to use when forwarding packets.
328 type: str
329 choices:
330 - 'tcp'
331 - 'udp'
332 - 'sctp'
333 quic:
334 description:
335 - QUIC setting.
336 type: dict
337 suboptions:
338 ack_delay_exponent:
339 description:
340 - ACK delay exponent (1 - 20).
341 type: int
342 active_connection_id_limit:
343 description:
344 - Active connection ID limit (1 - 8).
345 type: int
346 active_migration:
347 description:
348 - Enable/disable active migration .
349 type: str
350 choices:
351 - 'enable'
352 - 'disable'
353 grease_quic_bit:
354 description:
355 - Enable/disable grease QUIC bit .
356 type: str
357 choices:
358 - 'enable'
359 - 'disable'
360 max_ack_delay:
361 description:
362 - Maximum ACK delay in milliseconds (1 - 16383).
363 type: int
364 max_datagram_frame_size:
365 description:
366 - Maximum datagram frame size in bytes (1 - 1500).
367 type: int
368 max_idle_timeout:
369 description:
370 - Maximum idle timeout milliseconds (1 - 60000).
371 type: int
372 max_udp_payload_size:
373 description:
374 - Maximum UDP payload size in bytes (1200 - 1500).
375 type: int
376 realservers:
377 description:
378 - Select the real servers that this server load balancing VIP will distribute traffic to.
379 type: list
380 elements: dict
381 suboptions:
382 client_ip:
383 description:
384 - Only clients in this IP range can connect to this real server.
385 type: str
386 healthcheck:
387 description:
388 - Enable to check the responsiveness of the real server before forwarding traffic.
389 type: str
390 choices:
391 - 'disable'
392 - 'enable'
393 - 'vip'
394 holddown_interval:
395 description:
396 - Time in seconds that the system waits before re-activating a previously down active server in the active-standby mode. This is
397 to prevent any flapping issues.
398 type: int
399 http_host:
400 description:
401 - HTTP server domain name in HTTP header.
402 type: str
403 id:
404 description:
405 - Real server ID. see <a href='#notes'>Notes</a>.
406 required: true
407 type: int
408 ip:
409 description:
410 - IP address of the real server.
411 type: str
412 max_connections:
413 description:
414 - Max number of active connections that can directed to the real server. When reached, sessions are sent to other real servers.
415 type: int
416 monitor:
417 description:
418 - Name of the health check monitor to use when polling to determine a virtual server"s connectivity status. Source firewall
419 .ldb-monitor.name.
420 type: list
421 elements: dict
422 suboptions:
423 name:
424 description:
425 - Health monitor name. Source firewall.ldb-monitor.name.
426 required: true
427 type: str
428 port:
429 description:
430 - Port for communicating with the real server. Required if port forwarding is enabled.
431 type: int
432 status:
433 description:
434 - Set the status of the real server to active so that it can accept traffic, or on standby or disabled so no traffic is sent.
435 type: str
436 choices:
437 - 'active'
438 - 'standby'
439 - 'disable'
440 translate_host:
441 description:
442 - Enable/disable translation of hostname/IP from virtual server to real server.
443 type: str
444 choices:
445 - 'enable'
446 - 'disable'
447 verify_cert:
448 description:
449 - Enable/disable certificate verification of the real server.
450 type: str
451 choices:
452 - 'enable'
453 - 'disable'
454 weight:
455 description:
456 - Weight of the real server. If weighted load balancing is enabled, the server with the highest weight gets more connections.
457 type: int
458 server_type:
459 description:
460 - Protocol to be load balanced by the virtual server (also called the server load balance virtual IP).
461 type: str
462 choices:
463 - 'http'
464 - 'https'
465 - 'imaps'
466 - 'pop3s'
467 - 'smtps'
468 - 'ssl'
469 - 'tcp'
470 - 'udp'
471 - 'ip'
472 src_filter:
473 description:
474 - 'Source IP6 filter (x:x:x:x:x:x:x:x/x). Separate addresses with spaces.'
475 type: list
476 elements: dict
477 suboptions:
478 range:
479 description:
480 - Source-filter range.
481 required: true
482 type: str
483 src_vip_filter:
484 description:
485 - Enable/disable use of "src-filter" to match destinations for the reverse SNAT rule.
486 type: str
487 choices:
488 - 'disable'
489 - 'enable'
490 ssl_accept_ffdhe_groups:
491 description:
492 - Enable/disable FFDHE cipher suite for SSL key exchange.
493 type: str
494 choices:
495 - 'enable'
496 - 'disable'
497 ssl_algorithm:
498 description:
499 - Permitted encryption algorithms for SSL sessions according to encryption strength.
500 type: str
501 choices:
502 - 'high'
503 - 'medium'
504 - 'low'
505 - 'custom'
506 ssl_certificate:
507 description:
508 - The name of the certificate to use for SSL handshake. Source vpn.certificate.local.name.
509 type: str
510 ssl_certificate_dict:
511 description:
512 - Name of the certificate to use for SSL handshake.
513 type: list
514 elements: dict
515 suboptions:
516 name:
517 description:
518 - Certificate list. Source vpn.certificate.local.name.
519 required: true
520 type: str
521 ssl_cipher_suites:
522 description:
523 - SSL/TLS cipher suites acceptable from a client, ordered by priority.
524 type: list
525 elements: dict
526 suboptions:
527 cipher:
528 description:
529 - Cipher suite name.
530 type: str
531 choices:
532 - 'TLS-AES-128-GCM-SHA256'
533 - 'TLS-AES-256-GCM-SHA384'
534 - 'TLS-CHACHA20-POLY1305-SHA256'
535 - 'TLS-ECDHE-RSA-WITH-CHACHA20-POLY1305-SHA256'
536 - 'TLS-ECDHE-ECDSA-WITH-CHACHA20-POLY1305-SHA256'
537 - 'TLS-DHE-RSA-WITH-CHACHA20-POLY1305-SHA256'
538 - 'TLS-DHE-RSA-WITH-AES-128-CBC-SHA'
539 - 'TLS-DHE-RSA-WITH-AES-256-CBC-SHA'
540 - 'TLS-DHE-RSA-WITH-AES-128-CBC-SHA256'
541 - 'TLS-DHE-RSA-WITH-AES-128-GCM-SHA256'
542 - 'TLS-DHE-RSA-WITH-AES-256-CBC-SHA256'
543 - 'TLS-DHE-RSA-WITH-AES-256-GCM-SHA384'
544 - 'TLS-DHE-DSS-WITH-AES-128-CBC-SHA'
545 - 'TLS-DHE-DSS-WITH-AES-256-CBC-SHA'
546 - 'TLS-DHE-DSS-WITH-AES-128-CBC-SHA256'
547 - 'TLS-DHE-DSS-WITH-AES-128-GCM-SHA256'
548 - 'TLS-DHE-DSS-WITH-AES-256-CBC-SHA256'
549 - 'TLS-DHE-DSS-WITH-AES-256-GCM-SHA384'
550 - 'TLS-ECDHE-RSA-WITH-AES-128-CBC-SHA'
551 - 'TLS-ECDHE-RSA-WITH-AES-128-CBC-SHA256'
552 - 'TLS-ECDHE-RSA-WITH-AES-128-GCM-SHA256'
553 - 'TLS-ECDHE-RSA-WITH-AES-256-CBC-SHA'
554 - 'TLS-ECDHE-RSA-WITH-AES-256-CBC-SHA384'
555 - 'TLS-ECDHE-RSA-WITH-AES-256-GCM-SHA384'
556 - 'TLS-ECDHE-ECDSA-WITH-AES-128-CBC-SHA'
557 - 'TLS-ECDHE-ECDSA-WITH-AES-128-CBC-SHA256'
558 - 'TLS-ECDHE-ECDSA-WITH-AES-128-GCM-SHA256'
559 - 'TLS-ECDHE-ECDSA-WITH-AES-256-CBC-SHA'
560 - 'TLS-ECDHE-ECDSA-WITH-AES-256-CBC-SHA384'
561 - 'TLS-ECDHE-ECDSA-WITH-AES-256-GCM-SHA384'
562 - 'TLS-RSA-WITH-AES-128-CBC-SHA'
563 - 'TLS-RSA-WITH-AES-256-CBC-SHA'
564 - 'TLS-RSA-WITH-AES-128-CBC-SHA256'
565 - 'TLS-RSA-WITH-AES-128-GCM-SHA256'
566 - 'TLS-RSA-WITH-AES-256-CBC-SHA256'
567 - 'TLS-RSA-WITH-AES-256-GCM-SHA384'
568 - 'TLS-RSA-WITH-CAMELLIA-128-CBC-SHA'
569 - 'TLS-RSA-WITH-CAMELLIA-256-CBC-SHA'
570 - 'TLS-RSA-WITH-CAMELLIA-128-CBC-SHA256'
571 - 'TLS-RSA-WITH-CAMELLIA-256-CBC-SHA256'
572 - 'TLS-DHE-RSA-WITH-3DES-EDE-CBC-SHA'
573 - 'TLS-DHE-RSA-WITH-CAMELLIA-128-CBC-SHA'
574 - 'TLS-DHE-DSS-WITH-CAMELLIA-128-CBC-SHA'
575 - 'TLS-DHE-RSA-WITH-CAMELLIA-256-CBC-SHA'
576 - 'TLS-DHE-DSS-WITH-CAMELLIA-256-CBC-SHA'
577 - 'TLS-DHE-RSA-WITH-CAMELLIA-128-CBC-SHA256'
578 - 'TLS-DHE-DSS-WITH-CAMELLIA-128-CBC-SHA256'
579 - 'TLS-DHE-RSA-WITH-CAMELLIA-256-CBC-SHA256'
580 - 'TLS-DHE-DSS-WITH-CAMELLIA-256-CBC-SHA256'
581 - 'TLS-DHE-RSA-WITH-SEED-CBC-SHA'
582 - 'TLS-DHE-DSS-WITH-SEED-CBC-SHA'
583 - 'TLS-DHE-RSA-WITH-ARIA-128-CBC-SHA256'
584 - 'TLS-DHE-RSA-WITH-ARIA-256-CBC-SHA384'
585 - 'TLS-DHE-DSS-WITH-ARIA-128-CBC-SHA256'
586 - 'TLS-DHE-DSS-WITH-ARIA-256-CBC-SHA384'
587 - 'TLS-RSA-WITH-SEED-CBC-SHA'
588 - 'TLS-RSA-WITH-ARIA-128-CBC-SHA256'
589 - 'TLS-RSA-WITH-ARIA-256-CBC-SHA384'
590 - 'TLS-ECDHE-RSA-WITH-ARIA-128-CBC-SHA256'
591 - 'TLS-ECDHE-RSA-WITH-ARIA-256-CBC-SHA384'
592 - 'TLS-ECDHE-ECDSA-WITH-ARIA-128-CBC-SHA256'
593 - 'TLS-ECDHE-ECDSA-WITH-ARIA-256-CBC-SHA384'
594 - 'TLS-ECDHE-RSA-WITH-RC4-128-SHA'
595 - 'TLS-ECDHE-RSA-WITH-3DES-EDE-CBC-SHA'
596 - 'TLS-DHE-DSS-WITH-3DES-EDE-CBC-SHA'
597 - 'TLS-RSA-WITH-3DES-EDE-CBC-SHA'
598 - 'TLS-RSA-WITH-RC4-128-MD5'
599 - 'TLS-RSA-WITH-RC4-128-SHA'
600 - 'TLS-DHE-RSA-WITH-DES-CBC-SHA'
601 - 'TLS-DHE-DSS-WITH-DES-CBC-SHA'
602 - 'TLS-RSA-WITH-DES-CBC-SHA'
603 priority:
604 description:
605 - SSL/TLS cipher suites priority. see <a href='#notes'>Notes</a>.
606 required: true
607 type: int
608 versions:
609 description:
610 - SSL/TLS versions that the cipher suite can be used with.
611 type: list
612 elements: str
613 choices:
614 - 'ssl-3.0'
615 - 'tls-1.0'
616 - 'tls-1.1'
617 - 'tls-1.2'
618 - 'tls-1.3'
619 ssl_client_fallback:
620 description:
621 - Enable/disable support for preventing Downgrade Attacks on client connections (RFC 7507).
622 type: str
623 choices:
624 - 'disable'
625 - 'enable'
626 ssl_client_rekey_count:
627 description:
628 - Maximum length of data in MB before triggering a client rekey (0 = disable).
629 type: int
630 ssl_client_renegotiation:
631 description:
632 - Allow, deny, or require secure renegotiation of client sessions to comply with RFC 5746.
633 type: str
634 choices:
635 - 'allow'
636 - 'deny'
637 - 'secure'
638 ssl_client_session_state_max:
639 description:
640 - Maximum number of client to FortiGate SSL session states to keep.
641 type: int
642 ssl_client_session_state_timeout:
643 description:
644 - Number of minutes to keep client to FortiGate SSL session state.
645 type: int
646 ssl_client_session_state_type:
647 description:
648 - How to expire SSL sessions for the segment of the SSL connection between the client and the FortiGate.
649 type: str
650 choices:
651 - 'disable'
652 - 'time'
653 - 'count'
654 - 'both'
655 ssl_dh_bits:
656 description:
657 - Number of bits to use in the Diffie-Hellman exchange for RSA encryption of SSL sessions.
658 type: str
659 choices:
660 - '768'
661 - '1024'
662 - '1536'
663 - '2048'
664 - '3072'
665 - '4096'
666 ssl_hpkp:
667 description:
668 - Enable/disable including HPKP header in response.
669 type: str
670 choices:
671 - 'disable'
672 - 'enable'
673 - 'report-only'
674 ssl_hpkp_age:
675 description:
676 - Number of minutes the web browser should keep HPKP.
677 type: int
678 ssl_hpkp_backup:
679 description:
680 - Certificate to generate backup HPKP pin from. Source vpn.certificate.local.name vpn.certificate.ca.name.
681 type: str
682 ssl_hpkp_include_subdomains:
683 description:
684 - Indicate that HPKP header applies to all subdomains.
685 type: str
686 choices:
687 - 'disable'
688 - 'enable'
689 ssl_hpkp_primary:
690 description:
691 - Certificate to generate primary HPKP pin from. Source vpn.certificate.local.name vpn.certificate.ca.name.
692 type: str
693 ssl_hpkp_report_uri:
694 description:
695 - URL to report HPKP violations to.
696 type: str
697 ssl_hsts:
698 description:
699 - Enable/disable including HSTS header in response.
700 type: str
701 choices:
702 - 'disable'
703 - 'enable'
704 ssl_hsts_age:
705 description:
706 - Number of seconds the client should honor the HSTS setting.
707 type: int
708 ssl_hsts_include_subdomains:
709 description:
710 - Indicate that HSTS header applies to all subdomains.
711 type: str
712 choices:
713 - 'disable'
714 - 'enable'
715 ssl_http_location_conversion:
716 description:
717 - Enable to replace HTTP with HTTPS in the reply"s Location HTTP header field.
718 type: str
719 choices:
720 - 'enable'
721 - 'disable'
722 ssl_http_match_host:
723 description:
724 - Enable/disable HTTP host matching for location conversion.
725 type: str
726 choices:
727 - 'enable'
728 - 'disable'
729 ssl_max_version:
730 description:
731 - Highest SSL/TLS version acceptable from a client.
732 type: str
733 choices:
734 - 'ssl-3.0'
735 - 'tls-1.0'
736 - 'tls-1.1'
737 - 'tls-1.2'
738 - 'tls-1.3'
739 ssl_min_version:
740 description:
741 - Lowest SSL/TLS version acceptable from a client.
742 type: str
743 choices:
744 - 'ssl-3.0'
745 - 'tls-1.0'
746 - 'tls-1.1'
747 - 'tls-1.2'
748 - 'tls-1.3'
749 ssl_mode:
750 description:
751 - Apply SSL offloading between the client and the FortiGate (half) or from the client to the FortiGate and from the FortiGate to the
752 server (full).
753 type: str
754 choices:
755 - 'half'
756 - 'full'
757 ssl_pfs:
758 description:
759 - Select the cipher suites that can be used for SSL perfect forward secrecy (PFS). Applies to both client and server sessions.
760 type: str
761 choices:
762 - 'require'
763 - 'deny'
764 - 'allow'
765 ssl_send_empty_frags:
766 description:
767 - Enable/disable sending empty fragments to avoid CBC IV attacks (SSL 3.0 & TLS 1.0 only). May need to be disabled for compatibility with
768 older systems.
769 type: str
770 choices:
771 - 'enable'
772 - 'disable'
773 ssl_server_algorithm:
774 description:
775 - Permitted encryption algorithms for the server side of SSL full mode sessions according to encryption strength.
776 type: str
777 choices:
778 - 'high'
779 - 'medium'
780 - 'low'
781 - 'custom'
782 - 'client'
783 ssl_server_cipher_suites:
784 description:
785 - SSL/TLS cipher suites to offer to a server, ordered by priority.
786 type: list
787 elements: dict
788 suboptions:
789 cipher:
790 description:
791 - Cipher suite name.
792 type: str
793 choices:
794 - 'TLS-AES-128-GCM-SHA256'
795 - 'TLS-AES-256-GCM-SHA384'
796 - 'TLS-CHACHA20-POLY1305-SHA256'
797 - 'TLS-ECDHE-RSA-WITH-CHACHA20-POLY1305-SHA256'
798 - 'TLS-ECDHE-ECDSA-WITH-CHACHA20-POLY1305-SHA256'
799 - 'TLS-DHE-RSA-WITH-CHACHA20-POLY1305-SHA256'
800 - 'TLS-DHE-RSA-WITH-AES-128-CBC-SHA'
801 - 'TLS-DHE-RSA-WITH-AES-256-CBC-SHA'
802 - 'TLS-DHE-RSA-WITH-AES-128-CBC-SHA256'
803 - 'TLS-DHE-RSA-WITH-AES-128-GCM-SHA256'
804 - 'TLS-DHE-RSA-WITH-AES-256-CBC-SHA256'
805 - 'TLS-DHE-RSA-WITH-AES-256-GCM-SHA384'
806 - 'TLS-DHE-DSS-WITH-AES-128-CBC-SHA'
807 - 'TLS-DHE-DSS-WITH-AES-256-CBC-SHA'
808 - 'TLS-DHE-DSS-WITH-AES-128-CBC-SHA256'
809 - 'TLS-DHE-DSS-WITH-AES-128-GCM-SHA256'
810 - 'TLS-DHE-DSS-WITH-AES-256-CBC-SHA256'
811 - 'TLS-DHE-DSS-WITH-AES-256-GCM-SHA384'
812 - 'TLS-ECDHE-RSA-WITH-AES-128-CBC-SHA'
813 - 'TLS-ECDHE-RSA-WITH-AES-128-CBC-SHA256'
814 - 'TLS-ECDHE-RSA-WITH-AES-128-GCM-SHA256'
815 - 'TLS-ECDHE-RSA-WITH-AES-256-CBC-SHA'
816 - 'TLS-ECDHE-RSA-WITH-AES-256-CBC-SHA384'
817 - 'TLS-ECDHE-RSA-WITH-AES-256-GCM-SHA384'
818 - 'TLS-ECDHE-ECDSA-WITH-AES-128-CBC-SHA'
819 - 'TLS-ECDHE-ECDSA-WITH-AES-128-CBC-SHA256'
820 - 'TLS-ECDHE-ECDSA-WITH-AES-128-GCM-SHA256'
821 - 'TLS-ECDHE-ECDSA-WITH-AES-256-CBC-SHA'
822 - 'TLS-ECDHE-ECDSA-WITH-AES-256-CBC-SHA384'
823 - 'TLS-ECDHE-ECDSA-WITH-AES-256-GCM-SHA384'
824 - 'TLS-RSA-WITH-AES-128-CBC-SHA'
825 - 'TLS-RSA-WITH-AES-256-CBC-SHA'
826 - 'TLS-RSA-WITH-AES-128-CBC-SHA256'
827 - 'TLS-RSA-WITH-AES-128-GCM-SHA256'
828 - 'TLS-RSA-WITH-AES-256-CBC-SHA256'
829 - 'TLS-RSA-WITH-AES-256-GCM-SHA384'
830 - 'TLS-RSA-WITH-CAMELLIA-128-CBC-SHA'
831 - 'TLS-RSA-WITH-CAMELLIA-256-CBC-SHA'
832 - 'TLS-RSA-WITH-CAMELLIA-128-CBC-SHA256'
833 - 'TLS-RSA-WITH-CAMELLIA-256-CBC-SHA256'
834 - 'TLS-DHE-RSA-WITH-3DES-EDE-CBC-SHA'
835 - 'TLS-DHE-RSA-WITH-CAMELLIA-128-CBC-SHA'
836 - 'TLS-DHE-DSS-WITH-CAMELLIA-128-CBC-SHA'
837 - 'TLS-DHE-RSA-WITH-CAMELLIA-256-CBC-SHA'
838 - 'TLS-DHE-DSS-WITH-CAMELLIA-256-CBC-SHA'
839 - 'TLS-DHE-RSA-WITH-CAMELLIA-128-CBC-SHA256'
840 - 'TLS-DHE-DSS-WITH-CAMELLIA-128-CBC-SHA256'
841 - 'TLS-DHE-RSA-WITH-CAMELLIA-256-CBC-SHA256'
842 - 'TLS-DHE-DSS-WITH-CAMELLIA-256-CBC-SHA256'
843 - 'TLS-DHE-RSA-WITH-SEED-CBC-SHA'
844 - 'TLS-DHE-DSS-WITH-SEED-CBC-SHA'
845 - 'TLS-DHE-RSA-WITH-ARIA-128-CBC-SHA256'
846 - 'TLS-DHE-RSA-WITH-ARIA-256-CBC-SHA384'
847 - 'TLS-DHE-DSS-WITH-ARIA-128-CBC-SHA256'
848 - 'TLS-DHE-DSS-WITH-ARIA-256-CBC-SHA384'
849 - 'TLS-RSA-WITH-SEED-CBC-SHA'
850 - 'TLS-RSA-WITH-ARIA-128-CBC-SHA256'
851 - 'TLS-RSA-WITH-ARIA-256-CBC-SHA384'
852 - 'TLS-ECDHE-RSA-WITH-ARIA-128-CBC-SHA256'
853 - 'TLS-ECDHE-RSA-WITH-ARIA-256-CBC-SHA384'
854 - 'TLS-ECDHE-ECDSA-WITH-ARIA-128-CBC-SHA256'
855 - 'TLS-ECDHE-ECDSA-WITH-ARIA-256-CBC-SHA384'
856 - 'TLS-ECDHE-RSA-WITH-RC4-128-SHA'
857 - 'TLS-ECDHE-RSA-WITH-3DES-EDE-CBC-SHA'
858 - 'TLS-DHE-DSS-WITH-3DES-EDE-CBC-SHA'
859 - 'TLS-RSA-WITH-3DES-EDE-CBC-SHA'
860 - 'TLS-RSA-WITH-RC4-128-MD5'
861 - 'TLS-RSA-WITH-RC4-128-SHA'
862 - 'TLS-DHE-RSA-WITH-DES-CBC-SHA'
863 - 'TLS-DHE-DSS-WITH-DES-CBC-SHA'
864 - 'TLS-RSA-WITH-DES-CBC-SHA'
865 priority:
866 description:
867 - SSL/TLS cipher suites priority. see <a href='#notes'>Notes</a>.
868 required: true
869 type: int
870 versions:
871 description:
872 - SSL/TLS versions that the cipher suite can be used with.
873 type: list
874 elements: str
875 choices:
876 - 'ssl-3.0'
877 - 'tls-1.0'
878 - 'tls-1.1'
879 - 'tls-1.2'
880 - 'tls-1.3'
881 ssl_server_max_version:
882 description:
883 - Highest SSL/TLS version acceptable from a server. Use the client setting by default.
884 type: str
885 choices:
886 - 'ssl-3.0'
887 - 'tls-1.0'
888 - 'tls-1.1'
889 - 'tls-1.2'
890 - 'tls-1.3'
891 - 'client'
892 ssl_server_min_version:
893 description:
894 - Lowest SSL/TLS version acceptable from a server. Use the client setting by default.
895 type: str
896 choices:
897 - 'ssl-3.0'
898 - 'tls-1.0'
899 - 'tls-1.1'
900 - 'tls-1.2'
901 - 'tls-1.3'
902 - 'client'
903 ssl_server_renegotiation:
904 description:
905 - Enable/disable secure renegotiation to comply with RFC 5746.
906 type: str
907 choices:
908 - 'enable'
909 - 'disable'
910 ssl_server_session_state_max:
911 description:
912 - Maximum number of FortiGate to Server SSL session states to keep.
913 type: int
914 ssl_server_session_state_timeout:
915 description:
916 - Number of minutes to keep FortiGate to Server SSL session state.
917 type: int
918 ssl_server_session_state_type:
919 description:
920 - How to expire SSL sessions for the segment of the SSL connection between the server and the FortiGate.
921 type: str
922 choices:
923 - 'disable'
924 - 'time'
925 - 'count'
926 - 'both'
927 type:
928 description:
929 - Configure a static NAT server load balance VIP or access proxy.
930 type: str
931 choices:
932 - 'static-nat'
933 - 'server-load-balance'
934 - 'access-proxy'
935 user_agent_detect:
936 description:
937 - Enable/disable detecting device type by HTTP user-agent if no client certificate is provided.
938 type: str
939 choices:
940 - 'disable'
941 - 'enable'
942 uuid:
943 description:
944 - Universally Unique Identifier (UUID; automatically assigned but can be manually reset).
945 type: str
946 weblogic_server:
947 description:
948 - Enable to add an HTTP header to indicate SSL offloading for a WebLogic server.
949 type: str
950 choices:
951 - 'disable'
952 - 'enable'
953 websphere_server:
954 description:
955 - Enable to add an HTTP header to indicate SSL offloading for a WebSphere server.
956 type: str
957 choices:
958 - 'disable'
959 - 'enable'
960 """
961
962 EXAMPLES = """
963 - name: Configure virtual IP for IPv6.
964 fortinet.fortios.fortios_firewall_vip6:
965 vdom: "{{ vdom }}"
966 state: "present"
967 access_token: "<your_own_value>"
968 firewall_vip6:
969 add_nat64_route: "disable"
970 arp_reply: "disable"
971 client_cert: "disable"
972 color: "0"
973 comment: "Comment."
974 embedded_ipv4_address: "disable"
975 empty_cert_action: "accept"
976 extip: "<your_own_value>"
977 extport: "<your_own_value>"
978 h2_support: "enable"
979 h3_support: "enable"
980 http_cookie_age: "60"
981 http_cookie_domain: "<your_own_value>"
982 http_cookie_domain_from_host: "disable"
983 http_cookie_generation: "0"
984 http_cookie_path: "<your_own_value>"
985 http_cookie_share: "disable"
986 http_ip_header: "enable"
987 http_ip_header_name: "<your_own_value>"
988 http_multiplex: "enable"
989 http_redirect: "enable"
990 https_cookie_secure: "disable"
991 id: "25"
992 ipv4_mappedip: "<your_own_value>"
993 ipv4_mappedport: "<your_own_value>"
994 ldb_method: "static"
995 mappedip: "<your_own_value>"
996 mappedport: "<your_own_value>"
997 max_embryonic_connections: "1000"
998 monitor:
999 -
1000 name: "default_name_33 (source firewall.ldb-monitor.name)"
1001 name: "default_name_34"
1002 nat_source_vip: "disable"
1003 nat64: "disable"
1004 nat66: "disable"
1005 ndp_reply: "disable"
1006 outlook_web_access: "disable"
1007 persistence: "none"
1008 portforward: "disable"
1009 protocol: "tcp"
1010 quic:
1011 ack_delay_exponent: "3"
1012 active_connection_id_limit: "2"
1013 active_migration: "enable"
1014 grease_quic_bit: "enable"
1015 max_ack_delay: "25"
1016 max_datagram_frame_size: "1500"
1017 max_idle_timeout: "30000"
1018 max_udp_payload_size: "1500"
1019 realservers:
1020 -
1021 client_ip: "<your_own_value>"
1022 healthcheck: "disable"
1023 holddown_interval: "300"
1024 http_host: "myhostname"
1025 id: "57"
1026 ip: "<your_own_value>"
1027 max_connections: "0"
1028 monitor:
1029 -
1030 name: "default_name_61 (source firewall.ldb-monitor.name)"
1031 port: "0"
1032 status: "active"
1033 translate_host: "enable"
1034 verify_cert: "enable"
1035 weight: "1"
1036 server_type: "http"
1037 src_filter:
1038 -
1039 range: "<your_own_value>"
1040 src_vip_filter: "disable"
1041 ssl_accept_ffdhe_groups: "enable"
1042 ssl_algorithm: "high"
1043 ssl_certificate: "<your_own_value> (source vpn.certificate.local.name)"
1044 ssl_certificate_dict:
1045 -
1046 name: "default_name_75 (source vpn.certificate.local.name)"
1047 ssl_cipher_suites:
1048 -
1049 cipher: "TLS-AES-128-GCM-SHA256"
1050 priority: "<you_own_value>"
1051 versions: "ssl-3.0"
1052 ssl_client_fallback: "disable"
1053 ssl_client_rekey_count: "0"
1054 ssl_client_renegotiation: "allow"
1055 ssl_client_session_state_max: "1000"
1056 ssl_client_session_state_timeout: "30"
1057 ssl_client_session_state_type: "disable"
1058 ssl_dh_bits: "768"
1059 ssl_hpkp: "disable"
1060 ssl_hpkp_age: "5184000"
1061 ssl_hpkp_backup: "<your_own_value> (source vpn.certificate.local.name vpn.certificate.ca.name)"
1062 ssl_hpkp_include_subdomains: "disable"
1063 ssl_hpkp_primary: "<your_own_value> (source vpn.certificate.local.name vpn.certificate.ca.name)"
1064 ssl_hpkp_report_uri: "<your_own_value>"
1065 ssl_hsts: "disable"
1066 ssl_hsts_age: "5184000"
1067 ssl_hsts_include_subdomains: "disable"
1068 ssl_http_location_conversion: "enable"
1069 ssl_http_match_host: "enable"
1070 ssl_max_version: "ssl-3.0"
1071 ssl_min_version: "ssl-3.0"
1072 ssl_mode: "half"
1073 ssl_pfs: "require"
1074 ssl_send_empty_frags: "enable"
1075 ssl_server_algorithm: "high"
1076 ssl_server_cipher_suites:
1077 -
1078 cipher: "TLS-AES-128-GCM-SHA256"
1079 priority: "<you_own_value>"
1080 versions: "ssl-3.0"
1081 ssl_server_max_version: "ssl-3.0"
1082 ssl_server_min_version: "ssl-3.0"
1083 ssl_server_renegotiation: "enable"
1084 ssl_server_session_state_max: "100"
1085 ssl_server_session_state_timeout: "60"
1086 ssl_server_session_state_type: "disable"
1087 type: "static-nat"
1088 user_agent_detect: "disable"
1089 uuid: "<your_own_value>"
1090 weblogic_server: "disable"
1091 websphere_server: "disable"
1092 """
1093
1094 RETURN = """
1095 build:
1096 description: Build number of the fortigate image
1097 returned: always
1098 type: str
1099 sample: '1547'
1100 http_method:
1101 description: Last method used to provision the content into FortiGate
1102 returned: always
1103 type: str
1104 sample: 'PUT'
1105 http_status:
1106 description: Last result given by FortiGate on last operation applied
1107 returned: always
1108 type: str
1109 sample: "200"
1110 mkey:
1111 description: Master key (id) used in the last call to FortiGate
1112 returned: success
1113 type: str
1114 sample: "id"
1115 name:
1116 description: Name of the table used to fulfill the request
1117 returned: always
1118 type: str
1119 sample: "urlfilter"
1120 path:
1121 description: Path of the table used to fulfill the request
1122 returned: always
1123 type: str
1124 sample: "webfilter"
1125 revision:
1126 description: Internal revision number
1127 returned: always
1128 type: str
1129 sample: "17.0.2.10658"
1130 serial:
1131 description: Serial number of the unit
1132 returned: always
1133 type: str
1134 sample: "FGVMEVYYQT3AB5352"
1135 status:
1136 description: Indication of the operation's result
1137 returned: always
1138 type: str
1139 sample: "success"
1140 vdom:
1141 description: Virtual domain used
1142 returned: always
1143 type: str
1144 sample: "root"
1145 version:
1146 description: Version of the FortiGate
1147 returned: always
1148 type: str
1149 sample: "v5.6.3"
1150 """
1151 from ansible.module_utils.basic import AnsibleModule
1152 from ansible.module_utils.connection import Connection
1153 from ansible_collections.fortinet.fortios.plugins.module_utils.fortios.fortios import (
1154 FortiOSHandler,
1155 )
1156 from ansible_collections.fortinet.fortios.plugins.module_utils.fortios.fortios import (
1157 check_legacy_fortiosapi,
1158 )
1159 from ansible_collections.fortinet.fortios.plugins.module_utils.fortios.fortios import (
1160 schema_to_module_spec,
1161 )
1162 from ansible_collections.fortinet.fortios.plugins.module_utils.fortios.fortios import (
1163 check_schema_versioning,
1164 )
1165 from ansible_collections.fortinet.fortios.plugins.module_utils.fortimanager.common import (
1166 FAIL_SOCKET_MSG,
1167 )
1168 from ansible_collections.fortinet.fortios.plugins.module_utils.fortios.data_post_processor import (
1169 remove_invalid_fields,
1170 )
1171 from ansible_collections.fortinet.fortios.plugins.module_utils.fortios.comparison import (
1172 is_same_comparison,
1173 )
1174 from ansible_collections.fortinet.fortios.plugins.module_utils.fortios.comparison import (
1175 serialize,
1176 )
1177 from ansible_collections.fortinet.fortios.plugins.module_utils.fortios.comparison import (
1178 find_current_values,
1179 )
1180 from ansible_collections.fortinet.fortios.plugins.module_utils.fortios.comparison import (
1181 unify_data_format,
1182 )
1183
1184
1185 def filter_firewall_vip6_data(json):
1186 option_list = [
1187 "add_nat64_route",
1188 "arp_reply",
1189 "client_cert",
1190 "color",
1191 "comment",
1192 "embedded_ipv4_address",
1193 "empty_cert_action",
1194 "extip",
1195 "extport",
1196 "h2_support",
1197 "h3_support",
1198 "http_cookie_age",
1199 "http_cookie_domain",
1200 "http_cookie_domain_from_host",
1201 "http_cookie_generation",
1202 "http_cookie_path",
1203 "http_cookie_share",
1204 "http_ip_header",
1205 "http_ip_header_name",
1206 "http_multiplex",
1207 "http_redirect",
1208 "https_cookie_secure",
1209 "id",
1210 "ipv4_mappedip",
1211 "ipv4_mappedport",
1212 "ldb_method",
1213 "mappedip",
1214 "mappedport",
1215 "max_embryonic_connections",
1216 "monitor",
1217 "name",
1218 "nat_source_vip",
1219 "nat64",
1220 "nat66",
1221 "ndp_reply",
1222 "outlook_web_access",
1223 "persistence",
1224 "portforward",
1225 "protocol",
1226 "quic",
1227 "realservers",
1228 "server_type",
1229 "src_filter",
1230 "src_vip_filter",
1231 "ssl_accept_ffdhe_groups",
1232 "ssl_algorithm",
1233 "ssl_certificate",
1234 "ssl_certificate_dict",
1235 "ssl_cipher_suites",
1236 "ssl_client_fallback",
1237 "ssl_client_rekey_count",
1238 "ssl_client_renegotiation",
1239 "ssl_client_session_state_max",
1240 "ssl_client_session_state_timeout",
1241 "ssl_client_session_state_type",
1242 "ssl_dh_bits",
1243 "ssl_hpkp",
1244 "ssl_hpkp_age",
1245 "ssl_hpkp_backup",
1246 "ssl_hpkp_include_subdomains",
1247 "ssl_hpkp_primary",
1248 "ssl_hpkp_report_uri",
1249 "ssl_hsts",
1250 "ssl_hsts_age",
1251 "ssl_hsts_include_subdomains",
1252 "ssl_http_location_conversion",
1253 "ssl_http_match_host",
1254 "ssl_max_version",
1255 "ssl_min_version",
1256 "ssl_mode",
1257 "ssl_pfs",
1258 "ssl_send_empty_frags",
1259 "ssl_server_algorithm",
1260 "ssl_server_cipher_suites",
1261 "ssl_server_max_version",
1262 "ssl_server_min_version",
1263 "ssl_server_renegotiation",
1264 "ssl_server_session_state_max",
1265 "ssl_server_session_state_timeout",
1266 "ssl_server_session_state_type",
1267 "type",
1268 "user_agent_detect",
1269 "uuid",
1270 "weblogic_server",
1271 "websphere_server",
1272 ]
1273
1274 json = remove_invalid_fields(json)
1275 dictionary = {}
1276
1277 for attribute in option_list:
1278 if attribute in json and json[attribute] is not None:
1279 dictionary[attribute] = json[attribute]
1280
1281 return dictionary
1282
1283
1284 def flatten_single_path(data, path, index):
1285 if (
1286 not data
1287 or index == len(path)
1288 or path[index] not in data
1289 or (not data[path[index]] and not isinstance(data[path[index]], list))
1290 ):
1291 return
1292
1293 if index == len(path) - 1:
1294 data[path[index]] = " ".join(str(elem) for elem in data[path[index]])
1295 if len(data[path[index]]) == 0:
1296 data[path[index]] = None
1297 elif isinstance(data[path[index]], list):
1298 for value in data[path[index]]:
1299 flatten_single_path(value, path, index + 1)
1300 else:
1301 flatten_single_path(data[path[index]], path, index + 1)
1302
1303
1304 def flatten_multilists_attributes(data):
1305 multilist_attrs = [
1306 ["ssl_cipher_suites", "versions"],
1307 ["ssl_server_cipher_suites", "versions"],
1308 ]
1309
1310 for attr in multilist_attrs:
1311 flatten_single_path(data, attr, 0)
1312
1313 return data
1314
1315
1316 def underscore_to_hyphen(data):
1317 new_data = None
1318 if isinstance(data, list):
1319 new_data = []
1320 for i, elem in enumerate(data):
1321 new_data.append(underscore_to_hyphen(elem))
1322 elif isinstance(data, dict):
1323 new_data = {}
1324 for k, v in data.items():
1325 new_data[k.replace("_", "-")] = underscore_to_hyphen(v)
1326 else:
1327 return data
1328 return new_data
1329
1330
1331 def remap_attribute_name(data):
1332 speciallist = {"ssl-certificate-dict": "ssl-certificate"}
1333
1334 if data in speciallist:
1335 return speciallist[data]
1336 return data
1337
1338
1339 def remap_attribute_names(data):
1340 if isinstance(data, list):
1341 new_data = []
1342 for elem in data:
1343 elem = remap_attribute_names(elem)
1344 new_data.append(elem)
1345 data = new_data
1346 elif isinstance(data, dict):
1347 new_data = {}
1348 for k, v in data.items():
1349 new_data[remap_attribute_name(k)] = remap_attribute_names(v)
1350 data = new_data
1351
1352 return data
1353
1354
1355 def firewall_vip6(data, fos, check_mode=False):
1356
1357 state = None
1358 vdom = data["vdom"]
1359 parameters = None
1360 state = data.get("state", None)
1361 firewall_vip6_data = data["firewall_vip6"]
1362 # Rename ssl_certificate_dict field to correctly compare against current configuration
1363 if firewall_vip6_data.get("ssl_certificate_dict") is not None:
1364 firewall_vip6_data["ssl_certificate"] = firewall_vip6_data.pop(
1365 "ssl_certificate_dict"
1366 )
1367
1368 filtered_data = filter_firewall_vip6_data(firewall_vip6_data)
1369 filtered_data = flatten_multilists_attributes(filtered_data)
1370 converted_data = underscore_to_hyphen(filtered_data)
1371 converted_data = remap_attribute_names(converted_data)
1372
1373 # check_mode starts from here
1374 if check_mode:
1375 diff = {
1376 "before": "",
1377 "after": filtered_data,
1378 }
1379 mkeyname = fos.get_mkeyname(None, None)
1380 mkey = fos.get_mkey("firewall", "vip6", filtered_data, vdom=vdom)
1381 current_data = fos.get(
1382 "firewall", "vip6", vdom=vdom, mkey=mkey, parameters=parameters
1383 )
1384 is_existed = (
1385 current_data
1386 and current_data.get("http_status") == 200
1387 and (
1388 mkeyname
1389 and isinstance(current_data.get("results"), list)
1390 and len(current_data["results"]) > 0
1391 or not mkeyname
1392 and current_data["results"] # global object response
1393 )
1394 )
1395
1396 # 2. if it exists and the state is 'present' then compare current settings with desired
1397 if state == "present" or state is True or state is None:
1398 # for non global modules, mkeyname must exist and it's a new module when mkey is None
1399 if mkeyname is not None and mkey is None:
1400 return False, True, filtered_data, diff
1401
1402 # if mkey exists then compare each other
1403 # record exits and they're matched or not
1404 copied_filtered_data = filtered_data.copy()
1405 copied_filtered_data.pop(mkeyname, None)
1406 unified_filtered_data = unify_data_format(copied_filtered_data)
1407
1408 current_data_results = current_data.get("results", {})
1409 current_config = (
1410 current_data_results[0]
1411 if mkeyname
1412 and isinstance(current_data_results, list)
1413 and len(current_data_results) > 0
1414 else current_data_results
1415 )
1416 if is_existed:
1417 unified_current_values = find_current_values(
1418 unified_filtered_data,
1419 unify_data_format(current_config),
1420 )
1421
1422 is_same = is_same_comparison(
1423 serialize(unified_current_values), serialize(unified_filtered_data)
1424 )
1425
1426 return (
1427 False,
1428 not is_same,
1429 filtered_data,
1430 {"before": unified_current_values, "after": unified_filtered_data},
1431 )
1432
1433 # record does not exist
1434 return False, True, filtered_data, diff
1435
1436 if state == "absent":
1437 if mkey is None:
1438 return (
1439 False,
1440 False,
1441 filtered_data,
1442 {"before": current_data["results"][0], "after": ""},
1443 )
1444
1445 if is_existed:
1446 return (
1447 False,
1448 True,
1449 filtered_data,
1450 {"before": current_data["results"][0], "after": ""},
1451 )
1452 return False, False, filtered_data, {}
1453
1454 return True, False, {"reason: ": "Must provide state parameter"}, {}
1455 # pass post processed data to member operations
1456 # no need to do underscore_to_hyphen since do_member_operation handles it by itself
1457 data_copy = data.copy()
1458 data_copy["firewall_vip6"] = filtered_data
1459 fos.do_member_operation(
1460 "firewall",
1461 "vip6",
1462 data_copy,
1463 )
1464
1465 if state == "present" or state is True:
1466 return fos.set(
1467 "firewall", "vip6", data=converted_data, vdom=vdom, parameters=parameters
1468 )
1469
1470 elif state == "absent":
1471 return fos.delete(
1472 "firewall",
1473 "vip6",
1474 mkey=converted_data["name"],
1475 vdom=vdom,
1476 parameters=parameters,
1477 )
1478 else:
1479 fos._module.fail_json(msg="state must be present or absent!")
1480
1481
1482 def is_successful_status(resp):
1483 return (
1484 "status" in resp
1485 and resp["status"] == "success"
1486 or "http_status" in resp
1487 and resp["http_status"] == 200
1488 or "http_method" in resp
1489 and resp["http_method"] == "DELETE"
1490 and resp["http_status"] == 404
1491 )
1492
1493
1494 def fortios_firewall(data, fos, check_mode):
1495
1496 if data["firewall_vip6"]:
1497 resp = firewall_vip6(data, fos, check_mode)
1498 else:
1499 fos._module.fail_json(msg="missing task body: %s" % ("firewall_vip6"))
1500 if isinstance(resp, tuple) and len(resp) == 4:
1501 return resp
1502 return (
1503 not is_successful_status(resp),
1504 is_successful_status(resp)
1505 and (resp["revision_changed"] if "revision_changed" in resp else True),
1506 resp,
1507 {},
1508 )
1509
1510
1511 versioned_schema = {
1512 "type": "list",
1513 "elements": "dict",
1514 "children": {
1515 "name": {"v_range": [["v6.0.0", ""]], "type": "string", "required": True},
1516 "id": {"v_range": [["v6.0.0", ""]], "type": "integer"},
1517 "uuid": {"v_range": [["v6.0.0", ""]], "type": "string"},
1518 "comment": {"v_range": [["v6.0.0", ""]], "type": "string"},
1519 "type": {
1520 "v_range": [["v6.0.0", ""]],
1521 "type": "string",
1522 "options": [
1523 {"value": "static-nat"},
1524 {"value": "server-load-balance"},
1525 {"value": "access-proxy", "v_range": [["v7.0.1", ""]]},
1526 ],
1527 },
1528 "src_filter": {
1529 "type": "list",
1530 "elements": "dict",
1531 "children": {
1532 "range": {
1533 "v_range": [["v6.0.0", ""]],
1534 "type": "string",
1535 "required": True,
1536 }
1537 },
1538 "v_range": [["v6.0.0", ""]],
1539 },
1540 "src_vip_filter": {
1541 "v_range": [["v7.4.4", ""]],
1542 "type": "string",
1543 "options": [{"value": "disable"}, {"value": "enable"}],
1544 },
1545 "extip": {"v_range": [["v6.0.0", ""]], "type": "string"},
1546 "mappedip": {"v_range": [["v6.0.0", ""]], "type": "string"},
1547 "nat_source_vip": {
1548 "v_range": [["v6.4.0", ""]],
1549 "type": "string",
1550 "options": [{"value": "disable"}, {"value": "enable"}],
1551 },
1552 "ndp_reply": {
1553 "v_range": [["v7.0.8", "v7.0.12"], ["v7.2.4", ""]],
1554 "type": "string",
1555 "options": [{"value": "disable"}, {"value": "enable"}],
1556 },
1557 "portforward": {
1558 "v_range": [["v6.0.0", ""]],
1559 "type": "string",
1560 "options": [{"value": "disable"}, {"value": "enable"}],
1561 },
1562 "protocol": {
1563 "v_range": [["v6.0.0", ""]],
1564 "type": "string",
1565 "options": [{"value": "tcp"}, {"value": "udp"}, {"value": "sctp"}],
1566 },
1567 "extport": {"v_range": [["v6.0.0", ""]], "type": "string"},
1568 "mappedport": {"v_range": [["v6.0.0", ""]], "type": "string"},
1569 "color": {"v_range": [["v6.0.0", ""]], "type": "integer"},
1570 "ldb_method": {
1571 "v_range": [["v6.0.0", ""]],
1572 "type": "string",
1573 "options": [
1574 {"value": "static"},
1575 {"value": "round-robin"},
1576 {"value": "weighted"},
1577 {"value": "least-session"},
1578 {"value": "least-rtt"},
1579 {"value": "first-alive"},
1580 {"value": "http-host"},
1581 ],
1582 },
1583 "server_type": {
1584 "v_range": [["v6.0.0", ""]],
1585 "type": "string",
1586 "options": [
1587 {"value": "http"},
1588 {"value": "https"},
1589 {"value": "imaps"},
1590 {"value": "pop3s"},
1591 {"value": "smtps"},
1592 {"value": "ssl"},
1593 {"value": "tcp"},
1594 {"value": "udp"},
1595 {"value": "ip"},
1596 ],
1597 },
1598 "http_redirect": {
1599 "v_range": [["v6.2.0", ""]],
1600 "type": "string",
1601 "options": [{"value": "enable"}, {"value": "disable"}],
1602 },
1603 "persistence": {
1604 "v_range": [["v6.0.0", ""]],
1605 "type": "string",
1606 "options": [
1607 {"value": "none"},
1608 {"value": "http-cookie"},
1609 {"value": "ssl-session-id"},
1610 ],
1611 },
1612 "h2_support": {
1613 "v_range": [["v7.4.2", ""]],
1614 "type": "string",
1615 "options": [{"value": "enable"}, {"value": "disable"}],
1616 },
1617 "h3_support": {
1618 "v_range": [["v7.4.2", ""]],
1619 "type": "string",
1620 "options": [{"value": "enable"}, {"value": "disable"}],
1621 },
1622 "quic": {
1623 "v_range": [["v7.4.2", ""]],
1624 "type": "dict",
1625 "children": {
1626 "max_idle_timeout": {"v_range": [["v7.4.2", ""]], "type": "integer"},
1627 "max_udp_payload_size": {
1628 "v_range": [["v7.4.2", ""]],
1629 "type": "integer",
1630 },
1631 "active_connection_id_limit": {
1632 "v_range": [["v7.4.2", ""]],
1633 "type": "integer",
1634 },
1635 "ack_delay_exponent": {"v_range": [["v7.4.2", ""]], "type": "integer"},
1636 "max_ack_delay": {"v_range": [["v7.4.2", ""]], "type": "integer"},
1637 "max_datagram_frame_size": {
1638 "v_range": [["v7.4.2", ""]],
1639 "type": "integer",
1640 },
1641 "active_migration": {
1642 "v_range": [["v7.4.2", ""]],
1643 "type": "string",
1644 "options": [{"value": "enable"}, {"value": "disable"}],
1645 },
1646 "grease_quic_bit": {
1647 "v_range": [["v7.4.2", ""]],
1648 "type": "string",
1649 "options": [{"value": "enable"}, {"value": "disable"}],
1650 },
1651 },
1652 },
1653 "nat66": {
1654 "v_range": [["v7.0.1", ""]],
1655 "type": "string",
1656 "options": [{"value": "disable"}, {"value": "enable"}],
1657 },
1658 "nat64": {
1659 "v_range": [["v7.0.1", ""]],
1660 "type": "string",
1661 "options": [{"value": "disable"}, {"value": "enable"}],
1662 },
1663 "add_nat64_route": {
1664 "v_range": [["v7.0.1", ""]],
1665 "type": "string",
1666 "options": [{"value": "disable"}, {"value": "enable"}],
1667 },
1668 "empty_cert_action": {
1669 "v_range": [["v7.6.1", ""]],
1670 "type": "string",
1671 "options": [
1672 {"value": "accept"},
1673 {"value": "block"},
1674 {"value": "accept-unmanageable"},
1675 ],
1676 },
1677 "user_agent_detect": {
1678 "v_range": [["v7.6.1", ""]],
1679 "type": "string",
1680 "options": [{"value": "disable"}, {"value": "enable"}],
1681 },
1682 "client_cert": {
1683 "v_range": [["v7.6.1", ""]],
1684 "type": "string",
1685 "options": [{"value": "disable"}, {"value": "enable"}],
1686 },
1687 "realservers": {
1688 "type": "list",
1689 "elements": "dict",
1690 "children": {
1691 "id": {
1692 "v_range": [["v6.0.0", ""]],
1693 "type": "integer",
1694 "required": True,
1695 },
1696 "ip": {"v_range": [["v6.0.0", ""]], "type": "string"},
1697 "port": {"v_range": [["v6.0.0", ""]], "type": "integer"},
1698 "status": {
1699 "v_range": [["v6.0.0", ""]],
1700 "type": "string",
1701 "options": [
1702 {"value": "active"},
1703 {"value": "standby"},
1704 {"value": "disable"},
1705 ],
1706 },
1707 "weight": {"v_range": [["v6.0.0", ""]], "type": "integer"},
1708 "holddown_interval": {"v_range": [["v6.0.0", ""]], "type": "integer"},
1709 "healthcheck": {
1710 "v_range": [["v6.0.0", ""]],
1711 "type": "string",
1712 "options": [
1713 {"value": "disable"},
1714 {"value": "enable"},
1715 {"value": "vip"},
1716 ],
1717 },
1718 "http_host": {"v_range": [["v6.0.0", ""]], "type": "string"},
1719 "translate_host": {
1720 "v_range": [["v7.2.4", ""]],
1721 "type": "string",
1722 "options": [{"value": "enable"}, {"value": "disable"}],
1723 },
1724 "max_connections": {"v_range": [["v6.0.0", ""]], "type": "integer"},
1725 "monitor": {
1726 "type": "list",
1727 "elements": "dict",
1728 "children": {
1729 "name": {
1730 "v_range": [["v6.4.0", ""]],
1731 "type": "string",
1732 "required": True,
1733 }
1734 },
1735 "v_range": [["v6.0.0", ""]],
1736 },
1737 "client_ip": {"v_range": [["v6.0.0", ""]], "type": "string"},
1738 "verify_cert": {
1739 "v_range": [["v7.6.4", ""]],
1740 "type": "string",
1741 "options": [{"value": "enable"}, {"value": "disable"}],
1742 },
1743 },
1744 "v_range": [["v6.0.0", ""]],
1745 },
1746 "http_cookie_domain_from_host": {
1747 "v_range": [["v6.0.0", ""]],
1748 "type": "string",
1749 "options": [{"value": "disable"}, {"value": "enable"}],
1750 },
1751 "http_cookie_domain": {"v_range": [["v6.0.0", ""]], "type": "string"},
1752 "http_cookie_path": {"v_range": [["v6.0.0", ""]], "type": "string"},
1753 "http_cookie_generation": {"v_range": [["v6.0.0", ""]], "type": "integer"},
1754 "http_cookie_age": {"v_range": [["v6.0.0", ""]], "type": "integer"},
1755 "http_cookie_share": {
1756 "v_range": [["v6.0.0", ""]],
1757 "type": "string",
1758 "options": [{"value": "disable"}, {"value": "same-ip"}],
1759 },
1760 "https_cookie_secure": {
1761 "v_range": [["v6.0.0", ""]],
1762 "type": "string",
1763 "options": [{"value": "disable"}, {"value": "enable"}],
1764 },
1765 "http_multiplex": {
1766 "v_range": [["v6.0.0", ""]],
1767 "type": "string",
1768 "options": [{"value": "enable"}, {"value": "disable"}],
1769 },
1770 "http_ip_header": {
1771 "v_range": [["v6.0.0", ""]],
1772 "type": "string",
1773 "options": [{"value": "enable"}, {"value": "disable"}],
1774 },
1775 "http_ip_header_name": {"v_range": [["v6.0.0", ""]], "type": "string"},
1776 "outlook_web_access": {
1777 "v_range": [["v6.0.0", ""]],
1778 "type": "string",
1779 "options": [{"value": "disable"}, {"value": "enable"}],
1780 },
1781 "weblogic_server": {
1782 "v_range": [["v6.0.0", ""]],
1783 "type": "string",
1784 "options": [{"value": "disable"}, {"value": "enable"}],
1785 },
1786 "websphere_server": {
1787 "v_range": [["v6.0.0", ""]],
1788 "type": "string",
1789 "options": [{"value": "disable"}, {"value": "enable"}],
1790 },
1791 "ssl_mode": {
1792 "v_range": [["v6.0.0", ""]],
1793 "type": "string",
1794 "options": [{"value": "half"}, {"value": "full"}],
1795 },
1796 "ssl_certificate_dict": {
1797 "type": "list",
1798 "elements": "dict",
1799 "children": {
1800 "name": {
1801 "v_range": [["v7.4.2", ""]],
1802 "type": "string",
1803 "required": True,
1804 }
1805 },
1806 "v_range": [["v7.4.2", ""]],
1807 },
1808 "ssl_dh_bits": {
1809 "v_range": [["v6.0.0", ""]],
1810 "type": "string",
1811 "options": [
1812 {"value": "768"},
1813 {"value": "1024"},
1814 {"value": "1536"},
1815 {"value": "2048"},
1816 {"value": "3072"},
1817 {"value": "4096"},
1818 ],
1819 },
1820 "ssl_algorithm": {
1821 "v_range": [["v6.0.0", ""]],
1822 "type": "string",
1823 "options": [
1824 {"value": "high"},
1825 {"value": "medium"},
1826 {"value": "low"},
1827 {"value": "custom"},
1828 ],
1829 },
1830 "ssl_cipher_suites": {
1831 "type": "list",
1832 "elements": "dict",
1833 "children": {
1834 "priority": {
1835 "v_range": [["v6.0.0", ""]],
1836 "type": "integer",
1837 "required": True,
1838 },
1839 "cipher": {
1840 "v_range": [["v6.0.0", ""]],
1841 "type": "string",
1842 "options": [
1843 {
1844 "value": "TLS-AES-128-GCM-SHA256",
1845 "v_range": [["v6.2.0", ""]],
1846 },
1847 {
1848 "value": "TLS-AES-256-GCM-SHA384",
1849 "v_range": [["v6.2.0", ""]],
1850 },
1851 {
1852 "value": "TLS-CHACHA20-POLY1305-SHA256",
1853 "v_range": [["v6.2.0", ""]],
1854 },
1855 {"value": "TLS-ECDHE-RSA-WITH-CHACHA20-POLY1305-SHA256"},
1856 {"value": "TLS-ECDHE-ECDSA-WITH-CHACHA20-POLY1305-SHA256"},
1857 {"value": "TLS-DHE-RSA-WITH-CHACHA20-POLY1305-SHA256"},
1858 {"value": "TLS-DHE-RSA-WITH-AES-128-CBC-SHA"},
1859 {"value": "TLS-DHE-RSA-WITH-AES-256-CBC-SHA"},
1860 {"value": "TLS-DHE-RSA-WITH-AES-128-CBC-SHA256"},
1861 {"value": "TLS-DHE-RSA-WITH-AES-128-GCM-SHA256"},
1862 {"value": "TLS-DHE-RSA-WITH-AES-256-CBC-SHA256"},
1863 {"value": "TLS-DHE-RSA-WITH-AES-256-GCM-SHA384"},
1864 {"value": "TLS-DHE-DSS-WITH-AES-128-CBC-SHA"},
1865 {"value": "TLS-DHE-DSS-WITH-AES-256-CBC-SHA"},
1866 {"value": "TLS-DHE-DSS-WITH-AES-128-CBC-SHA256"},
1867 {"value": "TLS-DHE-DSS-WITH-AES-128-GCM-SHA256"},
1868 {"value": "TLS-DHE-DSS-WITH-AES-256-CBC-SHA256"},
1869 {"value": "TLS-DHE-DSS-WITH-AES-256-GCM-SHA384"},
1870 {"value": "TLS-ECDHE-RSA-WITH-AES-128-CBC-SHA"},
1871 {"value": "TLS-ECDHE-RSA-WITH-AES-128-CBC-SHA256"},
1872 {"value": "TLS-ECDHE-RSA-WITH-AES-128-GCM-SHA256"},
1873 {"value": "TLS-ECDHE-RSA-WITH-AES-256-CBC-SHA"},
1874 {"value": "TLS-ECDHE-RSA-WITH-AES-256-CBC-SHA384"},
1875 {"value": "TLS-ECDHE-RSA-WITH-AES-256-GCM-SHA384"},
1876 {"value": "TLS-ECDHE-ECDSA-WITH-AES-128-CBC-SHA"},
1877 {"value": "TLS-ECDHE-ECDSA-WITH-AES-128-CBC-SHA256"},
1878 {"value": "TLS-ECDHE-ECDSA-WITH-AES-128-GCM-SHA256"},
1879 {
1880 "value": "TLS-ECDHE-ECDSA-WITH-AES-256-CBC-SHA",
1881 "v_range": [["v7.0.1", ""]],
1882 },
1883 {"value": "TLS-ECDHE-ECDSA-WITH-AES-256-CBC-SHA384"},
1884 {"value": "TLS-ECDHE-ECDSA-WITH-AES-256-GCM-SHA384"},
1885 {"value": "TLS-RSA-WITH-AES-128-CBC-SHA"},
1886 {"value": "TLS-RSA-WITH-AES-256-CBC-SHA"},
1887 {"value": "TLS-RSA-WITH-AES-128-CBC-SHA256"},
1888 {"value": "TLS-RSA-WITH-AES-128-GCM-SHA256"},
1889 {"value": "TLS-RSA-WITH-AES-256-CBC-SHA256"},
1890 {"value": "TLS-RSA-WITH-AES-256-GCM-SHA384"},
1891 {"value": "TLS-RSA-WITH-CAMELLIA-128-CBC-SHA"},
1892 {"value": "TLS-RSA-WITH-CAMELLIA-256-CBC-SHA"},
1893 {"value": "TLS-RSA-WITH-CAMELLIA-128-CBC-SHA256"},
1894 {"value": "TLS-RSA-WITH-CAMELLIA-256-CBC-SHA256"},
1895 {"value": "TLS-DHE-RSA-WITH-3DES-EDE-CBC-SHA"},
1896 {"value": "TLS-DHE-RSA-WITH-CAMELLIA-128-CBC-SHA"},
1897 {"value": "TLS-DHE-DSS-WITH-CAMELLIA-128-CBC-SHA"},
1898 {"value": "TLS-DHE-RSA-WITH-CAMELLIA-256-CBC-SHA"},
1899 {"value": "TLS-DHE-DSS-WITH-CAMELLIA-256-CBC-SHA"},
1900 {"value": "TLS-DHE-RSA-WITH-CAMELLIA-128-CBC-SHA256"},
1901 {"value": "TLS-DHE-DSS-WITH-CAMELLIA-128-CBC-SHA256"},
1902 {"value": "TLS-DHE-RSA-WITH-CAMELLIA-256-CBC-SHA256"},
1903 {"value": "TLS-DHE-DSS-WITH-CAMELLIA-256-CBC-SHA256"},
1904 {"value": "TLS-DHE-RSA-WITH-SEED-CBC-SHA"},
1905 {"value": "TLS-DHE-DSS-WITH-SEED-CBC-SHA"},
1906 {"value": "TLS-DHE-RSA-WITH-ARIA-128-CBC-SHA256"},
1907 {"value": "TLS-DHE-RSA-WITH-ARIA-256-CBC-SHA384"},
1908 {"value": "TLS-DHE-DSS-WITH-ARIA-128-CBC-SHA256"},
1909 {"value": "TLS-DHE-DSS-WITH-ARIA-256-CBC-SHA384"},
1910 {"value": "TLS-RSA-WITH-SEED-CBC-SHA"},
1911 {"value": "TLS-RSA-WITH-ARIA-128-CBC-SHA256"},
1912 {"value": "TLS-RSA-WITH-ARIA-256-CBC-SHA384"},
1913 {"value": "TLS-ECDHE-RSA-WITH-ARIA-128-CBC-SHA256"},
1914 {"value": "TLS-ECDHE-RSA-WITH-ARIA-256-CBC-SHA384"},
1915 {"value": "TLS-ECDHE-ECDSA-WITH-ARIA-128-CBC-SHA256"},
1916 {"value": "TLS-ECDHE-ECDSA-WITH-ARIA-256-CBC-SHA384"},
1917 {"value": "TLS-ECDHE-RSA-WITH-RC4-128-SHA"},
1918 {"value": "TLS-ECDHE-RSA-WITH-3DES-EDE-CBC-SHA"},
1919 {"value": "TLS-DHE-DSS-WITH-3DES-EDE-CBC-SHA"},
1920 {"value": "TLS-RSA-WITH-3DES-EDE-CBC-SHA"},
1921 {"value": "TLS-RSA-WITH-RC4-128-MD5"},
1922 {"value": "TLS-RSA-WITH-RC4-128-SHA"},
1923 {"value": "TLS-DHE-RSA-WITH-DES-CBC-SHA"},
1924 {"value": "TLS-DHE-DSS-WITH-DES-CBC-SHA"},
1925 {"value": "TLS-RSA-WITH-DES-CBC-SHA"},
1926 ],
1927 },
1928 "versions": {
1929 "v_range": [["v6.0.0", ""]],
1930 "type": "list",
1931 "options": [
1932 {"value": "ssl-3.0"},
1933 {"value": "tls-1.0"},
1934 {"value": "tls-1.1"},
1935 {"value": "tls-1.2"},
1936 {"value": "tls-1.3", "v_range": [["v6.2.0", ""]]},
1937 ],
1938 "multiple_values": True,
1939 "elements": "str",
1940 },
1941 },
1942 "v_range": [["v6.0.0", ""]],
1943 },
1944 "ssl_server_renegotiation": {
1945 "v_range": [["v7.2.4", ""]],
1946 "type": "string",
1947 "options": [{"value": "enable"}, {"value": "disable"}],
1948 },
1949 "ssl_server_algorithm": {
1950 "v_range": [["v6.0.0", ""]],
1951 "type": "string",
1952 "options": [
1953 {"value": "high"},
1954 {"value": "medium"},
1955 {"value": "low"},
1956 {"value": "custom"},
1957 {"value": "client"},
1958 ],
1959 },
1960 "ssl_server_cipher_suites": {
1961 "type": "list",
1962 "elements": "dict",
1963 "children": {
1964 "priority": {
1965 "v_range": [["v6.0.0", ""]],
1966 "type": "integer",
1967 "required": True,
1968 },
1969 "cipher": {
1970 "v_range": [["v6.0.0", ""]],
1971 "type": "string",
1972 "options": [
1973 {
1974 "value": "TLS-AES-128-GCM-SHA256",
1975 "v_range": [["v6.2.0", ""]],
1976 },
1977 {
1978 "value": "TLS-AES-256-GCM-SHA384",
1979 "v_range": [["v6.2.0", ""]],
1980 },
1981 {
1982 "value": "TLS-CHACHA20-POLY1305-SHA256",
1983 "v_range": [["v6.2.0", ""]],
1984 },
1985 {"value": "TLS-ECDHE-RSA-WITH-CHACHA20-POLY1305-SHA256"},
1986 {"value": "TLS-ECDHE-ECDSA-WITH-CHACHA20-POLY1305-SHA256"},
1987 {"value": "TLS-DHE-RSA-WITH-CHACHA20-POLY1305-SHA256"},
1988 {"value": "TLS-DHE-RSA-WITH-AES-128-CBC-SHA"},
1989 {"value": "TLS-DHE-RSA-WITH-AES-256-CBC-SHA"},
1990 {"value": "TLS-DHE-RSA-WITH-AES-128-CBC-SHA256"},
1991 {"value": "TLS-DHE-RSA-WITH-AES-128-GCM-SHA256"},
1992 {"value": "TLS-DHE-RSA-WITH-AES-256-CBC-SHA256"},
1993 {"value": "TLS-DHE-RSA-WITH-AES-256-GCM-SHA384"},
1994 {"value": "TLS-DHE-DSS-WITH-AES-128-CBC-SHA"},
1995 {"value": "TLS-DHE-DSS-WITH-AES-256-CBC-SHA"},
1996 {"value": "TLS-DHE-DSS-WITH-AES-128-CBC-SHA256"},
1997 {"value": "TLS-DHE-DSS-WITH-AES-128-GCM-SHA256"},
1998 {"value": "TLS-DHE-DSS-WITH-AES-256-CBC-SHA256"},
1999 {"value": "TLS-DHE-DSS-WITH-AES-256-GCM-SHA384"},
2000 {"value": "TLS-ECDHE-RSA-WITH-AES-128-CBC-SHA"},
2001 {"value": "TLS-ECDHE-RSA-WITH-AES-128-CBC-SHA256"},
2002 {"value": "TLS-ECDHE-RSA-WITH-AES-128-GCM-SHA256"},
2003 {"value": "TLS-ECDHE-RSA-WITH-AES-256-CBC-SHA"},
2004 {"value": "TLS-ECDHE-RSA-WITH-AES-256-CBC-SHA384"},
2005 {"value": "TLS-ECDHE-RSA-WITH-AES-256-GCM-SHA384"},
2006 {"value": "TLS-ECDHE-ECDSA-WITH-AES-128-CBC-SHA"},
2007 {"value": "TLS-ECDHE-ECDSA-WITH-AES-128-CBC-SHA256"},
2008 {"value": "TLS-ECDHE-ECDSA-WITH-AES-128-GCM-SHA256"},
2009 {
2010 "value": "TLS-ECDHE-ECDSA-WITH-AES-256-CBC-SHA",
2011 "v_range": [["v7.0.1", ""]],
2012 },
2013 {"value": "TLS-ECDHE-ECDSA-WITH-AES-256-CBC-SHA384"},
2014 {"value": "TLS-ECDHE-ECDSA-WITH-AES-256-GCM-SHA384"},
2015 {"value": "TLS-RSA-WITH-AES-128-CBC-SHA"},
2016 {"value": "TLS-RSA-WITH-AES-256-CBC-SHA"},
2017 {"value": "TLS-RSA-WITH-AES-128-CBC-SHA256"},
2018 {"value": "TLS-RSA-WITH-AES-128-GCM-SHA256"},
2019 {"value": "TLS-RSA-WITH-AES-256-CBC-SHA256"},
2020 {"value": "TLS-RSA-WITH-AES-256-GCM-SHA384"},
2021 {"value": "TLS-RSA-WITH-CAMELLIA-128-CBC-SHA"},
2022 {"value": "TLS-RSA-WITH-CAMELLIA-256-CBC-SHA"},
2023 {"value": "TLS-RSA-WITH-CAMELLIA-128-CBC-SHA256"},
2024 {"value": "TLS-RSA-WITH-CAMELLIA-256-CBC-SHA256"},
2025 {"value": "TLS-DHE-RSA-WITH-3DES-EDE-CBC-SHA"},
2026 {"value": "TLS-DHE-RSA-WITH-CAMELLIA-128-CBC-SHA"},
2027 {"value": "TLS-DHE-DSS-WITH-CAMELLIA-128-CBC-SHA"},
2028 {"value": "TLS-DHE-RSA-WITH-CAMELLIA-256-CBC-SHA"},
2029 {"value": "TLS-DHE-DSS-WITH-CAMELLIA-256-CBC-SHA"},
2030 {"value": "TLS-DHE-RSA-WITH-CAMELLIA-128-CBC-SHA256"},
2031 {"value": "TLS-DHE-DSS-WITH-CAMELLIA-128-CBC-SHA256"},
2032 {"value": "TLS-DHE-RSA-WITH-CAMELLIA-256-CBC-SHA256"},
2033 {"value": "TLS-DHE-DSS-WITH-CAMELLIA-256-CBC-SHA256"},
2034 {"value": "TLS-DHE-RSA-WITH-SEED-CBC-SHA"},
2035 {"value": "TLS-DHE-DSS-WITH-SEED-CBC-SHA"},
2036 {"value": "TLS-DHE-RSA-WITH-ARIA-128-CBC-SHA256"},
2037 {"value": "TLS-DHE-RSA-WITH-ARIA-256-CBC-SHA384"},
2038 {"value": "TLS-DHE-DSS-WITH-ARIA-128-CBC-SHA256"},
2039 {"value": "TLS-DHE-DSS-WITH-ARIA-256-CBC-SHA384"},
2040 {"value": "TLS-RSA-WITH-SEED-CBC-SHA"},
2041 {"value": "TLS-RSA-WITH-ARIA-128-CBC-SHA256"},
2042 {"value": "TLS-RSA-WITH-ARIA-256-CBC-SHA384"},
2043 {"value": "TLS-ECDHE-RSA-WITH-ARIA-128-CBC-SHA256"},
2044 {"value": "TLS-ECDHE-RSA-WITH-ARIA-256-CBC-SHA384"},
2045 {"value": "TLS-ECDHE-ECDSA-WITH-ARIA-128-CBC-SHA256"},
2046 {"value": "TLS-ECDHE-ECDSA-WITH-ARIA-256-CBC-SHA384"},
2047 {"value": "TLS-ECDHE-RSA-WITH-RC4-128-SHA"},
2048 {"value": "TLS-ECDHE-RSA-WITH-3DES-EDE-CBC-SHA"},
2049 {"value": "TLS-DHE-DSS-WITH-3DES-EDE-CBC-SHA"},
2050 {"value": "TLS-RSA-WITH-3DES-EDE-CBC-SHA"},
2051 {"value": "TLS-RSA-WITH-RC4-128-MD5"},
2052 {"value": "TLS-RSA-WITH-RC4-128-SHA"},
2053 {"value": "TLS-DHE-RSA-WITH-DES-CBC-SHA"},
2054 {"value": "TLS-DHE-DSS-WITH-DES-CBC-SHA"},
2055 {"value": "TLS-RSA-WITH-DES-CBC-SHA"},
2056 ],
2057 },
2058 "versions": {
2059 "v_range": [["v6.0.0", ""]],
2060 "type": "list",
2061 "options": [
2062 {"value": "ssl-3.0"},
2063 {"value": "tls-1.0"},
2064 {"value": "tls-1.1"},
2065 {"value": "tls-1.2"},
2066 {"value": "tls-1.3", "v_range": [["v6.2.0", ""]]},
2067 ],
2068 "multiple_values": True,
2069 "elements": "str",
2070 },
2071 },
2072 "v_range": [["v6.0.0", ""]],
2073 },
2074 "ssl_pfs": {
2075 "v_range": [["v6.0.0", ""]],
2076 "type": "string",
2077 "options": [{"value": "require"}, {"value": "deny"}, {"value": "allow"}],
2078 },
2079 "ssl_min_version": {
2080 "v_range": [["v6.0.0", ""]],
2081 "type": "string",
2082 "options": [
2083 {"value": "ssl-3.0"},
2084 {"value": "tls-1.0"},
2085 {"value": "tls-1.1"},
2086 {"value": "tls-1.2"},
2087 {"value": "tls-1.3", "v_range": [["v6.2.0", ""]]},
2088 ],
2089 },
2090 "ssl_max_version": {
2091 "v_range": [["v6.0.0", ""]],
2092 "type": "string",
2093 "options": [
2094 {"value": "ssl-3.0"},
2095 {"value": "tls-1.0"},
2096 {"value": "tls-1.1"},
2097 {"value": "tls-1.2"},
2098 {"value": "tls-1.3", "v_range": [["v6.2.0", ""]]},
2099 ],
2100 },
2101 "ssl_server_min_version": {
2102 "v_range": [["v6.0.0", ""]],
2103 "type": "string",
2104 "options": [
2105 {"value": "ssl-3.0"},
2106 {"value": "tls-1.0"},
2107 {"value": "tls-1.1"},
2108 {"value": "tls-1.2"},
2109 {"value": "tls-1.3", "v_range": [["v6.2.0", ""]]},
2110 {"value": "client"},
2111 ],
2112 },
2113 "ssl_server_max_version": {
2114 "v_range": [["v6.0.0", ""]],
2115 "type": "string",
2116 "options": [
2117 {"value": "ssl-3.0"},
2118 {"value": "tls-1.0"},
2119 {"value": "tls-1.1"},
2120 {"value": "tls-1.2"},
2121 {"value": "tls-1.3", "v_range": [["v6.2.0", ""]]},
2122 {"value": "client"},
2123 ],
2124 },
2125 "ssl_accept_ffdhe_groups": {
2126 "v_range": [["v7.0.4", ""]],
2127 "type": "string",
2128 "options": [{"value": "enable"}, {"value": "disable"}],
2129 },
2130 "ssl_send_empty_frags": {
2131 "v_range": [["v6.0.0", ""]],
2132 "type": "string",
2133 "options": [{"value": "enable"}, {"value": "disable"}],
2134 },
2135 "ssl_client_fallback": {
2136 "v_range": [["v6.0.0", ""]],
2137 "type": "string",
2138 "options": [{"value": "disable"}, {"value": "enable"}],
2139 },
2140 "ssl_client_renegotiation": {
2141 "v_range": [["v6.0.0", ""]],
2142 "type": "string",
2143 "options": [{"value": "allow"}, {"value": "deny"}, {"value": "secure"}],
2144 },
2145 "ssl_client_session_state_type": {
2146 "v_range": [["v6.0.0", ""]],
2147 "type": "string",
2148 "options": [
2149 {"value": "disable"},
2150 {"value": "time"},
2151 {"value": "count"},
2152 {"value": "both"},
2153 ],
2154 },
2155 "ssl_client_session_state_timeout": {
2156 "v_range": [["v6.0.0", ""]],
2157 "type": "integer",
2158 },
2159 "ssl_client_session_state_max": {
2160 "v_range": [["v6.0.0", ""]],
2161 "type": "integer",
2162 },
2163 "ssl_client_rekey_count": {"v_range": [["v6.2.0", ""]], "type": "integer"},
2164 "ssl_server_session_state_type": {
2165 "v_range": [["v6.0.0", ""]],
2166 "type": "string",
2167 "options": [
2168 {"value": "disable"},
2169 {"value": "time"},
2170 {"value": "count"},
2171 {"value": "both"},
2172 ],
2173 },
2174 "ssl_server_session_state_timeout": {
2175 "v_range": [["v6.0.0", ""]],
2176 "type": "integer",
2177 },
2178 "ssl_server_session_state_max": {
2179 "v_range": [["v6.0.0", ""]],
2180 "type": "integer",
2181 },
2182 "ssl_http_location_conversion": {
2183 "v_range": [["v6.0.0", ""]],
2184 "type": "string",
2185 "options": [{"value": "enable"}, {"value": "disable"}],
2186 },
2187 "ssl_http_match_host": {
2188 "v_range": [["v6.0.0", ""]],
2189 "type": "string",
2190 "options": [{"value": "enable"}, {"value": "disable"}],
2191 },
2192 "ssl_hpkp": {
2193 "v_range": [["v6.0.0", ""]],
2194 "type": "string",
2195 "options": [
2196 {"value": "disable"},
2197 {"value": "enable"},
2198 {"value": "report-only"},
2199 ],
2200 },
2201 "ssl_hpkp_primary": {"v_range": [["v6.0.0", ""]], "type": "string"},
2202 "ssl_hpkp_backup": {"v_range": [["v6.0.0", ""]], "type": "string"},
2203 "ssl_hpkp_age": {"v_range": [["v6.0.0", ""]], "type": "integer"},
2204 "ssl_hpkp_report_uri": {"v_range": [["v6.0.0", ""]], "type": "string"},
2205 "ssl_hpkp_include_subdomains": {
2206 "v_range": [["v6.0.0", ""]],
2207 "type": "string",
2208 "options": [{"value": "disable"}, {"value": "enable"}],
2209 },
2210 "ssl_hsts": {
2211 "v_range": [["v6.0.0", ""]],
2212 "type": "string",
2213 "options": [{"value": "disable"}, {"value": "enable"}],
2214 },
2215 "ssl_hsts_age": {"v_range": [["v6.0.0", ""]], "type": "integer"},
2216 "ssl_hsts_include_subdomains": {
2217 "v_range": [["v6.0.0", ""]],
2218 "type": "string",
2219 "options": [{"value": "disable"}, {"value": "enable"}],
2220 },
2221 "monitor": {
2222 "type": "list",
2223 "elements": "dict",
2224 "children": {
2225 "name": {
2226 "v_range": [["v6.0.0", ""]],
2227 "type": "string",
2228 "required": True,
2229 }
2230 },
2231 "v_range": [["v6.0.0", ""]],
2232 },
2233 "max_embryonic_connections": {"v_range": [["v6.0.0", ""]], "type": "integer"},
2234 "embedded_ipv4_address": {
2235 "v_range": [["v7.0.1", ""]],
2236 "type": "string",
2237 "options": [{"value": "disable"}, {"value": "enable"}],
2238 },
2239 "ipv4_mappedip": {"v_range": [["v7.0.1", ""]], "type": "string"},
2240 "ipv4_mappedport": {"v_range": [["v7.0.1", ""]], "type": "string"},
2241 "ssl_certificate": {"v_range": [["v6.0.0", "v7.4.1"]], "type": "string"},
2242 "arp_reply": {
2243 "v_range": [["v6.0.0", "v7.0.7"], ["v7.2.0", "v7.2.2"]],
2244 "type": "string",
2245 "options": [{"value": "disable"}, {"value": "enable"}],
2246 },
2247 },
2248 "v_range": [["v6.0.0", ""]],
2249 }
2250
2251
2252 def main():
2253 module_spec = schema_to_module_spec(versioned_schema)
2254 mkeyname = "name"
2255 fields = {
2256 "access_token": {"required": False, "type": "str", "no_log": True},
2257 "enable_log": {"required": False, "type": "bool", "default": False},
2258 "vdom": {"required": False, "type": "str", "default": "root"},
2259 "member_path": {"required": False, "type": "str"},
2260 "member_state": {
2261 "type": "str",
2262 "required": False,
2263 "choices": ["present", "absent"],
2264 },
2265 "state": {"required": True, "type": "str", "choices": ["present", "absent"]},
2266 "firewall_vip6": {
2267 "required": False,
2268 "type": "dict",
2269 "default": None,
2270 "options": {},
2271 },
2272 }
2273 for attribute_name in module_spec["options"]:
2274 fields["firewall_vip6"]["options"][attribute_name] = module_spec["options"][
2275 attribute_name
2276 ]
2277 if mkeyname and mkeyname == attribute_name:
2278 fields["firewall_vip6"]["options"][attribute_name]["required"] = True
2279
2280 module = AnsibleModule(argument_spec=fields, supports_check_mode=True)
2281 check_legacy_fortiosapi(module)
2282
2283 is_error = False
2284 has_changed = False
2285 result = None
2286 diff = None
2287
2288 versions_check_result = None
2289 if module._socket_path:
2290 connection = Connection(module._socket_path)
2291 if "access_token" in module.params:
2292 connection.set_custom_option("access_token", module.params["access_token"])
2293
2294 if "enable_log" in module.params:
2295 connection.set_custom_option("enable_log", module.params["enable_log"])
2296 else:
2297 connection.set_custom_option("enable_log", False)
2298 fos = FortiOSHandler(connection, module, mkeyname, admin_passwd_header=False)
2299 versions_check_result = check_schema_versioning(
2300 fos, versioned_schema, "firewall_vip6"
2301 )
2302
2303 is_error, has_changed, result, diff = fortios_firewall(
2304 module.params, fos, module.check_mode
2305 )
2306
2307 else:
2308 module.fail_json(**FAIL_SOCKET_MSG)
2309
2310 if versions_check_result and versions_check_result["matched"] is False:
2311 module.warn(
2312 "Ansible has detected version mismatch between FortOS system and your playbook, see more details by specifying option -vvv"
2313 )
2314
2315 if not is_error:
2316 if versions_check_result and versions_check_result["matched"] is False:
2317 module.exit_json(
2318 changed=has_changed,
2319 version_check_warning=versions_check_result,
2320 meta=result,
2321 diff=diff,
2322 )
2323 else:
2324 module.exit_json(changed=has_changed, meta=result, diff=diff)
2325 else:
2326 if versions_check_result and versions_check_result["matched"] is False:
2327 module.fail_json(
2328 msg="Error in repo",
2329 version_check_warning=versions_check_result,
2330 meta=result,
2331 )
2332 else:
2333 module.fail_json(msg="Error in repo", meta=result)
2334
2335
2336 if __name__ == "__main__":
2337 main()