Debian Codegraph @

ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_mobile_profile.py

raw
1 #!/usr/bin/python
2 # -*- coding: utf-8 -*-
3 #
4 # Ansible module to manage CheckPoint Firewall (c) 2019
5 #
6 # Ansible is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
10 #
11 # Ansible is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
15 #
16 # You should have received a copy of the GNU General Public License
17 # along with Ansible. If not, see <http://www.gnu.org/licenses/>.
18 #
19
20 from __future__ import (absolute_import, division, print_function)
21
22 __metaclass__ = type
23
24 ANSIBLE_METADATA = {'metadata_version': '1.1',
25 'status': ['preview'],
26 'supported_by': 'community'}
27
28 DOCUMENTATION = """
29 ---
30 module: cp_mgmt_mobile_profile
31 short_description: Manages mobile-profile objects on Checkpoint over Web Services API
32 description:
33 - Manages mobile-profile objects on Checkpoint devices including creating, updating and removing objects.
34 - All operations are performed over Web Services API.
35 - Available from R82 management version.
36 version_added: "6.0.0"
37 author: "Eden Brillant (@chkp-edenbr)"
38 options:
39 name:
40 description:
41 - Object name.
42 type: str
43 required: True
44 applications:
45 description:
46 - Applications settings.
47 type: dict
48 suboptions:
49 enable_print_mails:
50 description:
51 - Allow to print mails.
52 type: bool
53 max_attachments_size:
54 description:
55 - Maximum size of attachments allowed for downloading - you can choose a unit (gbs, kbs, mbs, bytes) in "max-attachments-unit" field.
56 type: int
57 calendar_from_the_last:
58 description:
59 - How far back to see your Calendar from the current date - you can choose a unit (day, week, month) in "calendar-from-the-last-unit" field.
60 type: int
61 calendar_from_the_last_unit:
62 description:
63 - Unit for "calendar-from-the-last" numeric value.
64 type: str
65 choices: ['weeks', 'months', 'days']
66 calendar_to_the_following:
67 description:
68 - How much ahead to see your Calendar from the current date - you can choose a unit (day, week, month) in "calendar-to-the-following-unit" field.
69 type: int
70 calendar_to_the_following_unit:
71 description:
72 - Unit for "calendar-to-the-following" numeric value.
73 type: str
74 choices: ['weeks', 'months', 'days']
75 mail_from_the_last:
76 description:
77 - How far back to see your emails from the current date - choose a unit (day, week, month) in "mail-from-the-last-unit" field.
78 type: int
79 mail_from_the_last_unit:
80 description:
81 - Unit for "mail-from-the-last" numeric value.
82 type: str
83 choices: ['weeks', 'months', 'days']
84 synchronize_contacts:
85 description:
86 - Contacts synchronization method - from the mail server to device and the app and vice versa or from the mail server to device and the
87 app or from the mail server to the app.
88 type: str
89 choices: ['mail srv to app and device and vice versa', 'mail srv to app and device', 'mail srv to app']
90 allow_push_notification:
91 description:
92 - Allow to receive push notifications of mails and meetings.
93 type: bool
94 allow_calendar_sync:
95 description:
96 - Allow synchronization between business calendar to device calendar.
97 type: bool
98 allow_contacts_from_global_address_list:
99 description:
100 - Allow to add additional contacts from Global Address List to the app.
101 type: bool
102 allow_contacts_from_local_phone:
103 description:
104 - Allow to add additional contacts from local phone to the app.
105 type: bool
106 save_local_web_cache:
107 description:
108 - Configure whether local cache data generated by web browser should be preserved.
109 type: bool
110 allow_caching_docsec_credentials:
111 description:
112 - Allow store encrypted document credentials in application secure storage.
113 type: bool
114 allow_caching_docsec_keys:
115 description:
116 - Allow store encrypted document keys in application secure storage.
117 type: bool
118 client_customization:
119 description:
120 - Client customization settings.
121 type: dict
122 suboptions:
123 app_theme_color_dark:
124 description:
125 - Configure the application display colors in Dark mode. 6 hex digits that define RGB color - relevant for IOS.
126 type: str
127 app_theme_color_light:
128 description:
129 - Configure the application display colors in light mode. 6 hex digits that define RGB color - relevant for IOS.
130 type: str
131 allow_calendar:
132 description:
133 - Allow sync business calendar to device calendar.
134 type: bool
135 allow_contacts:
136 description:
137 - Enable/Disable contacts app.
138 type: bool
139 allow_mail:
140 description:
141 - Enable/Disable email app.
142 type: bool
143 allow_notes_sync:
144 description:
145 - Allow sync business notes to device notes.
146 type: bool
147 allow_saved_file_apps:
148 description:
149 - Allow the appearance of 'Saved file app' in the app list.
150 type: bool
151 allow_secure_chat:
152 description:
153 - Enable/Disable Messages app (depends on Mail app).
154 type: bool
155 allow_tasks:
156 description:
157 - Enable/Disable Tasks app.
158 type: bool
159 certificate_expire_message:
160 description:
161 - message to show users when certificate is expired - for admin to fill - can contain only English characters, digits, comma, spaces and points.
162 type: str
163 data_leak_prevention:
164 description:
165 - Data leak prevention settings.
166 type: dict
167 suboptions:
168 open_extension_with_external_app:
169 description:
170 - Open the following extensions from your app with external apps when they cannot be opened with Capsule viewer.
171 type: list
172 elements: str
173 choices: ['any file', 'word documents', 'excel documents', 'powerpoint documents', 'any microsoft office documents', 'media files']
174 share_protected_extension:
175 description:
176 - Share protected files extensions to external apps.
177 type: list
178 elements: str
179 choices: ['any file', 'word documents', 'excel documents', 'powerpoint documents', 'any microsoft office documents', 'media files']
180 share_unprotected_extension:
181 description:
182 - Share unprotected files extensions to external apps.
183 type: list
184 elements: str
185 choices: ['any file', 'word documents', 'excel documents', 'powerpoint documents', 'any microsoft office documents', 'media files']
186 allow_copy_paste:
187 description:
188 - Allow copy paste of mail content.
189 type: bool
190 block_forward_attachments:
191 description:
192 - Allow share mail attachments with external mails.
193 type: bool
194 block_screenshot:
195 description:
196 - If true - you can't make a screenshot from your app.
197 type: bool
198 allowed_domains_forward_attachment:
199 description:
200 - exclusion of domains which attachments are allowed to be sent, even that shared policy prevents sharing these kinds of attached files
201 - can contain only English characters, digits, comma, spaces and points.
202 type: str
203 accept_protected_file_extensions:
204 description:
205 - Accept protected files with these extensions from external apps to your app.
206 type: list
207 elements: str
208 choices: ['any file', 'word documents', 'excel documents', 'powerpoint documents', 'any microsoft office documents', 'media files']
209 accept_unprotected_file_extensions:
210 description:
211 - Accept unprotected files with these extensions from external apps to your app.
212 type: list
213 elements: str
214 choices: ['any file', 'word documents', 'excel documents', 'powerpoint documents', 'any microsoft office documents', 'media files']
215 allow_import_from_gallery:
216 description:
217 - Allow import media from gallery.
218 type: bool
219 allow_taking_photos_and_videos:
220 description:
221 - Allow the camera to be used from your app.
222 type: bool
223 offer_capsule_as_viewer:
224 description:
225 - Offer Capsule as a viewer for external protected documents.
226 type: bool
227 harmony_mobile:
228 description:
229 - Integrations settings.
230 type: dict
231 suboptions:
232 protect_policy_enabled:
233 description:
234 - Enable/disable Protect Application- cannot be enable if Harmony SDK is enable.
235 type: bool
236 protect_high_risk_action:
237 description:
238 - What is the action if there is high risk found by Harmony Mobile.
239 type: str
240 choices: ['none', 'wipe', 'block']
241 protect_high_risk_message:
242 description:
243 - The message can contain only English characters, digits, comma, spaces and points.
244 type: str
245 protect_medium_risk_action:
246 description:
247 - What is the action if there is medium risk found by Harmony Mobile.
248 type: str
249 choices: ['none', 'wipe', 'block']
250 protect_medium_risk_message:
251 description:
252 - The message can contain only English characters, digits, comma, spaces and points.
253 type: str
254 protect_not_activated_action:
255 description:
256 - What is the action if there is policy violation (configuration for Harmony Mobile).
257 type: str
258 choices: ['none', 'wipe', 'block']
259 protect_not_activated_message:
260 description:
261 - The message can contain only English characters, digits, comma, spaces and points.
262 type: str
263 enable_harmony_mobile_sdk:
264 description:
265 - Enable/disable Harmony SDK - cannot be enable if Harmony Mobile Application is enable.
266 type: bool
267 compromised_behavior:
268 description:
269 - Device configuration - response to malicious behavior (configuration for Harmony SDK).
270 type: str
271 choices: ['block', 'notify', 'ignore']
272 harmony_mobile_sdk_license:
273 description:
274 - License for Harmony Mobile Sdk (configuration for Harmony SDK) - can contain only English characters, digits, comma, spaces and point.
275 type: str
276 malware_behavior:
277 description:
278 - Behavior when App is identified as malicious (configuration for Harmony SDK).
279 type: str
280 choices: ['block', 'notify', 'ignore']
281 man_in_the_middle_attack:
282 description:
283 - Behavior when there is a network man-in-the-middle attack (configuration for Harmony SDK).
284 type: str
285 choices: ['block', 'notify', 'ignore']
286 os_integrity_compromised:
287 description:
288 - Behavior when Device OS is compromised (configuration for Harmony SDK).
289 type: str
290 choices: ['block', 'notify', 'ignore']
291 suspicious_app:
292 description:
293 - Behavior when App is suspected as malicious (configuration for Harmony SDK).
294 type: str
295 choices: ['block', 'notify', 'ignore']
296 suspicious_enterprise_certificate:
297 description:
298 - Behavior when a certificate profile has been installed allowing the installing of apps on device from unknown source - iOS only
299 (configuration for Harmony SDK).
300 type: str
301 choices: ['block', 'notify', 'ignore']
302 security:
303 description:
304 - Security settings.
305 type: dict
306 suboptions:
307 session_timeout:
308 description:
309 - Session timeout - you can choose a unit (day, week, month) in "session-timeout-unit" field.
310 type: int
311 session_timeout_unit:
312 description:
313 - Unit for "session-timeout" numeric value.
314 type: str
315 choices: ['weeks', 'days', 'hours', 'minutes']
316 activate_passcode_lock:
317 description:
318 - Require passcode to the application.
319 type: bool
320 allow_store_credentials:
321 description:
322 - Allow storing the credentials on the device.
323 type: bool
324 passcode_profile:
325 description:
326 - Passcode Policy object identified by the name or UID.
327 type: str
328 report_jailbroken:
329 description:
330 - Issue log when device is detected as jail broken.
331 type: bool
332 block_jailbroken:
333 description:
334 - Action upon detection of jail broken devices.
335 type: str
336 choices: ['block', 'none']
337 block_3rd_party_keyboard:
338 description:
339 - Block 3rd party keyboard.
340 type: bool
341 hide_ssl_connect_anyway_button:
342 description:
343 - Hide connect button on critical SSL trust failures.
344 type: bool
345 tags:
346 description:
347 - Collection of tag identifiers.
348 type: list
349 elements: str
350 color:
351 description:
352 - Color of the object. Should be one of existing colors.
353 type: str
354 choices: ['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', 'khaki', 'orchid', 'dark orange', 'dark sea green',
355 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon',
356 'coral', 'sea green', 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', 'yellow']
357 comments:
358 description:
359 - Comments string.
360 type: str
361 details_level:
362 description:
363 - The level of detail for some of the fields in the response can vary from showing only the UID value of the object to a fully detailed
364 representation of the object.
365 type: str
366 choices: ['uid', 'standard', 'full']
367 domains_to_process:
368 description:
369 - Indicates which domains to process the commands on. It cannot be used with the details-level full, must be run from the System Domain only and
370 with ignore-warnings true. Valid values are, CURRENT_DOMAIN, ALL_DOMAINS_ON_THIS_SERVER.
371 type: list
372 elements: str
373 ignore_warnings:
374 description:
375 - Apply changes ignoring warnings.
376 type: bool
377 ignore_errors:
378 description:
379 - Apply changes ignoring errors. You won't be able to publish such a changes. If ignore-warnings flag was omitted - warnings will also be ignored.
380 type: bool
381 extends_documentation_fragment: check_point.mgmt.checkpoint_objects
382 """
383
384 EXAMPLES = """
385 - name: add-mobile-profile
386 cp_mgmt_mobile_profile:
387 name: New Mobile Profile
388 state: present
389
390 - name: set-mobile-profile
391 cp_mgmt_mobile_profile:
392 data_leak_prevention:
393 share_protected_extension: word documents
394 name: New Mobile Profile
395 state: present
396
397 - name: delete-mobile-profile
398 cp_mgmt_mobile_profile:
399 name: New Mobile Profile
400 state: absent
401 """
402
403 RETURN = """
404 cp_mgmt_mobile_profile:
405 description: The checkpoint object created or updated.
406 returned: always, except when deleting the object.
407 type: dict
408 """
409
410 from ansible.module_utils.basic import AnsibleModule
411 from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_objects, api_call
412
413
414 def main():
415 argument_spec = dict(
416 name=dict(type='str', required=True),
417 applications=dict(type='dict', options=dict(
418 enable_print_mails=dict(type='bool'),
419 max_attachments_size=dict(type='int'),
420 calendar_from_the_last=dict(type='int'),
421 calendar_from_the_last_unit=dict(type='str', choices=['weeks', 'months', 'days']),
422 calendar_to_the_following=dict(type='int'),
423 calendar_to_the_following_unit=dict(type='str', choices=['weeks', 'months', 'days']),
424 mail_from_the_last=dict(type='int'),
425 mail_from_the_last_unit=dict(type='str', choices=['weeks', 'months', 'days']),
426 synchronize_contacts=dict(type='str', choices=['mail srv to app and device and vice versa', 'mail srv to app and device', 'mail srv to app']),
427 allow_push_notification=dict(type='bool'),
428 allow_calendar_sync=dict(type='bool'),
429 allow_contacts_from_global_address_list=dict(type='bool'),
430 allow_contacts_from_local_phone=dict(type='bool'),
431 save_local_web_cache=dict(type='bool'),
432 allow_caching_docsec_credentials=dict(type='bool'),
433 allow_caching_docsec_keys=dict(type='bool')
434 )),
435 client_customization=dict(type='dict', options=dict(
436 app_theme_color_dark=dict(type='str'),
437 app_theme_color_light=dict(type='str'),
438 allow_calendar=dict(type='bool'),
439 allow_contacts=dict(type='bool'),
440 allow_mail=dict(type='bool'),
441 allow_notes_sync=dict(type='bool'),
442 allow_saved_file_apps=dict(type='bool'),
443 allow_secure_chat=dict(type='bool'),
444 allow_tasks=dict(type='bool'),
445 certificate_expire_message=dict(type='str')
446 )),
447 data_leak_prevention=dict(type='dict', options=dict(
448 open_extension_with_external_app=dict(type='list', elements='str', choices=['any file', 'word documents',
449 'excel documents',
450 'powerpoint documents',
451 'any microsoft office documents',
452 'media files']),
453 share_protected_extension=dict(type='list', elements='str', choices=['any file', 'word documents', 'excel documents',
454 'powerpoint documents',
455 'any microsoft office documents', 'media files']),
456 share_unprotected_extension=dict(type='list', elements='str', choices=['any file', 'word documents', 'excel documents',
457 'powerpoint documents',
458 'any microsoft office documents', 'media files']),
459 allow_copy_paste=dict(type='bool'),
460 block_forward_attachments=dict(type='bool'),
461 block_screenshot=dict(type='bool'),
462 allowed_domains_forward_attachment=dict(type='str'),
463 accept_protected_file_extensions=dict(type='list', elements='str', choices=['any file', 'word documents', 'excel documents',
464 'powerpoint documents',
465 'any microsoft office documents', 'media files']),
466 accept_unprotected_file_extensions=dict(type='list', elements='str', choices=['any file', 'word documents', 'excel documents',
467 'powerpoint documents',
468 'any microsoft office documents', 'media files']),
469 allow_import_from_gallery=dict(type='bool'),
470 allow_taking_photos_and_videos=dict(type='bool'),
471 offer_capsule_as_viewer=dict(type='bool')
472 )),
473 harmony_mobile=dict(type='dict', options=dict(
474 protect_policy_enabled=dict(type='bool'),
475 protect_high_risk_action=dict(type='str', choices=['none', 'wipe', 'block']),
476 protect_high_risk_message=dict(type='str'),
477 protect_medium_risk_action=dict(type='str', choices=['none', 'wipe', 'block']),
478 protect_medium_risk_message=dict(type='str'),
479 protect_not_activated_action=dict(type='str', choices=['none', 'wipe', 'block']),
480 protect_not_activated_message=dict(type='str'),
481 enable_harmony_mobile_sdk=dict(type='bool'),
482 compromised_behavior=dict(type='str', choices=['block', 'notify', 'ignore']),
483 harmony_mobile_sdk_license=dict(type='str'),
484 malware_behavior=dict(type='str', choices=['block', 'notify', 'ignore']),
485 man_in_the_middle_attack=dict(type='str', choices=['block', 'notify', 'ignore']),
486 os_integrity_compromised=dict(type='str', choices=['block', 'notify', 'ignore']),
487 suspicious_app=dict(type='str', choices=['block', 'notify', 'ignore']),
488 suspicious_enterprise_certificate=dict(type='str', choices=['block', 'notify', 'ignore'])
489 )),
490 security=dict(type='dict', options=dict(
491 session_timeout=dict(type='int'),
492 session_timeout_unit=dict(type='str', choices=['weeks', 'days', 'hours', 'minutes']),
493 activate_passcode_lock=dict(type='bool'),
494 allow_store_credentials=dict(type='bool'),
495 passcode_profile=dict(type='str', no_log=False),
496 report_jailbroken=dict(type='bool'),
497 block_jailbroken=dict(type='str', choices=['block', 'none']),
498 block_3rd_party_keyboard=dict(type='bool'),
499 hide_ssl_connect_anyway_button=dict(type='bool')
500 )),
501 tags=dict(type='list', elements='str'),
502 color=dict(type='str', choices=['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green',
503 'khaki', 'orchid', 'dark orange', 'dark sea green', 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown',
504 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', 'coral', 'sea green',
505 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna',
506 'yellow']),
507 comments=dict(type='str'),
508 details_level=dict(type='str', choices=['uid', 'standard', 'full']),
509 domains_to_process=dict(type='list', elements='str'),
510 ignore_warnings=dict(type='bool'),
511 ignore_errors=dict(type='bool')
512 )
513 argument_spec.update(checkpoint_argument_spec_for_objects)
514
515 module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True)
516 api_call_object = 'mobile-profile'
517
518 result = api_call(module, api_call_object)
519 module.exit_json(**result)
520
521
522 if __name__ == '__main__':
523 main()