Debian Codegraph @

ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_set_login_restrictions.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_set_login_restrictions
31 short_description: Set login restrictions.
32 description:
33 - Set login restrictions.
34 - This command is available only after logging in to the System Data domain.
35 - All operations are performed over Web Services API.
36 - Available from R82.10 management version.
37 version_added: "6.7.0"
38 author: "Eden Brillant (@chkp-edenbr)"
39 options:
40 lockout_admin_account:
41 description:
42 - Indicates whether to lockout administrator's account after specified number of failed authentication attempts.
43 type: bool
44 failed_authentication_attempts:
45 description:
46 - Number of failed authentication attempts before lockout administrator account. <font color="red">Required only when</font>
47 lockout-admin-account is set to true.
48 - Valid values are between 1 and 120.
49 type: int
50 unlock_admin_account:
51 description:
52 - Indicates whether to unlock administrator account after specified number of minutes. <font color="red">Required only when</font>
53 lockout-admin-account is set to true.
54 type: bool
55 lockout_duration:
56 description:
57 - Number of minutes of administrator account lockout. <font color="red">Required only when</font> lockout-admin-account is set to true.
58 - Valid values are between 1 and 120.
59 type: int
60 display_access_denied_message:
61 description:
62 - Indicates whether to display informative message upon denying access. <font color="red">Required only when</font> lockout-admin-account is set to true.
63 type: bool
64 extends_documentation_fragment: check_point.mgmt.checkpoint_commands
65 """
66
67 EXAMPLES = """
68 - name: set-login-restrictions
69 cp_mgmt_set_login_restrictions:
70 display_access_denied_message: false
71 failed_authentication_attempts: 10
72 lockout_admin_account: true
73 lockout_duration: 30
74 unlock_admin_account: false
75 """
76
77 RETURN = """
78 cp_mgmt_set_login_restrictions:
79 description: The checkpoint set-login-restrictions output.
80 returned: always.
81 type: dict
82 """
83
84 from ansible.module_utils.basic import AnsibleModule
85 from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command
86
87
88 def main():
89 argument_spec = dict(
90 lockout_admin_account=dict(type='bool'),
91 failed_authentication_attempts=dict(type='int'),
92 unlock_admin_account=dict(type='bool'),
93 lockout_duration=dict(type='int'),
94 display_access_denied_message=dict(type='bool')
95 )
96 argument_spec.update(checkpoint_argument_spec_for_commands)
97
98 module = AnsibleModule(argument_spec=argument_spec)
99
100 command = "set-login-restrictions"
101
102 result = api_command(module, command)
103 module.exit_json(**result)
104
105
106 if __name__ == '__main__':
107 main()