Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_firewall_sslsshprofile_dot.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_firewall_sslsshprofile_dot
15 short_description: Configure DNS over TLS options.
16 version_added: "2.1.0"
17 extends_documentation_fragment:
18 - fortinet.fortimanager.general
19 - fortinet.fortimanager.general.partial_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 ssl-ssh-profile:
29 description: Deprecated, please use "ssl_ssh_profile"
30 type: str
31 ssl_ssh_profile:
32 description: The parameter (ssl-ssh-profile) in requested url.
33 type: str
34 firewall_sslsshprofile_dot:
35 description: The top level parameters set.
36 required: false
37 type: dict
38 suboptions:
39 cert_validation_failure:
40 aliases: ['cert-validation-failure']
41 type: str
42 description: Action based on certificate validation failure.
43 choices: ['allow', 'block', 'ignore']
44 cert_validation_timeout:
45 aliases: ['cert-validation-timeout']
46 type: str
47 description: Action based on certificate validation timeout.
48 choices: ['allow', 'block', 'ignore']
49 client_certificate:
50 aliases: ['client-certificate']
51 type: str
52 description: Action based on received client certificate.
53 choices: ['bypass', 'inspect', 'block', 'bypass-on-cert-req']
54 expired_server_cert:
55 aliases: ['expired-server-cert']
56 type: str
57 description: Action based on server certificate is expired.
58 choices: ['allow', 'block', 'ignore']
59 proxy_after_tcp_handshake:
60 aliases: ['proxy-after-tcp-handshake']
61 type: str
62 description: Proxy traffic after the TCP 3-way handshake has been established
63 choices: ['disable', 'enable']
64 revoked_server_cert:
65 aliases: ['revoked-server-cert']
66 type: str
67 description: Action based on server certificate is revoked.
68 choices: ['allow', 'block', 'ignore']
69 sni_server_cert_check:
70 aliases: ['sni-server-cert-check']
71 type: str
72 description: Check the SNI in the client hello message with the CN or SAN fields in the returned server certificate.
73 choices: ['enable', 'strict', 'disable']
74 status:
75 type: str
76 description: Configure protocol inspection status.
77 choices: ['disable', 'deep-inspection']
78 unsupported_ssl_cipher:
79 aliases: ['unsupported-ssl-cipher']
80 type: str
81 description: Action based on the SSL cipher used being unsupported.
82 choices: ['block', 'allow']
83 unsupported_ssl_negotiation:
84 aliases: ['unsupported-ssl-negotiation']
85 type: str
86 description: Action based on the SSL negotiation used being unsupported.
87 choices: ['block', 'allow']
88 untrusted_server_cert:
89 aliases: ['untrusted-server-cert']
90 type: str
91 description: Action based on server certificate is not issued by a trusted CA.
92 choices: ['allow', 'block', 'ignore']
93 unsupported_ssl_version:
94 aliases: ['unsupported-ssl-version']
95 type: str
96 description: Action based on the SSL version used being unsupported.
97 choices: ['block', 'allow', 'inspect']
98 min_allowed_ssl_version:
99 aliases: ['min-allowed-ssl-version']
100 type: str
101 description: Min allowed ssl version.
102 choices: ['ssl-3.0', 'tls-1.0', 'tls-1.1', 'tls-1.2', 'tls-1.3']
103 quic:
104 type: str
105 description: Enable/disable QUIC inspection
106 choices: ['disable', 'enable', 'bypass', 'block', 'inspect']
107 udp_not_quic:
108 aliases: ['udp-not-quic']
109 type: str
110 description: Action to be taken when matched UDP packet is not QUIC.
111 choices: ['block', 'allow']
112 '''
113
114 EXAMPLES = '''
115 - name: Example playbook (generated based on argument schema)
116 hosts: fortimanagers
117 connection: httpapi
118 gather_facts: false
119 tasks:
120 - name: Configure DNS over TLS options.
121 fortinet.fortimanager.fmgr_firewall_sslsshprofile_dot:
122 # workspace_locking_adom: <global or your adom name>
123 adom: <your own value>
124 ssl_ssh_profile: <your own value>
125 firewall_sslsshprofile_dot:
126 # cert_validation_failure: <value in [allow, block, ignore]>
127 # cert_validation_timeout: <value in [allow, block, ignore]>
128 # client_certificate: <value in [bypass, inspect, block, ...]>
129 # expired_server_cert: <value in [allow, block, ignore]>
130 # proxy_after_tcp_handshake: <value in [disable, enable]>
131 # revoked_server_cert: <value in [allow, block, ignore]>
132 # sni_server_cert_check: <value in [enable, strict, disable]>
133 # status: <value in [disable, deep-inspection]>
134 # unsupported_ssl_cipher: <value in [block, allow]>
135 # unsupported_ssl_negotiation: <value in [block, allow]>
136 # untrusted_server_cert: <value in [allow, block, ignore]>
137 # unsupported_ssl_version: <value in [block, allow, inspect]>
138 # min_allowed_ssl_version: <value in [ssl-3.0, tls-1.0, tls-1.1, ...]>
139 # quic: <value in [disable, enable, bypass, ...]>
140 # udp_not_quic: <value in [block, allow]>
141 '''
142
143 RETURN = '''
144 meta:
145 description: The result of the request.
146 type: dict
147 returned: always
148 contains:
149 request_url:
150 description: The full url requested.
151 returned: always
152 type: str
153 sample: /sys/login/user
154 response_code:
155 description: The status of api request.
156 returned: always
157 type: int
158 sample: 0
159 response_data:
160 description: The api response.
161 type: list
162 returned: always
163 response_message:
164 description: The descriptive message of the api response.
165 type: str
166 returned: always
167 sample: OK.
168 system_information:
169 description: The information of the target system.
170 type: dict
171 returned: always
172 rc:
173 description: The status the request.
174 type: int
175 returned: always
176 sample: 0
177 version_check_warning:
178 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
179 type: list
180 returned: complex
181 '''
182 from ansible.module_utils.basic import AnsibleModule
183 from ansible.module_utils.connection import Connection
184 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
185 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
186
187
188 def main():
189 urls_list = [
190 '/pm/config/adom/{adom}/obj/firewall/ssl-ssh-profile/{ssl-ssh-profile}/dot',
191 '/pm/config/global/obj/firewall/ssl-ssh-profile/{ssl-ssh-profile}/dot'
192 ]
193 module_arg_spec = {
194 'adom': {'required': True, 'type': 'str'},
195 'ssl-ssh-profile': {'type': 'str', 'api_name': 'ssl_ssh_profile'},
196 'ssl_ssh_profile': {'type': 'str'},
197 'revision_note': {'type': 'str'},
198 'firewall_sslsshprofile_dot': {
199 'type': 'dict', 'v_range': [['7.0.0', '']],
200 'options': {
201 'cert-validation-failure': {'v_range': [['7.0.0', '']], 'choices': ['allow', 'block', 'ignore'], 'type': 'str'},
202 'cert-validation-timeout': {'v_range': [['7.0.0', '']], 'choices': ['allow', 'block', 'ignore'], 'type': 'str'},
203 'client-certificate': {'v_range': [['7.0.0', '']], 'choices': ['bypass', 'inspect', 'block', 'bypass-on-cert-req'], 'type': 'str'},
204 'expired-server-cert': {'v_range': [['7.0.0', '']], 'choices': ['allow', 'block', 'ignore'], 'type': 'str'},
205 'proxy-after-tcp-handshake': {'v_range': [['7.0.0', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
206 'revoked-server-cert': {'v_range': [['7.0.0', '']], 'choices': ['allow', 'block', 'ignore'], 'type': 'str'},
207 'sni-server-cert-check': {'v_range': [['7.0.0', '']], 'choices': ['enable', 'strict', 'disable'], 'type': 'str'},
208 'status': {'v_range': [['7.0.0', '']], 'choices': ['disable', 'deep-inspection'], 'type': 'str'},
209 'unsupported-ssl-cipher': {'v_range': [['7.0.0', '']], 'choices': ['block', 'allow'], 'type': 'str'},
210 'unsupported-ssl-negotiation': {'v_range': [['7.0.0', '']], 'choices': ['block', 'allow'], 'type': 'str'},
211 'untrusted-server-cert': {'v_range': [['7.0.0', '']], 'choices': ['allow', 'block', 'ignore'], 'type': 'str'},
212 'unsupported-ssl-version': {'v_range': [['7.0.1', '']], 'choices': ['block', 'allow', 'inspect'], 'type': 'str'},
213 'min-allowed-ssl-version': {'v_range': [['7.0.3', '']], 'choices': ['ssl-3.0', 'tls-1.0', 'tls-1.1', 'tls-1.2', 'tls-1.3'], 'type': 'str'},
214 'quic': {'v_range': [['7.4.1', '']], 'choices': ['disable', 'enable', 'bypass', 'block', 'inspect'], 'type': 'str'},
215 'udp-not-quic': {'v_range': [['7.6.2', '']], 'choices': ['block', 'allow'], 'type': 'str'}
216 }
217 }
218 }
219
220 module_option_spec = get_module_arg_spec('partial crud')
221 module_arg_spec.update(module_option_spec)
222 check_galaxy_version(module_arg_spec)
223 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'firewall_sslsshprofile_dot'),
224 supports_check_mode=True)
225 if not module._socket_path:
226 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
227 connection = Connection(module._socket_path)
228 fmgr = NAPIManager('partial crud', module_arg_spec, urls_list,
229 None, 'data', module, connection)
230 fmgr.process_partial_crud()
231 module.exit_json(meta=module.params)
232
233
234 if __name__ == '__main__':
235 main()