Skip to content

Commit 35d7b0b

Browse files
authored
Merge pull request #51 from chkp-ameera/master
Release 6.0.0
2 parents 17229b3 + 44f2f3c commit 35d7b0b

9 files changed

+495
-24
lines changed

CHANGELOG.rst

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,39 +5,42 @@ Check_Point.gaia Release Notes
55
.. contents:: Topics
66

77

8-
v7.0.0
8+
v6.0.0
99
======
1010

1111
Release Summary
1212
---------------
1313

14-
this release 7.0.0 of ``check_point.gaia``, released on 2025-1-1.
14+
this release 6.0.0 of ``check_point.gaia``, released on 2025-1-6.
1515

1616
New Modules
1717
-----------
1818

19+
- check_point.gaia.cp_gaia_alias_interface – Manage Alias interface of a Check Point machine over Web Services API.
20+
- check_point.gaia.cp_gaia_alias_interface_facts – Get information about alias interfaces of a Check Point machine over Web Services API.
21+
- check_point.gaia.cp_gaia_system_group – Manage system groups of a Check Point machine over Web Services API.
22+
- check_point.gaia.cp_gaia_system_group_facts – Get information about system groups of a Check Point machine over Web Services API.
1923
- check_point.gaia.cp_gaia_dynamic_content – install policy on a dynamic layer Check Point machine over Web Services API.
2024
- check_point.gaia.cp_gaia_dynamic_content_layer_facts – get the details of the installed policy on a given dynamic layer on a Check Point machine over Web Services API.
2125
- check_point.gaia.cp_gaia_dynamic_content_layers_facts – get the details of all dynamic layers on a Check Point machine over Web Services API.
2226
- check_point.gaia.cp_gaia_simulate_packet – simulate packet rulebase execution on a Check Point machine over Web Services API.
27+
- check_point.gaia.cp_gaia_virtual_systems_facts – get virtual-system objects facts on Check Point machine over Web Services API.
28+
- check_point.gaia.cp_gaia_virtual_switch – manages virtual switch on Check Point machine over Web Services API.
29+
- check_point.gaia.cp_gaia_virtual_switch_facts – get virtual-switch objects facts on Check Point machine over Web Services API.
30+
- check_point.gaia.cp_gaia_virtual_gateway – manages virtual-gateway objects on Check Point machine over Web Services API.
31+
- check_point.gaia.cp_gaia_virtual_gateway_facts – get virtual-gateway objects facts on Check Point machine over Web Services API.
32+
- check_point.gaia.cp_gaia_virtual_vsnext_state_facts – get the VSNext state on Check Point machine over Web Services API.
2333

34+
Major Changes
35+
---------------
2436

25-
v6.0.0
26-
======
37+
- Update physical interfaces to Show/Configure dhcp as part of the request.
2738

28-
Release Summary
39+
Bugfixes
2940
---------------
3041

31-
This is release 6.0.0 of ``check_point.gaia``, released on 2024-12-31.
32-
33-
New Modules
34-
-----------
35-
cp_gaia_virtual_systems_facts – get virtual-system objects facts on Check Point machine over Web Services API.
36-
cp_gaia_virtual_switch – manages virtual switch on Check Point machine over Web Services API.
37-
cp_gaia_virtual_switch_facts – get virtual-switch objects facts on Check Point machine over Web Services API.
38-
cp_gaia_virtual_gateway – manages virtual-gateway objects on Check Point machine over Web Services API.
39-
cp_gaia_virtual_gateway_facts – get virtual-gateway objects facts on Check Point machine over Web Services API.
40-
cp_gaia_virtual_vsnext_state_facts – get the VSNext state on Check Point machine over Web Services API.
42+
- Fix Password expiration lifetime and Password expiration lockout in password policy to accept never as string in addition to integers values.
43+
- Fix bug: Cannot change password hash of user admin.
4144

4245

4346
v5.0.1

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,11 @@ Modules
131131
* `cp_gaia_dynamic_content_layer_facts` – get the details of the installed policy on a given dynamic layer on a Check Point machine over Web Services API.
132132
* `cp_gaia_dynamic_content_layers_facts` – get the details of all dynamic layers on a Check Point machine over Web Services API.
133133
* `cp_gaia_simulate_packet` – simulate packet rulebase execution on a Check Point machine over Web Services API.
134+
* `cp_gaia_alias_interface` – Manage Alias interface of a Check Point machine over Web Services API.
135+
* `cp_gaia_alias_interface_facts` – Get information about alias interfaces of a Check Point machine over Web Services API.
136+
* `cp_gaia_system_group` – Manage system groups of a Check Point machine over Web Services API.
137+
* `cp_gaia_system_group_facts` – Get information about system groups of a Check Point machine over Web Services API.
138+
134139

135140
### Code of Conduct
136141
This collection follows the Ansible project's
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
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+
DOCUMENTATION = """
25+
module: cp_gaia_alias_interface
26+
author: Duane Toler (@duanetoler)
27+
description:
28+
- Modify alias interface.
29+
short_description: Modify alias interface.
30+
version_added: '8.0.0'
31+
notes:
32+
- Supports C(check_mode).
33+
options:
34+
version:
35+
description: Gaia API version for example 1.6.
36+
required: False
37+
type: str
38+
state:
39+
description: Ansible state which can be C(present) or C(absent).
40+
required: False
41+
type: str
42+
default: present
43+
choices: [present, absent]
44+
name:
45+
description: Interface name with format "<parent interface>:<id>", for example eth0:1, eth0:2 .. etc.
46+
required: true
47+
type: str
48+
ipv4_address:
49+
description: Interface IPv4 address.
50+
required: false
51+
type: str
52+
ipv4_mask_length:
53+
description: Interface IPv4 address mask length.
54+
required: false
55+
type: int
56+
"""
57+
58+
EXAMPLES = """
59+
- name: Set comment field of a alias interface
60+
check_point.gaia.cp_gaia_alias_interface:
61+
comments: "eth0:1 interface"
62+
name: eth0:1
63+
"""
64+
65+
RETURN = """
66+
alias_interface:
67+
description: The updated interface details.
68+
returned: always.
69+
type: dict
70+
"""
71+
72+
from ansible.module_utils.basic import AnsibleModule
73+
from ansible_collections.check_point.gaia.plugins.module_utils.checkpoint import chkp_api_call, checkpoint_argument_spec_for_all
74+
75+
76+
def main():
77+
# arguments for the module:
78+
fields = dict(
79+
state=dict(type='str', default='present', choices=['present', 'absent']),
80+
name=dict(required=True, type='str'),
81+
ipv4_address=dict(required=True, type='str'),
82+
ipv4_mask_length=dict(required=True, type='int')
83+
)
84+
fields.update(checkpoint_argument_spec_for_all)
85+
module = AnsibleModule(argument_spec=fields, supports_check_mode=True)
86+
api_call_object = 'alias-interface'
87+
ignore = ['parent']
88+
show_params = ['name']
89+
add_params = {}
90+
parent_and_id = module.params["name"].split(":")
91+
if len(parent_and_id) == 2:
92+
add_params = {"parent": parent_and_id[0] }
93+
94+
res = chkp_api_call(module, api_call_object, True, ignore=ignore, show_params=show_params, add_params=add_params)
95+
module.exit_json(**res)
96+
97+
98+
if __name__ == "__main__":
99+
main()
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
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+
DOCUMENTATION = """
25+
module: cp_gaia_alias_interface_facts
26+
author: Duane Toler (@duanetoler)
27+
description:
28+
- Show alias interface.
29+
short_description: Show alias interface/s.
30+
version_added: '8.0.0'
31+
notes:
32+
- Supports C(check_mode).
33+
options:
34+
version:
35+
description: Gaia API version for example 1.6.
36+
required: False
37+
type: str
38+
name:
39+
description: Interface name to show. If not specified, all alias interfaces information is returned.
40+
required: false
41+
type: str
42+
"""
43+
44+
EXAMPLES = """
45+
- name: Show alias interface
46+
check_point.gaia.cp_gaia_alias_interface_facts:
47+
- name: Show alias interface by specifying it's name
48+
check_point.gaia.cp_gaia_alias_interface_facts:
49+
name: eth0:1
50+
"""
51+
52+
RETURN = """
53+
ansible_facts:
54+
description: The interface/s facts.
55+
returned: always.
56+
type: dict
57+
contains:
58+
objects:
59+
description:
60+
- List of interfaces.
61+
returned: always
62+
type: list
63+
elements: dict
64+
contains:
65+
name:
66+
description:
67+
- Interface name.
68+
returned: always
69+
type: str
70+
ipv4_address:
71+
description: Interface IPv4 address.
72+
returned: always
73+
type: str
74+
ipv4_mask_length:
75+
description: Interface IPv4 address mask length.
76+
returned: always
77+
type: int
78+
enabled:
79+
description: Interface State.
80+
returned: always
81+
type: bool
82+
"""
83+
84+
from ansible.module_utils.basic import AnsibleModule
85+
from ansible_collections.check_point.gaia.plugins.module_utils.checkpoint import chkp_facts_api_call, checkpoint_argument_spec_for_all
86+
87+
88+
def main():
89+
# arguments for the module:
90+
fields = dict(
91+
name=dict(required=False, type='str')
92+
)
93+
fields.update(checkpoint_argument_spec_for_all)
94+
module = AnsibleModule(argument_spec=fields, supports_check_mode=True)
95+
api_call_object = "alias-interface"
96+
97+
res = chkp_facts_api_call(module, api_call_object, True)
98+
module.exit_json(ansible_facts=res["ansible_facts"])
99+
100+
101+
if __name__ == "__main__":
102+
main()

plugins/modules/cp_gaia_password_policy.py

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,18 +84,18 @@
8484
type: int
8585
default: 10
8686
password_expiration_days:
87-
description: Password expiration lifetime, Valid values are 60-604800.
87+
description: Password expiration lifetime, Valid values are 60-604800 or "never".
8888
required: False
89-
type: int
89+
type: raw
9090
password_expiration_warning_days:
9191
description: Number of days before a password expires that the user gets warned, Valid values are 1-366.
9292
required: False
9393
type: int
9494
default: 7
9595
password_expiration_maximum_days_before_lock:
96-
description: Password expiration lockout in days, Valid values are 1-1827.
96+
description: Password expiration lockout in days, Valid values are 1-1827 or "never".
9797
required: False
98-
type: int
98+
type: raw
9999
must_one_time_password_enabled:
100100
description: Forces a user to change their password after it has been set via "User Management"
101101
(but not via "Self Password Change" or forced change at login).
@@ -192,9 +192,9 @@ def main():
192192
failed_attempts_allowed=dict(type='int', default=10)
193193
)
194194
),
195-
password_expiration_days=dict(type='int', no_log=True),
195+
password_expiration_days=dict(type='raw', no_log=True),
196196
password_expiration_warning_days=dict(type='int', default=7, no_log=True),
197-
password_expiration_maximum_days_before_lock=dict(type='int', no_log=True),
197+
password_expiration_maximum_days_before_lock=dict(type='raw', no_log=True),
198198
must_one_time_password_enabled=dict(type='bool', default=False)
199199
)
200200
),
@@ -220,6 +220,28 @@ def main():
220220
fields.update(checkpoint_argument_spec_for_all)
221221
module = AnsibleModule(argument_spec=fields, supports_check_mode=True)
222222

223+
# handle password_expiration_days, it can get never in addition to integer
224+
password_expiration_days = module.params.get('password_expiration_days')
225+
try:
226+
if password_expiration_days is not None:
227+
password_expiration_days = int(password_expiration_days)
228+
except ValueError:
229+
if password_expiration_days == "never":
230+
pass
231+
else:
232+
module.fail_json(msg="The 'password_expiration_days' parameter must be an integer or never.")
233+
234+
# handle password_expiration_maximum_days_before_lock, it can get never in addition to integer
235+
password_expiration_maximum_days_before_lock = module.params.get('password_expiration_maximum_days_before_lock')
236+
try:
237+
if password_expiration_maximum_days_before_lock is not None:
238+
password_expiration_maximum_days_before_lock = int(password_expiration_maximum_days_before_lock)
239+
except ValueError:
240+
if password_expiration_maximum_days_before_lock == "never":
241+
pass
242+
else:
243+
module.fail_json(msg="The 'password_expiration_maximum_days_before_lock' parameter must be an integer or never.")
244+
223245
api_call_object = 'password-policy'
224246

225247
res = chkp_api_call(module, api_call_object, False)

plugins/modules/cp_gaia_physical_interface.py

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,40 @@
103103
description: Virtual System ID.
104104
required: false
105105
type: int
106+
dhcp:
107+
description: DHCP configuration.
108+
required: false
109+
type: dict
110+
suboptions:
111+
enabled:
112+
description: Enable DHCP on this interface.
113+
required: False
114+
type: bool
115+
server_timeout:
116+
description: Specifies the amount of time, in seconds,
117+
that must pass between the time that the interface begins to try to determine its address
118+
and the time that it decides that it's not going to be able to contact a server.
119+
required: False
120+
type: int
121+
default: 60
122+
retry:
123+
description: Specifies the time, in seconds,
124+
that must pass after the interface has determined that there is no DHCP server present
125+
before it tries again to contact a DHCP server.
126+
required: False
127+
type: int
128+
default: 300
129+
leasetime:
130+
description: Specifies the lease time, in seconds, when requesting for an IP address. Default value is "default" - according to the server.
131+
required: False
132+
type: int
133+
reacquire_timeout:
134+
description: When trying to reacquire the last ip address,
135+
The reacquire-timeout statement sets the time, in seconds,
136+
that must elapse after the first try to reacquire the old address before it gives up and tries to discover a new address.
137+
required: False
138+
type: int
139+
default: 10
106140
107141
"""
108142

@@ -144,7 +178,17 @@ def main():
144178
mac_addr=dict(required=False, type="str"),
145179
rx_ringsize=dict(required=False, type="int"),
146180
speed=dict(required=False, type="str"),
147-
ipv6_mask_length=dict(required=False, type="int")
181+
ipv6_mask_length=dict(required=False, type="int"),
182+
dhcp=dict(
183+
type='dict',
184+
options=dict(
185+
enabled=dict(type='bool'),
186+
server_timeout=dict(type='int', default=60),
187+
retry=dict(type='int', default=300),
188+
leasetime=dict(type='int'),
189+
reacquire_timeout=dict(type='int', default=10),
190+
)
191+
)
148192
)
149193
fields.update(checkpoint_argument_spec_for_all)
150194
module = AnsibleModule(argument_spec=fields, supports_check_mode=True)

0 commit comments

Comments
 (0)