Exemple #1
0
def _vserver_sslcert_get_all(v_name, **connection_args):
    ret = None
    nitro = _connect(**connection_args)
    if nitro is None:
        return None
    sslcert = NSSSLVServerSSLCertKeyBinding()
    sslcert.set_vservername(v_name)
    try:
        ret = NSSSLVServerSSLCertKeyBinding.get(nitro, sslcert)
    except NSNitroError, e:
        log.debug('netscaler module error - NSSSLVServerSSLCertKeyBinding.get() failed: {0}'.format(e.message))
Exemple #2
0
def vserver_sslcert_delete(v_name, sc_name, **connection_args):
    '''
    Unbinds a SSL certificate from a vserver

    CLI Example:

    .. code-block:: bash

        salt '*' netscaler.vserver_sslcert_delete 'vserverName' 'sslCertificateName'
    '''
    ret = True
    if not vserver_sslcert_exists(v_name, sc_name, **connection_args):
        return False
    nitro = _connect(**connection_args)
    if nitro is None:
        return False
    sslcert = NSSSLVServerSSLCertKeyBinding()
    sslcert.set_vservername(v_name)
    sslcert.set_certkeyname(sc_name)
    try:
        NSSSLVServerSSLCertKeyBinding.delete(nitro, sslcert)
    except NSNitroError as e:
        log.debug(
            'netscaler module error - NSSSLVServerSSLCertKeyBinding.delete() failed: {0}'
            .format(e.message))
        ret = False
    _disconnect(nitro)
    return ret
Exemple #3
0
def _vserver_sslcert_get(v_name, sc_name, **connection_args):
    ret = None
    nitro = _connect(**connection_args)
    if nitro is None:
        return None
    sslcert = NSSSLVServerSSLCertKeyBinding()
    sslcert.set_vservername(v_name)
    try:
        sslcerts = NSSSLVServerSSLCertKeyBinding.get(nitro, sslcert)
    except NSNitroError, e:
        log.debug(
            'netscaler module error - NSSSLVServerSSLCertKeyBinding.get() failed: {0}'
            .format(e.message))
        return None
Exemple #4
0
def vserver_sslcert_add(v_name, sc_name, **connection_args):
    """
    Binds a SSL certificate to a vserver

    CLI Example:

    .. code-block:: bash

        salt '*' netscaler.vserver_sslcert_add 'vserverName' 'sslCertificateName'
    """
    ret = True
    if vserver_sslcert_exists(v_name, sc_name, **connection_args):
        return False
    nitro = _connect(**connection_args)
    if nitro is None:
        return False
    sslcert = NSSSLVServerSSLCertKeyBinding()
    sslcert.set_vservername(v_name)
    sslcert.set_certkeyname(sc_name)
    try:
        NSSSLVServerSSLCertKeyBinding.add(nitro, sslcert)
    except NSNitroError as error:
        log.debug(
            "netscaler module error - NSSSLVServerSSLCertKeyBinding.add() failed: %s",
            error,
        )
        ret = False
    _disconnect(nitro)
    return ret
Exemple #5
0
def _vserver_sslcert_get(v_name, sc_name, **connection_args):
    ret = None
    nitro = _connect(**connection_args)
    if nitro is None:
        return None
    sslcert = NSSSLVServerSSLCertKeyBinding()
    sslcert.set_vservername(v_name)
    try:
        sslcerts = NSSSLVServerSSLCertKeyBinding.get(nitro, sslcert)
    except NSNitroError as error:
        log.debug("netscaler module error - NSSSLVServerSSLCertKeyBinding.get() failed: {0}".format(error))
        return None
    for sslcert in sslcerts:
        if sslcert.get_certkeyname() == sc_name:
            ret = sslcert
    return ret
Exemple #6
0
def vserver_sslcert_delete(v_name, sc_name, **connection_args):
    """
    Unbinds a SSL certificate from a vserver

    CLI Example:

    .. code-block:: bash

        salt '*' netscaler.vserver_sslcert_delete 'vserverName' 'sslCertificateName'
    """
    ret = True
    if not vserver_sslcert_exists(v_name, sc_name, **connection_args):
        return False
    nitro = _connect(**connection_args)
    if nitro is None:
        return False
    sslcert = NSSSLVServerSSLCertKeyBinding()
    sslcert.set_vservername(v_name)
    sslcert.set_certkeyname(sc_name)
    try:
        NSSSLVServerSSLCertKeyBinding.delete(nitro, sslcert)
    except NSNitroError as error:
        log.debug("netscaler module error - NSSSLVServerSSLCertKeyBinding.delete() failed: {0}".format(error))
        ret = False
    _disconnect(nitro)
    return ret
Exemple #7
0
def vserver_sslcert_add(v_name, sc_name, **connection_args):
    '''
    Binds a SSL certificate to a vserver

    CLI Example:

    .. code-block:: bash

        salt '*' netscaler.vserver_sslcert_add 'vserverName' 'sslCertificateName'
    '''
    ret = True
    if vserver_sslcert_exists(v_name, sc_name, **connection_args):
        return False
    nitro = _connect(**connection_args)
    if nitro is None:
        return False
    sslcert = NSSSLVServerSSLCertKeyBinding()
    sslcert.set_vservername(v_name)
    sslcert.set_certkeyname(sc_name)
    try:
        NSSSLVServerSSLCertKeyBinding.add(nitro, sslcert)
    except NSNitroError as e:
        log.debug('netscaler module error - NSSSLVServerSSLCertKeyBinding.add() failed: {0}'.format(e.message))
        ret = False
    _disconnect(nitro)
    return ret
Exemple #8
0
def _vserver_sslcert_get(v_name, sc_name, **connection_args):
    ret = None
    nitro = _connect(**connection_args)
    if nitro is None:
        return None
    sslcert = NSSSLVServerSSLCertKeyBinding()
    sslcert.set_vservername(v_name)
    try:
        sslcerts = NSSSLVServerSSLCertKeyBinding.get(nitro, sslcert)
    except NSNitroError as error:
        log.debug('netscaler module error - NSSSLVServerSSLCertKeyBinding.get() failed: %s', error)
        return None
    for sslcert in sslcerts:
        if sslcert.get_certkeyname() == sc_name:
            ret = sslcert
    return ret
Exemple #9
0
def bindcsvstocert_delete(csvs_name, cert_name, **connection_args):
    """
    Bind cert to a csvs
    CLI Example:
    .. code-block:: bash
        salt '*' netscaler.bindcsvstocert_delete 'csvsname' 'certName'
    """
    ret = True
    nitro = _connect(**connection_args)
    if nitro is None:
        return False
    csvspol = NSSSLVServerSSLCertKeyBinding()
    csvspol.set_vservername(csvs_name)
    csvspol.set_certkeyname(cert_name)
    try:
        NSSSLVServerSSLCertKeyBinding.delete(nitro, csvspol)
    except NSNitroError as error:
        log.debug(
            "netscaler module error - NSSSLVServerSSLCertKeyBinding.delete() failed: %s",
            error)
        ret = False
    _disconnect(nitro)
    return ret