generate a non CA key and certificate key pair signed by the private
    CA key and crt.
    :param filename: prefix for the key and cert file
    :param dirname: name of the directory
    :param days: days of the certificate being valid
    :ip_list: a list of ip address to be included in the certificate
    :dns_list: a list of dns names to be included in the certificate
    :ca_key: file path to the CA key
    :ca_crt: file path to the CA crt
    :param silent: whether to suppress output

def gen_non_ca_cert(filename, dirname, days, ip_list, dns_list,
                    ca_crt, ca_key, silent=False):
    """
    generate a non CA key and certificate key pair signed by the private
    CA key and crt.
    :param filename: prefix for the key and cert file
    :param dirname: name of the directory
    :param days: days of the certificate being valid
    :ip_list: a list of ip address to be included in the certificate
    :dns_list: a list of dns names to be included in the certificate
    :ca_key: file path to the CA key
    :ca_crt: file path to the CA crt
    :param silent: whether to suppress output
    """
    key_file = os.path.join(dirname, '{}.key'.format(filename))
    req = os.path.join(dirname, '{}.csr'.format(filename))
    crt = os.path.join(dirname, '{}.crt'.format(filename))
    gen_private_key(key_file, silent)
    alt_names = []

    for ind, ip in enumerate(ip_list):
        alt_names.append('IP.{} = {}'.format(ind + 1, ip))
    for ind, dns in enumerate(dns_list):
        alt_names.append('DNS.{} = {}'.format(ind + 1, dns))

    conf = tempfile.mktemp()
    open(conf, 'w').write(SUBJECT_ALT_NAME + '\n'.join(alt_names))
    gen_cert_request(req, key_file, conf, silent)
    sign_cert_request(crt, req, ca_crt, ca_key, days, conf, silent)