Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_antivirus_profile_contentdisarm.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_antivirus_profile_contentdisarm
15 short_description: AV Content Disarm and Reconstruction settings.
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 profile:
29 description: The parameter (profile) in requested url.
30 type: str
31 required: true
32 antivirus_profile_contentdisarm:
33 description: The top level parameters set.
34 required: false
35 type: dict
36 suboptions:
37 cover_page:
38 aliases: ['cover-page']
39 type: str
40 description: Enable/disable inserting a cover page into the disarmed document.
41 choices: ['disable', 'enable']
42 detect_only:
43 aliases: ['detect-only']
44 type: str
45 description: Enable/disable only detect disarmable files, do not alter content.
46 choices: ['disable', 'enable']
47 office_embed:
48 aliases: ['office-embed']
49 type: str
50 description: Enable/disable stripping of embedded objects in Microsoft Office documents.
51 choices: ['disable', 'enable']
52 office_hylink:
53 aliases: ['office-hylink']
54 type: str
55 description: Enable/disable stripping of hyperlinks in Microsoft Office documents.
56 choices: ['disable', 'enable']
57 office_linked:
58 aliases: ['office-linked']
59 type: str
60 description: Enable/disable stripping of linked objects in Microsoft Office documents.
61 choices: ['disable', 'enable']
62 office_macro:
63 aliases: ['office-macro']
64 type: str
65 description: Enable/disable stripping of macros in Microsoft Office documents.
66 choices: ['disable', 'enable']
67 original_file_destination:
68 aliases: ['original-file-destination']
69 type: str
70 description: Destination to send original file if active content is removed.
71 choices: ['fortisandbox', 'quarantine', 'discard']
72 pdf_act_form:
73 aliases: ['pdf-act-form']
74 type: str
75 description: Enable/disable stripping of actions that submit data to other targets in PDF documents.
76 choices: ['disable', 'enable']
77 pdf_act_gotor:
78 aliases: ['pdf-act-gotor']
79 type: str
80 description: Enable/disable stripping of links to other PDFs in PDF documents.
81 choices: ['disable', 'enable']
82 pdf_act_java:
83 aliases: ['pdf-act-java']
84 type: str
85 description: Enable/disable stripping of actions that execute JavaScript code in PDF documents.
86 choices: ['disable', 'enable']
87 pdf_act_launch:
88 aliases: ['pdf-act-launch']
89 type: str
90 description: Enable/disable stripping of links to external applications in PDF documents.
91 choices: ['disable', 'enable']
92 pdf_act_movie:
93 aliases: ['pdf-act-movie']
94 type: str
95 description: Enable/disable stripping of embedded movies in PDF documents.
96 choices: ['disable', 'enable']
97 pdf_act_sound:
98 aliases: ['pdf-act-sound']
99 type: str
100 description: Enable/disable stripping of embedded sound files in PDF documents.
101 choices: ['disable', 'enable']
102 pdf_embedfile:
103 aliases: ['pdf-embedfile']
104 type: str
105 description: Enable/disable stripping of embedded files in PDF documents.
106 choices: ['disable', 'enable']
107 pdf_hyperlink:
108 aliases: ['pdf-hyperlink']
109 type: str
110 description: Enable/disable stripping of hyperlinks from PDF documents.
111 choices: ['disable', 'enable']
112 pdf_javacode:
113 aliases: ['pdf-javacode']
114 type: str
115 description: Enable/disable stripping of JavaScript code in PDF documents.
116 choices: ['disable', 'enable']
117 office_action:
118 aliases: ['office-action']
119 type: str
120 description: Enable/disable stripping of PowerPoint action events in Microsoft Office documents.
121 choices: ['disable', 'enable']
122 office_dde:
123 aliases: ['office-dde']
124 type: str
125 description: Enable/disable stripping of Dynamic Data Exchange events in Microsoft Office documents.
126 choices: ['disable', 'enable']
127 error_action:
128 aliases: ['error-action']
129 type: str
130 description: Action to be taken if CDR engine encounters an unrecoverable error.
131 choices: ['block', 'log-only', 'ignore']
132 analytics_suspicious:
133 aliases: ['analytics-suspicious']
134 type: str
135 description: Enable/disable using CDR as a secondary method for determining suspicous files for analytics.
136 choices: ['disable', 'enable']
137 '''
138
139 EXAMPLES = '''
140 - name: Example playbook (generated based on argument schema)
141 hosts: fortimanagers
142 connection: httpapi
143 gather_facts: false
144 tasks:
145 - name: AV Content Disarm and Reconstruction settings.
146 fortinet.fortimanager.fmgr_antivirus_profile_contentdisarm:
147 # workspace_locking_adom: <global or your adom name>
148 adom: <your own value>
149 profile: <your own value>
150 antivirus_profile_contentdisarm:
151 # cover_page: <value in [disable, enable]>
152 # detect_only: <value in [disable, enable]>
153 # office_embed: <value in [disable, enable]>
154 # office_hylink: <value in [disable, enable]>
155 # office_linked: <value in [disable, enable]>
156 # office_macro: <value in [disable, enable]>
157 # original_file_destination: <value in [fortisandbox, quarantine, discard]>
158 # pdf_act_form: <value in [disable, enable]>
159 # pdf_act_gotor: <value in [disable, enable]>
160 # pdf_act_java: <value in [disable, enable]>
161 # pdf_act_launch: <value in [disable, enable]>
162 # pdf_act_movie: <value in [disable, enable]>
163 # pdf_act_sound: <value in [disable, enable]>
164 # pdf_embedfile: <value in [disable, enable]>
165 # pdf_hyperlink: <value in [disable, enable]>
166 # pdf_javacode: <value in [disable, enable]>
167 # office_action: <value in [disable, enable]>
168 # office_dde: <value in [disable, enable]>
169 # error_action: <value in [block, log-only, ignore]>
170 # analytics_suspicious: <value in [disable, enable]>
171 '''
172
173 RETURN = '''
174 meta:
175 description: The result of the request.
176 type: dict
177 returned: always
178 contains:
179 request_url:
180 description: The full url requested.
181 returned: always
182 type: str
183 sample: /sys/login/user
184 response_code:
185 description: The status of api request.
186 returned: always
187 type: int
188 sample: 0
189 response_data:
190 description: The api response.
191 type: list
192 returned: always
193 response_message:
194 description: The descriptive message of the api response.
195 type: str
196 returned: always
197 sample: OK.
198 system_information:
199 description: The information of the target system.
200 type: dict
201 returned: always
202 rc:
203 description: The status the request.
204 type: int
205 returned: always
206 sample: 0
207 version_check_warning:
208 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
209 type: list
210 returned: complex
211 '''
212 from ansible.module_utils.basic import AnsibleModule
213 from ansible.module_utils.connection import Connection
214 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
215 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
216
217
218 def main():
219 urls_list = [
220 '/pm/config/adom/{adom}/obj/antivirus/profile/{profile}/content-disarm',
221 '/pm/config/global/obj/antivirus/profile/{profile}/content-disarm'
222 ]
223 module_arg_spec = {
224 'adom': {'required': True, 'type': 'str'},
225 'profile': {'required': True, 'type': 'str'},
226 'revision_note': {'type': 'str'},
227 'antivirus_profile_contentdisarm': {
228 'type': 'dict', 'v_range': [['6.0.0', '']],
229 'options': {
230 'cover-page': {'choices': ['disable', 'enable'], 'type': 'str'},
231 'detect-only': {'choices': ['disable', 'enable'], 'type': 'str'},
232 'office-embed': {'choices': ['disable', 'enable'], 'type': 'str'},
233 'office-hylink': {'choices': ['disable', 'enable'], 'type': 'str'},
234 'office-linked': {'choices': ['disable', 'enable'], 'type': 'str'},
235 'office-macro': {'choices': ['disable', 'enable'], 'type': 'str'},
236 'original-file-destination': {'choices': ['fortisandbox', 'quarantine', 'discard'], 'type': 'str'},
237 'pdf-act-form': {'choices': ['disable', 'enable'], 'type': 'str'},
238 'pdf-act-gotor': {'choices': ['disable', 'enable'], 'type': 'str'},
239 'pdf-act-java': {'choices': ['disable', 'enable'], 'type': 'str'},
240 'pdf-act-launch': {'choices': ['disable', 'enable'], 'type': 'str'},
241 'pdf-act-movie': {'choices': ['disable', 'enable'], 'type': 'str'},
242 'pdf-act-sound': {'choices': ['disable', 'enable'], 'type': 'str'},
243 'pdf-embedfile': {'choices': ['disable', 'enable'], 'type': 'str'},
244 'pdf-hyperlink': {'choices': ['disable', 'enable'], 'type': 'str'},
245 'pdf-javacode': {'choices': ['disable', 'enable'], 'type': 'str'},
246 'office-action': {'v_range': [['6.2.0', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
247 'office-dde': {'v_range': [['6.2.0', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
248 'error-action': {'v_range': [['6.4.2', '']], 'choices': ['block', 'log-only', 'ignore'], 'type': 'str'},
249 'analytics-suspicious': {'v_range': [['7.4.7', '']], 'choices': ['disable', 'enable'], 'type': 'str'}
250 }
251 }
252 }
253
254 module_option_spec = get_module_arg_spec('partial crud')
255 module_arg_spec.update(module_option_spec)
256 check_galaxy_version(module_arg_spec)
257 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'antivirus_profile_contentdisarm'),
258 supports_check_mode=True)
259 if not module._socket_path:
260 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
261 connection = Connection(module._socket_path)
262 fmgr = NAPIManager('partial crud', module_arg_spec, urls_list,
263 None, 'data', module, connection)
264 fmgr.process_partial_crud()
265 module.exit_json(meta=module.params)
266
267
268 if __name__ == '__main__':
269 main()