| 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_vip6_sslserverciphersuites |
| 15 |
short_description: SSL/TLS cipher suites to offer to a server, ordered by priority. |
| 16 |
version_added: "2.0.0" |
| 17 |
extends_documentation_fragment: |
| 18 |
- fortinet.fortimanager.general |
| 19 |
- fortinet.fortimanager.general.full_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 |
vip6: |
| 29 |
description: The parameter (vip6) in requested url. |
| 30 |
type: str |
| 31 |
required: true |
| 32 |
firewall_vip6_sslserverciphersuites: |
| 33 |
description: The top level parameters set. |
| 34 |
required: false |
| 35 |
type: dict |
| 36 |
suboptions: |
| 37 |
cipher: |
| 38 |
type: str |
| 39 |
description: Cipher suite name. |
| 40 |
choices: ['TLS-RSA-WITH-RC4-128-MD5', 'TLS-RSA-WITH-RC4-128-SHA', |
| 41 |
'TLS-RSA-WITH-DES-CBC-SHA', 'TLS-RSA-WITH-3DES-EDE-CBC-SHA', |
| 42 |
'TLS-RSA-WITH-AES-128-CBC-SHA', 'TLS-RSA-WITH-AES-256-CBC-SHA', |
| 43 |
'TLS-RSA-WITH-AES-128-CBC-SHA256', 'TLS-RSA-WITH-AES-256-CBC-SHA256', |
| 44 |
'TLS-RSA-WITH-CAMELLIA-128-CBC-SHA', |
| 45 |
'TLS-RSA-WITH-CAMELLIA-256-CBC-SHA', |
| 46 |
'TLS-RSA-WITH-CAMELLIA-128-CBC-SHA256', |
| 47 |
'TLS-RSA-WITH-CAMELLIA-256-CBC-SHA256', 'TLS-RSA-WITH-SEED-CBC-SHA', |
| 48 |
'TLS-RSA-WITH-ARIA-128-CBC-SHA256', 'TLS-RSA-WITH-ARIA-256-CBC-SHA384', |
| 49 |
'TLS-DHE-RSA-WITH-DES-CBC-SHA', 'TLS-DHE-RSA-WITH-3DES-EDE-CBC-SHA', |
| 50 |
'TLS-DHE-RSA-WITH-AES-128-CBC-SHA', 'TLS-DHE-RSA-WITH-AES-256-CBC-SHA', |
| 51 |
'TLS-DHE-RSA-WITH-AES-128-CBC-SHA256', |
| 52 |
'TLS-DHE-RSA-WITH-AES-256-CBC-SHA256', |
| 53 |
'TLS-DHE-RSA-WITH-CAMELLIA-128-CBC-SHA', |
| 54 |
'TLS-DHE-RSA-WITH-CAMELLIA-256-CBC-SHA', |
| 55 |
'TLS-DHE-RSA-WITH-CAMELLIA-128-CBC-SHA256', |
| 56 |
'TLS-DHE-RSA-WITH-CAMELLIA-256-CBC-SHA256', |
| 57 |
'TLS-DHE-RSA-WITH-SEED-CBC-SHA', 'TLS-DHE-RSA-WITH-ARIA-128-CBC-SHA256', |
| 58 |
'TLS-DHE-RSA-WITH-ARIA-256-CBC-SHA384', |
| 59 |
'TLS-ECDHE-RSA-WITH-RC4-128-SHA', 'TLS-ECDHE-RSA-WITH-3DES-EDE-CBC-SHA', |
| 60 |
'TLS-ECDHE-RSA-WITH-AES-128-CBC-SHA', |
| 61 |
'TLS-ECDHE-RSA-WITH-AES-256-CBC-SHA', |
| 62 |
'TLS-ECDHE-RSA-WITH-CHACHA20-POLY1305-SHA256', |
| 63 |
'TLS-ECDHE-ECDSA-WITH-CHACHA20-POLY1305-SHA256', |
| 64 |
'TLS-DHE-RSA-WITH-CHACHA20-POLY1305-SHA256', |
| 65 |
'TLS-DHE-RSA-WITH-AES-128-GCM-SHA256', |
| 66 |
'TLS-DHE-RSA-WITH-AES-256-GCM-SHA384', |
| 67 |
'TLS-DHE-DSS-WITH-AES-128-CBC-SHA', 'TLS-DHE-DSS-WITH-AES-256-CBC-SHA', |
| 68 |
'TLS-DHE-DSS-WITH-AES-128-CBC-SHA256', |
| 69 |
'TLS-DHE-DSS-WITH-AES-128-GCM-SHA256', |
| 70 |
'TLS-DHE-DSS-WITH-AES-256-CBC-SHA256', |
| 71 |
'TLS-DHE-DSS-WITH-AES-256-GCM-SHA384', |
| 72 |
'TLS-ECDHE-RSA-WITH-AES-128-CBC-SHA256', |
| 73 |
'TLS-ECDHE-RSA-WITH-AES-128-GCM-SHA256', |
| 74 |
'TLS-ECDHE-RSA-WITH-AES-256-CBC-SHA384', |
| 75 |
'TLS-ECDHE-RSA-WITH-AES-256-GCM-SHA384', |
| 76 |
'TLS-ECDHE-ECDSA-WITH-AES-128-CBC-SHA', |
| 77 |
'TLS-ECDHE-ECDSA-WITH-AES-128-CBC-SHA256', |
| 78 |
'TLS-ECDHE-ECDSA-WITH-AES-128-GCM-SHA256', |
| 79 |
'TLS-ECDHE-ECDSA-WITH-AES-256-CBC-SHA384', |
| 80 |
'TLS-ECDHE-ECDSA-WITH-AES-256-GCM-SHA384', |
| 81 |
'TLS-RSA-WITH-AES-128-GCM-SHA256', 'TLS-RSA-WITH-AES-256-GCM-SHA384', |
| 82 |
'TLS-DHE-DSS-WITH-CAMELLIA-128-CBC-SHA', |
| 83 |
'TLS-DHE-DSS-WITH-CAMELLIA-256-CBC-SHA', |
| 84 |
'TLS-DHE-DSS-WITH-CAMELLIA-128-CBC-SHA256', |
| 85 |
'TLS-DHE-DSS-WITH-CAMELLIA-256-CBC-SHA256', |
| 86 |
'TLS-DHE-DSS-WITH-SEED-CBC-SHA', 'TLS-DHE-DSS-WITH-ARIA-128-CBC-SHA256', |
| 87 |
'TLS-DHE-DSS-WITH-ARIA-256-CBC-SHA384', |
| 88 |
'TLS-ECDHE-RSA-WITH-ARIA-128-CBC-SHA256', |
| 89 |
'TLS-ECDHE-RSA-WITH-ARIA-256-CBC-SHA384', |
| 90 |
'TLS-ECDHE-ECDSA-WITH-ARIA-128-CBC-SHA256', |
| 91 |
'TLS-ECDHE-ECDSA-WITH-ARIA-256-CBC-SHA384', |
| 92 |
'TLS-DHE-DSS-WITH-3DES-EDE-CBC-SHA', 'TLS-DHE-DSS-WITH-DES-CBC-SHA', |
| 93 |
'TLS-AES-128-GCM-SHA256', 'TLS-AES-256-GCM-SHA384', |
| 94 |
'TLS-CHACHA20-POLY1305-SHA256', 'TLS-ECDHE-ECDSA-WITH-AES-256-CBC-SHA'] |
| 95 |
priority: |
| 96 |
type: int |
| 97 |
description: SSL/TLS cipher suites priority. |
| 98 |
required: true |
| 99 |
versions: |
| 100 |
type: list |
| 101 |
elements: str |
| 102 |
description: SSL/TLS versions that the cipher suite can be used with. |
| 103 |
choices: ['ssl-3.0', 'tls-1.0', 'tls-1.1', 'tls-1.2', 'tls-1.3'] |
| 104 |
''' |
| 105 |
|
| 106 |
EXAMPLES = ''' |
| 107 |
- name: Example playbook |
| 108 |
hosts: fortimanagers |
| 109 |
gather_facts: false |
| 110 |
connection: httpapi |
| 111 |
vars: |
| 112 |
ansible_httpapi_use_ssl: true |
| 113 |
ansible_httpapi_validate_certs: false |
| 114 |
ansible_httpapi_port: 443 |
| 115 |
tasks: |
| 116 |
- name: SSL/TLS cipher suites to offer to a server, ordered by priority. |
| 117 |
fortinet.fortimanager.fmgr_firewall_vip6_sslserverciphersuites: |
| 118 |
bypass_validation: false |
| 119 |
adom: ansible |
| 120 |
vip6: "ansible-test-vip6" # name |
| 121 |
state: present |
| 122 |
firewall_vip6_sslserverciphersuites: |
| 123 |
cipher: "TLS-RSA-WITH-RC4-128-MD5" # <value in [TLS-RSA-WITH-RC4-128-MD5, TLS-RSA-WITH-RC4-128-SHA, TLS-RSA-WITH-DES-CBC-SHA, ...]> |
| 124 |
priority: 2 |
| 125 |
versions: |
| 126 |
- ssl-3.0 |
| 127 |
- tls-1.0 |
| 128 |
- tls-1.1 |
| 129 |
|
| 130 |
- name: Gathering fortimanager facts |
| 131 |
hosts: fortimanagers |
| 132 |
gather_facts: false |
| 133 |
connection: httpapi |
| 134 |
vars: |
| 135 |
ansible_httpapi_use_ssl: true |
| 136 |
ansible_httpapi_validate_certs: false |
| 137 |
ansible_httpapi_port: 443 |
| 138 |
tasks: |
| 139 |
- name: Retrieve all the SSL/TLS cipher suites |
| 140 |
fortinet.fortimanager.fmgr_fact: |
| 141 |
facts: |
| 142 |
selector: "firewall_vip6_sslserverciphersuites" |
| 143 |
params: |
| 144 |
adom: "ansible" |
| 145 |
vip6: "ansible-test-vip6" # name |
| 146 |
ssl_server_cipher_suites: "your_value" |
| 147 |
''' |
| 148 |
|
| 149 |
RETURN = ''' |
| 150 |
meta: |
| 151 |
description: The result of the request. |
| 152 |
type: dict |
| 153 |
returned: always |
| 154 |
contains: |
| 155 |
request_url: |
| 156 |
description: The full url requested. |
| 157 |
returned: always |
| 158 |
type: str |
| 159 |
sample: /sys/login/user |
| 160 |
response_code: |
| 161 |
description: The status of api request. |
| 162 |
returned: always |
| 163 |
type: int |
| 164 |
sample: 0 |
| 165 |
response_data: |
| 166 |
description: The api response. |
| 167 |
type: list |
| 168 |
returned: always |
| 169 |
response_message: |
| 170 |
description: The descriptive message of the api response. |
| 171 |
type: str |
| 172 |
returned: always |
| 173 |
sample: OK. |
| 174 |
system_information: |
| 175 |
description: The information of the target system. |
| 176 |
type: dict |
| 177 |
returned: always |
| 178 |
rc: |
| 179 |
description: The status the request. |
| 180 |
type: int |
| 181 |
returned: always |
| 182 |
sample: 0 |
| 183 |
version_check_warning: |
| 184 |
description: Warning if the parameters used in the playbook are not supported by the current FortiManager version. |
| 185 |
type: list |
| 186 |
returned: complex |
| 187 |
''' |
| 188 |
from ansible.module_utils.basic import AnsibleModule |
| 189 |
from ansible.module_utils.connection import Connection |
| 190 |
from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass |
| 191 |
from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec |
| 192 |
|
| 193 |
|
| 194 |
def main(): |
| 195 |
urls_list = [ |
| 196 |
'/pm/config/adom/{adom}/obj/firewall/vip6/{vip6}/ssl-server-cipher-suites', |
| 197 |
'/pm/config/global/obj/firewall/vip6/{vip6}/ssl-server-cipher-suites' |
| 198 |
] |
| 199 |
module_arg_spec = { |
| 200 |
'adom': {'required': True, 'type': 'str'}, |
| 201 |
'vip6': {'required': True, 'type': 'str'}, |
| 202 |
'revision_note': {'type': 'str'}, |
| 203 |
'firewall_vip6_sslserverciphersuites': { |
| 204 |
'type': 'dict', 'v_range': [['6.0.0', '']], |
| 205 |
'options': { |
| 206 |
'cipher': { |
| 207 |
'choices': [ |
| 208 |
'TLS-RSA-WITH-RC4-128-MD5', 'TLS-RSA-WITH-RC4-128-SHA', 'TLS-RSA-WITH-DES-CBC-SHA', 'TLS-RSA-WITH-3DES-EDE-CBC-SHA', |
| 209 |
'TLS-RSA-WITH-AES-128-CBC-SHA', 'TLS-RSA-WITH-AES-256-CBC-SHA', 'TLS-RSA-WITH-AES-128-CBC-SHA256', |
| 210 |
'TLS-RSA-WITH-AES-256-CBC-SHA256', 'TLS-RSA-WITH-CAMELLIA-128-CBC-SHA', 'TLS-RSA-WITH-CAMELLIA-256-CBC-SHA', |
| 211 |
'TLS-RSA-WITH-CAMELLIA-128-CBC-SHA256', 'TLS-RSA-WITH-CAMELLIA-256-CBC-SHA256', 'TLS-RSA-WITH-SEED-CBC-SHA', |
| 212 |
'TLS-RSA-WITH-ARIA-128-CBC-SHA256', 'TLS-RSA-WITH-ARIA-256-CBC-SHA384', 'TLS-DHE-RSA-WITH-DES-CBC-SHA', |
| 213 |
'TLS-DHE-RSA-WITH-3DES-EDE-CBC-SHA', 'TLS-DHE-RSA-WITH-AES-128-CBC-SHA', 'TLS-DHE-RSA-WITH-AES-256-CBC-SHA', |
| 214 |
'TLS-DHE-RSA-WITH-AES-128-CBC-SHA256', 'TLS-DHE-RSA-WITH-AES-256-CBC-SHA256', 'TLS-DHE-RSA-WITH-CAMELLIA-128-CBC-SHA', |
| 215 |
'TLS-DHE-RSA-WITH-CAMELLIA-256-CBC-SHA', 'TLS-DHE-RSA-WITH-CAMELLIA-128-CBC-SHA256', 'TLS-DHE-RSA-WITH-CAMELLIA-256-CBC-SHA256', |
| 216 |
'TLS-DHE-RSA-WITH-SEED-CBC-SHA', 'TLS-DHE-RSA-WITH-ARIA-128-CBC-SHA256', 'TLS-DHE-RSA-WITH-ARIA-256-CBC-SHA384', |
| 217 |
'TLS-ECDHE-RSA-WITH-RC4-128-SHA', 'TLS-ECDHE-RSA-WITH-3DES-EDE-CBC-SHA', 'TLS-ECDHE-RSA-WITH-AES-128-CBC-SHA', |
| 218 |
'TLS-ECDHE-RSA-WITH-AES-256-CBC-SHA', 'TLS-ECDHE-RSA-WITH-CHACHA20-POLY1305-SHA256', |
| 219 |
'TLS-ECDHE-ECDSA-WITH-CHACHA20-POLY1305-SHA256', 'TLS-DHE-RSA-WITH-CHACHA20-POLY1305-SHA256', |
| 220 |
'TLS-DHE-RSA-WITH-AES-128-GCM-SHA256', 'TLS-DHE-RSA-WITH-AES-256-GCM-SHA384', 'TLS-DHE-DSS-WITH-AES-128-CBC-SHA', |
| 221 |
'TLS-DHE-DSS-WITH-AES-256-CBC-SHA', 'TLS-DHE-DSS-WITH-AES-128-CBC-SHA256', 'TLS-DHE-DSS-WITH-AES-128-GCM-SHA256', |
| 222 |
'TLS-DHE-DSS-WITH-AES-256-CBC-SHA256', 'TLS-DHE-DSS-WITH-AES-256-GCM-SHA384', 'TLS-ECDHE-RSA-WITH-AES-128-CBC-SHA256', |
| 223 |
'TLS-ECDHE-RSA-WITH-AES-128-GCM-SHA256', 'TLS-ECDHE-RSA-WITH-AES-256-CBC-SHA384', 'TLS-ECDHE-RSA-WITH-AES-256-GCM-SHA384', |
| 224 |
'TLS-ECDHE-ECDSA-WITH-AES-128-CBC-SHA', 'TLS-ECDHE-ECDSA-WITH-AES-128-CBC-SHA256', 'TLS-ECDHE-ECDSA-WITH-AES-128-GCM-SHA256', |
| 225 |
'TLS-ECDHE-ECDSA-WITH-AES-256-CBC-SHA384', 'TLS-ECDHE-ECDSA-WITH-AES-256-GCM-SHA384', 'TLS-RSA-WITH-AES-128-GCM-SHA256', |
| 226 |
'TLS-RSA-WITH-AES-256-GCM-SHA384', 'TLS-DHE-DSS-WITH-CAMELLIA-128-CBC-SHA', 'TLS-DHE-DSS-WITH-CAMELLIA-256-CBC-SHA', |
| 227 |
'TLS-DHE-DSS-WITH-CAMELLIA-128-CBC-SHA256', 'TLS-DHE-DSS-WITH-CAMELLIA-256-CBC-SHA256', 'TLS-DHE-DSS-WITH-SEED-CBC-SHA', |
| 228 |
'TLS-DHE-DSS-WITH-ARIA-128-CBC-SHA256', 'TLS-DHE-DSS-WITH-ARIA-256-CBC-SHA384', 'TLS-ECDHE-RSA-WITH-ARIA-128-CBC-SHA256', |
| 229 |
'TLS-ECDHE-RSA-WITH-ARIA-256-CBC-SHA384', 'TLS-ECDHE-ECDSA-WITH-ARIA-128-CBC-SHA256', 'TLS-ECDHE-ECDSA-WITH-ARIA-256-CBC-SHA384', |
| 230 |
'TLS-DHE-DSS-WITH-3DES-EDE-CBC-SHA', 'TLS-DHE-DSS-WITH-DES-CBC-SHA', 'TLS-AES-128-GCM-SHA256', 'TLS-AES-256-GCM-SHA384', |
| 231 |
'TLS-CHACHA20-POLY1305-SHA256', 'TLS-ECDHE-ECDSA-WITH-AES-256-CBC-SHA' |
| 232 |
], |
| 233 |
'type': 'str' |
| 234 |
}, |
| 235 |
'priority': {'required': True, 'type': 'int'}, |
| 236 |
'versions': {'type': 'list', 'choices': ['ssl-3.0', 'tls-1.0', 'tls-1.1', 'tls-1.2', 'tls-1.3'], 'elements': 'str'} |
| 237 |
} |
| 238 |
} |
| 239 |
} |
| 240 |
|
| 241 |
module_option_spec = get_module_arg_spec('full crud') |
| 242 |
module_arg_spec.update(module_option_spec) |
| 243 |
check_galaxy_version(module_arg_spec) |
| 244 |
module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'firewall_vip6_sslserverciphersuites'), |
| 245 |
supports_check_mode=True) |
| 246 |
if not module._socket_path: |
| 247 |
module.fail_json(msg='MUST RUN IN HTTPAPI MODE') |
| 248 |
connection = Connection(module._socket_path) |
| 249 |
fmgr = NAPIManager('full crud', module_arg_spec, urls_list, |
| 250 |
'priority', 'data', module, connection) |
| 251 |
fmgr.process_crud() |
| 252 |
module.exit_json(meta=module.params) |
| 253 |
|
| 254 |
|
| 255 |
if __name__ == '__main__': |
| 256 |
main() |