Пример #1
0
def main():
    endpoint = "reverse_proxy/location"
    key_to_check_for_changes = [
        "access_control", "allowed_networks", "auth_profile", "backend",
        "be_path", "comment", "denied_networks", "hot_standby", "path",
        "status", "stickysession_id", "stickysession_status",
        "websocket_passthrough"
    ]
    module = UTMModule(argument_spec=dict(
        name=dict(type='str', required=True),
        access_control=dict(
            type='str', required=False, default="0", choices=['0', '1']),
        allowed_networks=dict(type='list',
                              elements='str',
                              required=False,
                              default=['REF_NetworkAny']),
        auth_profile=dict(type='str', required=False, default=""),
        backend=dict(type='list', elements='str', required=False, default=[]),
        be_path=dict(type='str', required=False, default=""),
        comment=dict(type='str', required=False, default=""),
        denied_networks=dict(
            type='list', elements='str', required=False, default=[]),
        hot_standby=dict(type='bool', required=False, default=False),
        path=dict(type='str', required=False, default="/"),
        status=dict(type='bool', required=False, default=True),
        stickysession_id=dict(type='str', required=False, default='ROUTEID'),
        stickysession_status=dict(type='bool', required=False, default=False),
        websocket_passthrough=dict(type='bool', required=False, default=False),
    ))
    try:
        UTM(module, endpoint, key_to_check_for_changes).execute()
    except Exception as e:
        module.fail_json(msg=to_native(e))
Пример #2
0
def main():
    endpoint = "reverse_proxy/exception"
    key_to_check_for_changes = [
        "op", "path", "skip_custom_threats_filters",
        "skip_threats_filter_categories", "skipav", "comment",
        "skipbadclients", "skipcookie", "skipform", "status",
        "skipform_missingtoken", "skiphtmlrewrite", "skiptft", "skipurl",
        "source"
    ]
    module = UTMModule(argument_spec=dict(
        name=dict(type='str', required=True),
        op=dict(
            type='str', required=False, default='AND', choices=['AND', 'OR']),
        path=dict(type='list', elements='string', required=False, default=[]),
        skip_custom_threats_filters=dict(
            type='list', elements='string', required=False, default=[]),
        skip_threats_filter_categories=dict(
            type='list', elements='string', required=False, default=[]),
        skipav=dict(type='bool', required=False, default=False),
        skipbadclients=dict(type='bool', required=False, default=False),
        skipcookie=dict(type='bool', required=False, default=False),
        skipform=dict(type='bool', required=False, default=False),
        skipform_missingtoken=dict(type='bool', required=False, default=False),
        skiphtmlrewrite=dict(type='bool', required=False, default=False),
        skiptft=dict(type='bool', required=False, default=False),
        skipurl=dict(type='bool', required=False, default=False),
        source=dict(type='list', elements='string', required=False,
                    default=[]),
        status=dict(type='bool', required=False, default=True),
    ))
    try:
        UTM(module, endpoint, key_to_check_for_changes).execute()
    except Exception as e:
        module.fail_json(msg=to_native(e))
def main():
    endpoint = "aaa/group"
    key_to_check_for_changes = []
    module = UTMModule(argument_spec=dict(
        name=dict(type='str', required=True)))
    try:
        UTM(module, endpoint, key_to_check_for_changes,
            info_only=True).execute()
    except Exception as e:
        module.fail_json(msg=to_native(e))
def main():
    endpoint = "ca/host_key_cert"
    key_to_check_for_changes = []
    module = UTMModule(
        argument_spec=dict(
            name=dict(type='str', required=True)
        )
    )
    try:
        # This is needed because the bool value only accepts int values in the backend
        UTM(module, endpoint, key_to_check_for_changes, info_only=True).execute()
    except Exception as e:
        module.fail_json(msg=to_native(e))
def main():
    endpoint = "network/interface_address"
    key_to_check_for_changes = ["comment", "address"]
    module = UTMModule(argument_spec=dict(
        name=dict(type='str', required=True),
        address=dict(type='str', required=True),
        comment=dict(type='str', required=False, default=""),
        address6=dict(type='str', required=False),
        resolved=dict(type='boolean', required=False),
        resolved6=dict(type='boolean', required=False)))
    try:
        UTM(module, endpoint, key_to_check_for_changes).execute()
    except Exception as e:
        module.fail_json(msg=to_native(e))
def main():
    endpoint = "reverse_proxy/frontend"
    key_to_check_for_changes = [
        "add_content_type_header", "address", "allowed_networks",
        "certificate", "comment", "disable_compression", "domain",
        "exceptions", "htmlrewrite", "htmlrewrite_cookies", "implicitredirect",
        "lbmethod", "locations", "port", "preservehost", "profile", "status",
        "type", "xheaders"
    ]
    module = UTMModule(argument_spec=dict(
        name=dict(type='str', required=True),
        add_content_type_header=dict(
            type='bool', required=False, default=False),
        address=dict(
            type='str', required=False, default="REF_DefaultInternalAddress"),
        allowed_networks=dict(type='list',
                              elements='str',
                              required=False,
                              default=["REF_NetworkAny"]),
        certificate=dict(type='str', required=False, default=""),
        comment=dict(type='str', required=False, default=""),
        disable_compression=dict(type='bool', required=False, default=False),
        domain=dict(type='list', elements='str', required=False),
        exceptions=dict(
            type='list', elements='str', required=False, default=[]),
        htmlrewrite=dict(type='bool', required=False, default=False),
        htmlrewrite_cookies=dict(type='bool', required=False, default=False),
        implicitredirect=dict(type='bool', required=False, default=False),
        lbmethod=dict(type='str',
                      required=False,
                      default="bybusyness",
                      choices=['bybusyness', 'bytraffic', 'byrequests', '']),
        locations=dict(type='list', elements='str', required=False,
                       default=[]),
        port=dict(type='int', required=False, default=80),
        preservehost=dict(type='bool', required=False, default=False),
        profile=dict(type='str', required=False, default=""),
        status=dict(type='bool', required=False, default=True),
        type=dict(type='str',
                  required=False,
                  default="http",
                  choices=['http', 'https']),
        xheaders=dict(type='bool', required=False, default=False),
    ))
    try:
        UTM(module, endpoint, key_to_check_for_changes).execute()
    except Exception as e:
        module.fail_json(msg=to_native(e))
Пример #7
0
def main():
    endpoint = "ca/host_key_cert"
    key_to_check_for_changes = [
        "ca", "certificate", "comment", "encrypted", "key", "meta"
    ]
    module = UTMModule(argument_spec=dict(
        name=dict(type='str', required=True),
        ca=dict(type='str', required=True),
        meta=dict(type='str', required=True),
        certificate=dict(type='str', required=True),
        comment=dict(type='str', required=False),
        encrypted=dict(type='bool', required=False, default=False),
        key=dict(type='str', required=False, no_log=True),
    ))
    try:
        # This is needed because the bool value only accepts int values in the backend
        UTM(module, endpoint, key_to_check_for_changes).execute()
    except Exception as e:
        module.fail_json(msg=to_native(e))
Пример #8
0
def main():
    endpoint = "network/dns_host"
    key_to_check_for_changes = ["comment", "hostname", "interface"]
    module = UTMModule(
        argument_spec=dict(
            name=dict(type='str', required=True),
            address=dict(type='str', required=False, default='0.0.0.0'),
            address6=dict(type='str', required=False, default='::'),
            comment=dict(type='str', required=False, default=""),
            hostname=dict(type='str', required=False),
            interface=dict(type='str', required=False, default=""),
            resolved=dict(type='bool', required=False, default=False),
            resolved6=dict(type='bool', required=False, default=False),
            timeout=dict(type='int', required=False, default=0),
        )
    )
    try:
        UTM(module, endpoint, key_to_check_for_changes).execute()
    except Exception as e:
        module.fail_json(msg=to_native(e))
def main():
    endpoint = "aaa/group"
    key_to_check_for_changes = [
        "comment", "adirectory_groups", "adirectory_groups_sids",
        "backend_match", "dynamic", "edirectory_groups", "ipsec_dn",
        "ldap_attribute", "ldap_attribute_value", "members", "network",
        "radius_groups", "tacacs_groups"
    ]
    module = UTMModule(argument_spec=dict(
        name=dict(type='str', required=True),
        adirectory_groups=dict(
            type='list', elements='str', required=False, default=[]),
        adirectory_groups_sids=dict(type='dict', required=False, default={}),
        backend_match=dict(type='str',
                           required=False,
                           default="none",
                           choices=[
                               "none", "adirectory", "edirectory", "radius",
                               "tacacs", "ldap"
                           ]),
        comment=dict(type='str', required=False, default=""),
        dynamic=dict(type='str',
                     required=False,
                     default="none",
                     choices=["none", "ipsec_dn", "directory_groups"]),
        edirectory_groups=dict(
            type='list', elements='str', required=False, default=[]),
        ipsec_dn=dict(type='str', required=False, default=""),
        ldap_attribute=dict(type='str', required=False, default=""),
        ldap_attribute_value=dict(type='str', required=False, default=""),
        members=dict(type='list', elements='str', required=False, default=[]),
        network=dict(type='str', required=False, default=""),
        radius_groups=dict(
            type='list', elements='str', required=False, default=[]),
        tacacs_groups=dict(
            type='list', elements='str', required=False, default=[]),
    ))
    try:
        UTM(module, endpoint, key_to_check_for_changes).execute()
    except Exception as e:
        module.fail_json(msg=to_native(e))
def main():
    endpoint = "reverse_proxy/auth_profile"
    key_to_check_for_changes = [
        "aaa", "basic_prompt", "backend_mode", "backend_strip_basic_auth",
        "backend_user_prefix", "backend_user_suffix", "comment",
        "frontend_cookie", "frontend_cookie_secret", "frontend_form",
        "frontend_form_template", "frontend_login", "frontend_logout",
        "frontend_mode", "frontend_realm",
        "frontend_session_allow_persistency", "frontend_session_lifetime",
        "frontend_session_lifetime_limited", "frontend_session_lifetime_scope",
        "frontend_session_timeout", "frontend_session_timeout_enabled",
        "frontend_session_timeout_scope", "logout_delegation_urls",
        "logout_mode", "redirect_to_requested_url"
    ]

    module = UTMModule(argument_spec=dict(
        name=dict(type='str', required=True),
        aaa=dict(type='list', elements='str', required=True),
        basic_prompt=dict(type='str', required=True),
        backend_mode=dict(type='str',
                          required=False,
                          default="None",
                          choices=['Basic', 'None']),
        backend_strip_basic_auth=dict(
            type='bool', required=False, default=True, choices=[True, False]),
        backend_user_prefix=dict(type='str', required=False, default=""),
        backend_user_suffix=dict(type='str', required=False, default=""),
        comment=dict(type='str', required=False, default=""),
        frontend_cookie=dict(type='str', required=False),
        frontend_cookie_secret=dict(type='str', required=False),
        frontend_form=dict(type='str', required=False),
        frontend_form_template=dict(type='str', required=False, default=""),
        frontend_login=dict(type='str', required=False),
        frontend_logout=dict(type='str', required=False),
        frontend_mode=dict(type='str',
                           required=False,
                           default="Basic",
                           choices=['Basic', 'Form']),
        frontend_realm=dict(type='str', required=False),
        frontend_session_allow_persistency=dict(
            type='bool', required=False, default=False, choices=[True, False]),
        frontend_session_lifetime=dict(type='int', required=True),
        frontend_session_lifetime_limited=dict(
            type='bool', required=False, default=True, choices=[True, False]),
        frontend_session_lifetime_scope=dict(
            type='str',
            required=False,
            default="hours",
            choices=['days', 'hours', 'minutes']),
        frontend_session_timeout=dict(type='int', required=True),
        frontend_session_timeout_enabled=dict(
            type='bool', required=False, default=True, choices=[True, False]),
        frontend_session_timeout_scope=dict(
            type='str',
            required=False,
            default="minutes",
            choices=['days', 'hours', 'minutes']),
        logout_delegation_urls=dict(
            type='list', elements='str', required=False, default=[]),
        logout_mode=dict(type='str',
                         required=False,
                         default="None",
                         choices=['None', 'Delegation']),
        redirect_to_requested_url=dict(
            type='bool', required=False, default=False, choices=[True, False
                                                                 ])))
    try:
        UTM(module, endpoint, key_to_check_for_changes).execute()
    except Exception as e:
        module.fail_json(msg=to_native(e))