| 1 |
|
| 2 |
from __future__ import absolute_import, division, print_function |
| 3 |
|
| 4 |
|
| 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_profileprotocoloptions_cifs |
| 15 |
short_description: Configure CIFS protocol options. |
| 16 |
version_added: "2.1.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-protocol-options: |
| 29 |
description: Deprecated, please use "profile_protocol_options" |
| 30 |
type: str |
| 31 |
profile_protocol_options: |
| 32 |
description: The parameter (profile-protocol-options) in requested url. |
| 33 |
type: str |
| 34 |
firewall_profileprotocoloptions_cifs: |
| 35 |
description: The top level parameters set. |
| 36 |
required: false |
| 37 |
type: dict |
| 38 |
suboptions: |
| 39 |
ports: |
| 40 |
type: raw |
| 41 |
description: (list) Ports to scan for content |
| 42 |
status: |
| 43 |
type: str |
| 44 |
description: Enable/disable the active status of scanning for this protocol. |
| 45 |
choices: ['disable', 'enable'] |
| 46 |
options: |
| 47 |
type: list |
| 48 |
elements: str |
| 49 |
description: One or more options that can be applied to the session. |
| 50 |
choices: ['oversize'] |
| 51 |
oversize_limit: |
| 52 |
aliases: ['oversize-limit'] |
| 53 |
type: int |
| 54 |
description: Maximum in-memory file size that can be scanned |
| 55 |
scan_bzip2: |
| 56 |
aliases: ['scan-bzip2'] |
| 57 |
type: str |
| 58 |
description: Enable/disable scanning of BZip2 compressed files. |
| 59 |
choices: ['disable', 'enable'] |
| 60 |
tcp_window_maximum: |
| 61 |
aliases: ['tcp-window-maximum'] |
| 62 |
type: int |
| 63 |
description: Maximum dynamic TCP window size |
| 64 |
tcp_window_minimum: |
| 65 |
aliases: ['tcp-window-minimum'] |
| 66 |
type: int |
| 67 |
description: Minimum dynamic TCP window size |
| 68 |
tcp_window_size: |
| 69 |
aliases: ['tcp-window-size'] |
| 70 |
type: int |
| 71 |
description: Set TCP static window size |
| 72 |
tcp_window_type: |
| 73 |
aliases: ['tcp-window-type'] |
| 74 |
type: str |
| 75 |
description: Specify type of TCP window to use for this protocol. |
| 76 |
choices: ['system', 'static', 'dynamic', 'auto-tuning'] |
| 77 |
uncompressed_nest_limit: |
| 78 |
aliases: ['uncompressed-nest-limit'] |
| 79 |
type: int |
| 80 |
description: Maximum nested levels of compression that can be uncompressed and scanned |
| 81 |
uncompressed_oversize_limit: |
| 82 |
aliases: ['uncompressed-oversize-limit'] |
| 83 |
type: int |
| 84 |
description: Maximum in-memory uncompressed file size that can be scanned |
| 85 |
domain_controller: |
| 86 |
aliases: ['domain-controller'] |
| 87 |
type: str |
| 88 |
description: Domain for which to decrypt CIFS traffic. |
| 89 |
file_filter: |
| 90 |
aliases: ['file-filter'] |
| 91 |
type: dict |
| 92 |
description: File filter. |
| 93 |
suboptions: |
| 94 |
entries: |
| 95 |
type: list |
| 96 |
elements: dict |
| 97 |
description: Entries. |
| 98 |
suboptions: |
| 99 |
action: |
| 100 |
type: str |
| 101 |
description: Action taken for matched file. |
| 102 |
choices: ['log', 'block'] |
| 103 |
comment: |
| 104 |
type: str |
| 105 |
description: Comment. |
| 106 |
direction: |
| 107 |
type: str |
| 108 |
description: Match files transmitted in the sessions originating or reply direction. |
| 109 |
choices: ['any', 'incoming', 'outgoing'] |
| 110 |
file_type: |
| 111 |
aliases: ['file-type'] |
| 112 |
type: raw |
| 113 |
description: (list) Select file type. |
| 114 |
filter: |
| 115 |
type: str |
| 116 |
description: Add a file filter. |
| 117 |
protocol: |
| 118 |
type: list |
| 119 |
elements: str |
| 120 |
description: Protocols to apply with. |
| 121 |
choices: ['cifs'] |
| 122 |
log: |
| 123 |
type: str |
| 124 |
description: Enable/disable file filter logging. |
| 125 |
choices: ['disable', 'enable'] |
| 126 |
status: |
| 127 |
type: str |
| 128 |
description: Enable/disable file filter. |
| 129 |
choices: ['disable', 'enable'] |
| 130 |
server_credential_type: |
| 131 |
aliases: ['server-credential-type'] |
| 132 |
type: str |
| 133 |
description: CIFS server credential type. |
| 134 |
choices: ['none', 'credential-replication', 'credential-keytab'] |
| 135 |
server_keytab: |
| 136 |
aliases: ['server-keytab'] |
| 137 |
type: list |
| 138 |
elements: dict |
| 139 |
description: Server keytab. |
| 140 |
suboptions: |
| 141 |
keytab: |
| 142 |
type: str |
| 143 |
description: Base64 encoded keytab file containing credential of the server. |
| 144 |
password: |
| 145 |
type: raw |
| 146 |
description: (list) Password for keytab. |
| 147 |
principal: |
| 148 |
type: str |
| 149 |
description: Service principal. |
| 150 |
''' |
| 151 |
|
| 152 |
EXAMPLES = ''' |
| 153 |
- name: Example playbook (generated based on argument schema) |
| 154 |
hosts: fortimanagers |
| 155 |
connection: httpapi |
| 156 |
gather_facts: false |
| 157 |
tasks: |
| 158 |
- name: Configure CIFS protocol options. |
| 159 |
fortinet.fortimanager.fmgr_firewall_profileprotocoloptions_cifs: |
| 160 |
# workspace_locking_adom: <global or your adom name> |
| 161 |
adom: <your own value> |
| 162 |
profile_protocol_options: <your own value> |
| 163 |
firewall_profileprotocoloptions_cifs: |
| 164 |
# ports: <list or integer> |
| 165 |
# status: <value in [disable, enable]> |
| 166 |
# options: ["oversize"] |
| 167 |
# oversize_limit: <integer> |
| 168 |
# scan_bzip2: <value in [disable, enable]> |
| 169 |
# tcp_window_maximum: <integer> |
| 170 |
# tcp_window_minimum: <integer> |
| 171 |
# tcp_window_size: <integer> |
| 172 |
# tcp_window_type: <value in [system, static, dynamic, ...]> |
| 173 |
# uncompressed_nest_limit: <integer> |
| 174 |
# uncompressed_oversize_limit: <integer> |
| 175 |
# domain_controller: <string> |
| 176 |
# file_filter: |
| 177 |
# entries: |
| 178 |
# - action: <value in [log, block]> |
| 179 |
# comment: <string> |
| 180 |
# direction: <value in [any, incoming, outgoing]> |
| 181 |
# file_type: <list or string> |
| 182 |
# filter: <string> |
| 183 |
# protocol: ["cifs"] |
| 184 |
# log: <value in [disable, enable]> |
| 185 |
# status: <value in [disable, enable]> |
| 186 |
# server_credential_type: <value in [none, credential-replication, credential-keytab]> |
| 187 |
# server_keytab: |
| 188 |
# - keytab: <string> |
| 189 |
# password: <list or string> |
| 190 |
# principal: <string> |
| 191 |
''' |
| 192 |
|
| 193 |
RETURN = ''' |
| 194 |
meta: |
| 195 |
description: The result of the request. |
| 196 |
type: dict |
| 197 |
returned: always |
| 198 |
contains: |
| 199 |
request_url: |
| 200 |
description: The full url requested. |
| 201 |
returned: always |
| 202 |
type: str |
| 203 |
sample: /sys/login/user |
| 204 |
response_code: |
| 205 |
description: The status of api request. |
| 206 |
returned: always |
| 207 |
type: int |
| 208 |
sample: 0 |
| 209 |
response_data: |
| 210 |
description: The api response. |
| 211 |
type: list |
| 212 |
returned: always |
| 213 |
response_message: |
| 214 |
description: The descriptive message of the api response. |
| 215 |
type: str |
| 216 |
returned: always |
| 217 |
sample: OK. |
| 218 |
system_information: |
| 219 |
description: The information of the target system. |
| 220 |
type: dict |
| 221 |
returned: always |
| 222 |
rc: |
| 223 |
description: The status the request. |
| 224 |
type: int |
| 225 |
returned: always |
| 226 |
sample: 0 |
| 227 |
version_check_warning: |
| 228 |
description: Warning if the parameters used in the playbook are not supported by the current FortiManager version. |
| 229 |
type: list |
| 230 |
returned: complex |
| 231 |
''' |
| 232 |
from ansible.module_utils.basic import AnsibleModule |
| 233 |
from ansible.module_utils.connection import Connection |
| 234 |
from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass |
| 235 |
from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec |
| 236 |
|
| 237 |
|
| 238 |
def main(): |
| 239 |
urls_list = [ |
| 240 |
'/pm/config/adom/{adom}/obj/firewall/profile-protocol-options/{profile-protocol-options}/cifs', |
| 241 |
'/pm/config/global/obj/firewall/profile-protocol-options/{profile-protocol-options}/cifs' |
| 242 |
] |
| 243 |
module_arg_spec = { |
| 244 |
'adom': {'required': True, 'type': 'str'}, |
| 245 |
'profile-protocol-options': {'type': 'str', 'api_name': 'profile_protocol_options'}, |
| 246 |
'profile_protocol_options': {'type': 'str'}, |
| 247 |
'revision_note': {'type': 'str'}, |
| 248 |
'firewall_profileprotocoloptions_cifs': { |
| 249 |
'type': 'dict', 'v_range': [['6.2.0', '']], |
| 250 |
'options': { |
| 251 |
'ports': {'v_range': [['6.2.0', '']], 'type': 'raw'}, |
| 252 |
'status': {'v_range': [['6.2.0', '']], 'choices': ['disable', 'enable'], 'type': 'str'}, |
| 253 |
'options': {'v_range': [['6.4.0', '']], 'type': 'list', 'choices': ['oversize'], 'elements': 'str'}, |
| 254 |
'oversize-limit': {'v_range': [['6.4.0', '']], 'type': 'int'}, |
| 255 |
'scan-bzip2': {'v_range': [['6.4.0', '']], 'choices': ['disable', 'enable'], 'type': 'str'}, |
| 256 |
'tcp-window-maximum': {'v_range': [['6.4.0', '']], 'type': 'int'}, |
| 257 |
'tcp-window-minimum': {'v_range': [['6.4.0', '']], 'type': 'int'}, |
| 258 |
'tcp-window-size': {'v_range': [['6.4.0', '']], 'type': 'int'}, |
| 259 |
'tcp-window-type': {'v_range': [['6.4.0', '']], 'choices': ['system', 'static', 'dynamic', 'auto-tuning'], 'type': 'str'}, |
| 260 |
'uncompressed-nest-limit': {'v_range': [['6.4.0', '']], 'type': 'int'}, |
| 261 |
'uncompressed-oversize-limit': {'v_range': [['6.4.0', '']], 'type': 'int'}, |
| 262 |
'domain-controller': {'v_range': [['6.4.2', '']], 'type': 'str'}, |
| 263 |
'file-filter': { |
| 264 |
'v_range': [['6.4.2', '']], |
| 265 |
'type': 'dict', |
| 266 |
'options': { |
| 267 |
'entries': { |
| 268 |
'v_range': [['6.4.2', '']], |
| 269 |
'type': 'list', |
| 270 |
'options': { |
| 271 |
'action': {'v_range': [['6.4.2', '']], 'choices': ['log', 'block'], 'type': 'str'}, |
| 272 |
'comment': {'v_range': [['6.4.2', '']], 'type': 'str'}, |
| 273 |
'direction': {'v_range': [['6.4.2', '']], 'choices': ['any', 'incoming', 'outgoing'], 'type': 'str'}, |
| 274 |
'file-type': {'v_range': [['6.4.2', '']], 'type': 'raw'}, |
| 275 |
'filter': {'v_range': [['6.4.2', '']], 'type': 'str'}, |
| 276 |
'protocol': {'v_range': [['6.4.2', '']], 'type': 'list', 'choices': ['cifs'], 'elements': 'str'} |
| 277 |
}, |
| 278 |
'elements': 'dict' |
| 279 |
}, |
| 280 |
'log': {'v_range': [['6.4.2', '']], 'choices': ['disable', 'enable'], 'type': 'str'}, |
| 281 |
'status': {'v_range': [['6.4.2', '']], 'choices': ['disable', 'enable'], 'type': 'str'} |
| 282 |
} |
| 283 |
}, |
| 284 |
'server-credential-type': {'v_range': [['6.4.2', '']], 'choices': ['none', 'credential-replication', 'credential-keytab'], 'type': 'str'}, |
| 285 |
'server-keytab': { |
| 286 |
'v_range': [['6.4.2', '']], |
| 287 |
'no_log': True, |
| 288 |
'type': 'list', |
| 289 |
'options': { |
| 290 |
'keytab': {'v_range': [['6.4.2', '']], 'no_log': True, 'type': 'str'}, |
| 291 |
'password': {'v_range': [['6.4.2', '']], 'no_log': True, 'type': 'raw'}, |
| 292 |
'principal': {'v_range': [['6.4.2', '']], 'type': 'str'} |
| 293 |
}, |
| 294 |
'elements': 'dict' |
| 295 |
} |
| 296 |
} |
| 297 |
} |
| 298 |
} |
| 299 |
|
| 300 |
module_option_spec = get_module_arg_spec('partial crud') |
| 301 |
module_arg_spec.update(module_option_spec) |
| 302 |
check_galaxy_version(module_arg_spec) |
| 303 |
module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'firewall_profileprotocoloptions_cifs'), |
| 304 |
supports_check_mode=True) |
| 305 |
if not module._socket_path: |
| 306 |
module.fail_json(msg='MUST RUN IN HTTPAPI MODE') |
| 307 |
connection = Connection(module._socket_path) |
| 308 |
fmgr = NAPIManager('partial crud', module_arg_spec, urls_list, |
| 309 |
None, 'data', module, connection) |
| 310 |
fmgr.process_partial_crud() |
| 311 |
module.exit_json(meta=module.params) |
| 312 |
|
| 313 |
|
| 314 |
if __name__ == '__main__': |
| 315 |
main() |