Debian Codegraph @

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