Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_firewall_sslsshprofile_sslserver.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_sslserver
15 short_description: SSL servers.
16 version_added: "2.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 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_sslserver:
35 description: The top level parameters set.
36 required: false
37 type: dict
38 suboptions:
39 ftps_client_cert_request:
40 aliases: ['ftps-client-cert-request']
41 type: str
42 description: Action based on client certificate request during the FTPS handshake.
43 choices: ['bypass', 'inspect', 'block']
44 https_client_cert_request:
45 aliases: ['https-client-cert-request']
46 type: str
47 description: Action based on client certificate request during the HTTPS handshake.
48 choices: ['bypass', 'inspect', 'block']
49 id:
50 type: int
51 description: SSL server ID.
52 required: true
53 imaps_client_cert_request:
54 aliases: ['imaps-client-cert-request']
55 type: str
56 description: Action based on client certificate request during the IMAPS handshake.
57 choices: ['bypass', 'inspect', 'block']
58 ip:
59 type: str
60 description: IPv4 address of the SSL server.
61 pop3s_client_cert_request:
62 aliases: ['pop3s-client-cert-request']
63 type: str
64 description: Action based on client certificate request during the POP3S handshake.
65 choices: ['bypass', 'inspect', 'block']
66 smtps_client_cert_request:
67 aliases: ['smtps-client-cert-request']
68 type: str
69 description: Action based on client certificate request during the SMTPS handshake.
70 choices: ['bypass', 'inspect', 'block']
71 ssl_other_client_cert_request:
72 aliases: ['ssl-other-client-cert-request']
73 type: str
74 description: Action based on client certificate request during an SSL protocol handshake.
75 choices: ['bypass', 'inspect', 'block']
76 ftps_client_certificate:
77 aliases: ['ftps-client-certificate']
78 type: str
79 description: Action based on received client certificate during the FTPS handshake.
80 choices: ['bypass', 'inspect', 'block']
81 https_client_certificate:
82 aliases: ['https-client-certificate']
83 type: str
84 description: Action based on received client certificate during the HTTPS handshake.
85 choices: ['bypass', 'inspect', 'block']
86 imaps_client_certificate:
87 aliases: ['imaps-client-certificate']
88 type: str
89 description: Action based on received client certificate during the IMAPS handshake.
90 choices: ['bypass', 'inspect', 'block']
91 pop3s_client_certificate:
92 aliases: ['pop3s-client-certificate']
93 type: str
94 description: Action based on received client certificate during the POP3S handshake.
95 choices: ['bypass', 'inspect', 'block']
96 smtps_client_certificate:
97 aliases: ['smtps-client-certificate']
98 type: str
99 description: Action based on received client certificate during the SMTPS handshake.
100 choices: ['bypass', 'inspect', 'block']
101 ssl_other_client_certificate:
102 aliases: ['ssl-other-client-certificate']
103 type: str
104 description: Action based on received client certificate during an SSL protocol handshake.
105 choices: ['bypass', 'inspect', 'block']
106 '''
107
108 EXAMPLES = '''
109 - name: Example playbook
110 hosts: fortimanagers
111 gather_facts: false
112 connection: httpapi
113 vars:
114 ansible_httpapi_use_ssl: true
115 ansible_httpapi_validate_certs: false
116 ansible_httpapi_port: 443
117 tasks:
118 - name: SSL servers.
119 fortinet.fortimanager.fmgr_firewall_sslsshprofile_sslserver:
120 bypass_validation: false
121 adom: ansible
122 ssl_ssh_profile: "ansible-test" # name
123 state: present
124 firewall_sslsshprofile_sslserver:
125 ftps_client_cert_request: block # <value in [bypass, inspect, block]>
126 https_client_cert_request: bypass # <value in [bypass, inspect, block]>
127 id: 1
128 imaps_client_cert_request: bypass # <value in [bypass, inspect, block]>
129
130 - name: Gathering fortimanager facts
131 hosts: fortimanagers
132 gather_facts: false
133 connection: httpapi
134 vars:
135 ansible_httpapi_use_ssl: true
136 ansible_httpapi_validate_certs: false
137 ansible_httpapi_port: 443
138 tasks:
139 - name: Retrieve all the SSL servers SSL/SSH protocol option
140 fortinet.fortimanager.fmgr_fact:
141 facts:
142 selector: "firewall_sslsshprofile_sslserver"
143 params:
144 adom: "ansible"
145 ssl_ssh_profile: "ansible-test" # name
146 ssl_server: "your_value"
147 '''
148
149 RETURN = '''
150 meta:
151 description: The result of the request.
152 type: dict
153 returned: always
154 contains:
155 request_url:
156 description: The full url requested.
157 returned: always
158 type: str
159 sample: /sys/login/user
160 response_code:
161 description: The status of api request.
162 returned: always
163 type: int
164 sample: 0
165 response_data:
166 description: The api response.
167 type: list
168 returned: always
169 response_message:
170 description: The descriptive message of the api response.
171 type: str
172 returned: always
173 sample: OK.
174 system_information:
175 description: The information of the target system.
176 type: dict
177 returned: always
178 rc:
179 description: The status the request.
180 type: int
181 returned: always
182 sample: 0
183 version_check_warning:
184 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
185 type: list
186 returned: complex
187 '''
188 from ansible.module_utils.basic import AnsibleModule
189 from ansible.module_utils.connection import Connection
190 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
191 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
192
193
194 def main():
195 urls_list = [
196 '/pm/config/adom/{adom}/obj/firewall/ssl-ssh-profile/{ssl-ssh-profile}/ssl-server',
197 '/pm/config/global/obj/firewall/ssl-ssh-profile/{ssl-ssh-profile}/ssl-server'
198 ]
199 module_arg_spec = {
200 'adom': {'required': True, 'type': 'str'},
201 'ssl-ssh-profile': {'type': 'str', 'api_name': 'ssl_ssh_profile'},
202 'ssl_ssh_profile': {'type': 'str'},
203 'revision_note': {'type': 'str'},
204 'firewall_sslsshprofile_sslserver': {
205 'type': 'dict', 'v_range': [['6.0.0', '']],
206 'options': {
207 'ftps-client-cert-request': {'v_range': [['6.0.0', '7.6.2']], 'choices': ['bypass', 'inspect', 'block'], 'type': 'str'},
208 'https-client-cert-request': {'v_range': [['6.0.0', '7.6.2']], 'choices': ['bypass', 'inspect', 'block'], 'type': 'str'},
209 'id': {'required': True, 'type': 'int'},
210 'imaps-client-cert-request': {'v_range': [['6.0.0', '7.6.2']], 'choices': ['bypass', 'inspect', 'block'], 'type': 'str'},
211 'ip': {'type': 'str'},
212 'pop3s-client-cert-request': {'v_range': [['6.0.0', '7.6.2']], 'choices': ['bypass', 'inspect', 'block'], 'type': 'str'},
213 'smtps-client-cert-request': {'v_range': [['6.0.0', '7.6.2']], 'choices': ['bypass', 'inspect', 'block'], 'type': 'str'},
214 'ssl-other-client-cert-request': {'v_range': [['6.0.0', '7.6.2']], 'choices': ['bypass', 'inspect', 'block'], 'type': 'str'},
215 'ftps-client-certificate': {'v_range': [['6.4.0', '']], 'choices': ['bypass', 'inspect', 'block'], 'type': 'str'},
216 'https-client-certificate': {'v_range': [['6.4.0', '']], 'choices': ['bypass', 'inspect', 'block'], 'type': 'str'},
217 'imaps-client-certificate': {'v_range': [['6.4.0', '']], 'choices': ['bypass', 'inspect', 'block'], 'type': 'str'},
218 'pop3s-client-certificate': {'v_range': [['6.4.0', '']], 'choices': ['bypass', 'inspect', 'block'], 'type': 'str'},
219 'smtps-client-certificate': {'v_range': [['6.4.0', '']], 'choices': ['bypass', 'inspect', 'block'], 'type': 'str'},
220 'ssl-other-client-certificate': {'v_range': [['6.4.0', '']], 'choices': ['bypass', 'inspect', 'block'], 'type': 'str'}
221 }
222 }
223 }
224
225 module_option_spec = get_module_arg_spec('full crud')
226 module_arg_spec.update(module_option_spec)
227 check_galaxy_version(module_arg_spec)
228 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'firewall_sslsshprofile_sslserver'),
229 supports_check_mode=True)
230 if not module._socket_path:
231 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
232 connection = Connection(module._socket_path)
233 fmgr = NAPIManager('full crud', module_arg_spec, urls_list,
234 'id', 'data', module, connection)
235 fmgr.process_crud()
236 module.exit_json(meta=module.params)
237
238
239 if __name__ == '__main__':
240 main()