| 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_sslsshprofile_ssh |
| 15 |
short_description: Configure SSH options. |
| 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 |
ssl-ssh-profile: |
| 29 |
description: Deprecated, please use "ssl_ssh_profile" |
| 30 |
type: str |
| 31 |
ssl_ssh_profile: |
| 32 |
description: The parameter (ssl-ssh-profile) in requested url. |
| 33 |
type: str |
| 34 |
firewall_sslsshprofile_ssh: |
| 35 |
description: The top level parameters set. |
| 36 |
required: false |
| 37 |
type: dict |
| 38 |
suboptions: |
| 39 |
inspect_all: |
| 40 |
aliases: ['inspect-all'] |
| 41 |
type: str |
| 42 |
description: Level of SSL inspection. |
| 43 |
choices: ['disable', 'deep-inspection'] |
| 44 |
ports: |
| 45 |
type: raw |
| 46 |
description: (list) Ports to use for scanning |
| 47 |
ssh_algorithm: |
| 48 |
aliases: ['ssh-algorithm'] |
| 49 |
type: str |
| 50 |
description: Relative strength of encryption algorithms accepted during negotiation. |
| 51 |
choices: ['compatible', 'high-encryption'] |
| 52 |
ssh_policy_check: |
| 53 |
aliases: ['ssh-policy-check'] |
| 54 |
type: str |
| 55 |
description: Enable/disable SSH policy check. |
| 56 |
choices: ['disable', 'enable'] |
| 57 |
ssh_tun_policy_check: |
| 58 |
aliases: ['ssh-tun-policy-check'] |
| 59 |
type: str |
| 60 |
description: Enable/disable SSH tunnel policy check. |
| 61 |
choices: ['disable', 'enable'] |
| 62 |
status: |
| 63 |
type: str |
| 64 |
description: Configure protocol inspection status. |
| 65 |
choices: ['disable', 'deep-inspection'] |
| 66 |
unsupported_version: |
| 67 |
aliases: ['unsupported-version'] |
| 68 |
type: str |
| 69 |
description: Action based on SSH version being unsupported. |
| 70 |
choices: ['block', 'bypass'] |
| 71 |
block: |
| 72 |
type: list |
| 73 |
elements: str |
| 74 |
description: SSH blocking options. |
| 75 |
choices: ['x11-filter', 'ssh-shell', 'exec', 'port-forward'] |
| 76 |
log: |
| 77 |
type: list |
| 78 |
elements: str |
| 79 |
description: SSH logging options. |
| 80 |
choices: ['x11-filter', 'ssh-shell', 'exec', 'port-forward'] |
| 81 |
proxy_after_tcp_handshake: |
| 82 |
aliases: ['proxy-after-tcp-handshake'] |
| 83 |
type: str |
| 84 |
description: Proxy traffic after the TCP 3-way handshake has been established |
| 85 |
choices: ['disable', 'enable'] |
| 86 |
''' |
| 87 |
|
| 88 |
EXAMPLES = ''' |
| 89 |
- name: Example playbook (generated based on argument schema) |
| 90 |
hosts: fortimanagers |
| 91 |
connection: httpapi |
| 92 |
gather_facts: false |
| 93 |
tasks: |
| 94 |
- name: Configure SSH options. |
| 95 |
fortinet.fortimanager.fmgr_firewall_sslsshprofile_ssh: |
| 96 |
# workspace_locking_adom: <global or your adom name> |
| 97 |
adom: <your own value> |
| 98 |
ssl_ssh_profile: <your own value> |
| 99 |
firewall_sslsshprofile_ssh: |
| 100 |
# inspect_all: <value in [disable, deep-inspection]> |
| 101 |
# ports: <list or integer> |
| 102 |
# ssh_algorithm: <value in [compatible, high-encryption]> |
| 103 |
# ssh_policy_check: <value in [disable, enable]> |
| 104 |
# ssh_tun_policy_check: <value in [disable, enable]> |
| 105 |
# status: <value in [disable, deep-inspection]> |
| 106 |
# unsupported_version: <value in [block, bypass]> |
| 107 |
# block: ["x11-filter", "ssh-shell", "exec", "port-forward"] |
| 108 |
# log: ["x11-filter", "ssh-shell", "exec", "port-forward"] |
| 109 |
# proxy_after_tcp_handshake: <value in [disable, enable]> |
| 110 |
''' |
| 111 |
|
| 112 |
RETURN = ''' |
| 113 |
meta: |
| 114 |
description: The result of the request. |
| 115 |
type: dict |
| 116 |
returned: always |
| 117 |
contains: |
| 118 |
request_url: |
| 119 |
description: The full url requested. |
| 120 |
returned: always |
| 121 |
type: str |
| 122 |
sample: /sys/login/user |
| 123 |
response_code: |
| 124 |
description: The status of api request. |
| 125 |
returned: always |
| 126 |
type: int |
| 127 |
sample: 0 |
| 128 |
response_data: |
| 129 |
description: The api response. |
| 130 |
type: list |
| 131 |
returned: always |
| 132 |
response_message: |
| 133 |
description: The descriptive message of the api response. |
| 134 |
type: str |
| 135 |
returned: always |
| 136 |
sample: OK. |
| 137 |
system_information: |
| 138 |
description: The information of the target system. |
| 139 |
type: dict |
| 140 |
returned: always |
| 141 |
rc: |
| 142 |
description: The status the request. |
| 143 |
type: int |
| 144 |
returned: always |
| 145 |
sample: 0 |
| 146 |
version_check_warning: |
| 147 |
description: Warning if the parameters used in the playbook are not supported by the current FortiManager version. |
| 148 |
type: list |
| 149 |
returned: complex |
| 150 |
''' |
| 151 |
from ansible.module_utils.basic import AnsibleModule |
| 152 |
from ansible.module_utils.connection import Connection |
| 153 |
from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass |
| 154 |
from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec |
| 155 |
|
| 156 |
|
| 157 |
def main(): |
| 158 |
urls_list = [ |
| 159 |
'/pm/config/adom/{adom}/obj/firewall/ssl-ssh-profile/{ssl-ssh-profile}/ssh', |
| 160 |
'/pm/config/global/obj/firewall/ssl-ssh-profile/{ssl-ssh-profile}/ssh' |
| 161 |
] |
| 162 |
module_arg_spec = { |
| 163 |
'adom': {'required': True, 'type': 'str'}, |
| 164 |
'ssl-ssh-profile': {'type': 'str', 'api_name': 'ssl_ssh_profile'}, |
| 165 |
'ssl_ssh_profile': {'type': 'str'}, |
| 166 |
'revision_note': {'type': 'str'}, |
| 167 |
'firewall_sslsshprofile_ssh': { |
| 168 |
'type': 'dict', 'v_range': [['6.0.0', '']], |
| 169 |
'options': { |
| 170 |
'inspect-all': {'choices': ['disable', 'deep-inspection'], 'type': 'str'}, |
| 171 |
'ports': {'type': 'raw'}, |
| 172 |
'ssh-algorithm': {'choices': ['compatible', 'high-encryption'], 'type': 'str'}, |
| 173 |
'ssh-policy-check': {'v_range': [['6.0.0', '7.2.1']], 'choices': ['disable', 'enable'], 'type': 'str'}, |
| 174 |
'ssh-tun-policy-check': {'choices': ['disable', 'enable'], 'type': 'str'}, |
| 175 |
'status': {'choices': ['disable', 'deep-inspection'], 'type': 'str'}, |
| 176 |
'unsupported-version': {'choices': ['block', 'bypass'], 'type': 'str'}, |
| 177 |
'block': { |
| 178 |
'v_range': [['6.2.0', '6.4.15']], |
| 179 |
'type': 'list', |
| 180 |
'choices': ['x11-filter', 'ssh-shell', 'exec', 'port-forward'], |
| 181 |
'elements': 'str' |
| 182 |
}, |
| 183 |
'log': { |
| 184 |
'v_range': [['6.2.0', '6.4.15']], |
| 185 |
'type': 'list', |
| 186 |
'choices': ['x11-filter', 'ssh-shell', 'exec', 'port-forward'], |
| 187 |
'elements': 'str' |
| 188 |
}, |
| 189 |
'proxy-after-tcp-handshake': {'v_range': [['6.4.0', '']], 'choices': ['disable', 'enable'], 'type': 'str'} |
| 190 |
} |
| 191 |
} |
| 192 |
} |
| 193 |
|
| 194 |
module_option_spec = get_module_arg_spec('partial crud') |
| 195 |
module_arg_spec.update(module_option_spec) |
| 196 |
check_galaxy_version(module_arg_spec) |
| 197 |
module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'firewall_sslsshprofile_ssh'), |
| 198 |
supports_check_mode=True) |
| 199 |
if not module._socket_path: |
| 200 |
module.fail_json(msg='MUST RUN IN HTTPAPI MODE') |
| 201 |
connection = Connection(module._socket_path) |
| 202 |
fmgr = NAPIManager('partial crud', module_arg_spec, urls_list, |
| 203 |
None, 'data', module, connection) |
| 204 |
fmgr.process_partial_crud() |
| 205 |
module.exit_json(meta=module.params) |
| 206 |
|
| 207 |
|
| 208 |
if __name__ == '__main__': |
| 209 |
main() |