koris package

Submodules

koris.cli module

cli.py

misc functions to interact with the cluster, usually called from other classes.

Don’t use directly

koris.cli.confirm(force)[source]

Asks the user for confirmation.

koris.cli.remove_cluster(config, nova, neutron, cinder, conn)[source]

Delete a cluster from OpenStack

koris.cli.write_kubeconfig(cluster_name, lb_ip, lb_port, ca_cert, client_cert, client_key)[source]

Write a kubeconfig file to the filesystem

koris.ssl module

ssl.py hold all ssl certifcates creation utilities and classes

class koris.ssl.CertBundle(key, cert)[source]

Bases: object

a simple class to hold a certifacte data with its own key

classmethod create_signed(ca_bundle, country, state, locality, orga, unit, name, hosts, ips, key_usage=[True, False, True, False, False, False, False, False, False])[source]

create a sign certificate

classmethod read_bundle(key, cert)[source]

read a certificate bundle from file system

save(name, directory, key_suffix='-key.pem', cert_suffix='.pem')[source]

save a certificate bundle to the file system

koris.ssl.b64_cert(cert)[source]

encode public bytes of a cert to base64

koris.ssl.b64_key(key)[source]

encode private bytes of a key to base64

koris.ssl.create_ca(private_key, public_key, country, state_province, locality, orga, unit, name, key_usage=[True, False, True, False, False, True, False, False, False])[source]

create a CA signed with private_key

Parameters:
  • private_key (inst) – private key instance to sign the CA
  • public_key (inst) – public key for the CSR
  • country (str) – the country for the CSR
  • state_province (str) – the state or province for the CSR
  • locality (str) – the locality for the CSR
  • orga (str) – the organization for the CSR
  • unit (str) – the unit for the CSR
  • name (str) – the name for the CSR
  • key_usage (list) – Key Usage parameters. Indices stand for: [digital_signature, content_commitment, key_encipherment, data_encipherment, key_agreement, key_cert_sign, crl_sign, encipher_only, decipher_only]
Returns:

ssl certificate object

koris.ssl.create_certificate(ca_bundle, public_key, country, state_province, locality, orga, unit, name, hosts=None, ips=None, key_usage=[True, False, True, False, False, False, False, False, False])[source]

create a certificate signed with CA private_key

Parameters:
  • ca_bundle (inst) – private key instance to sign the CA
  • public_key (inst) – public key for the CSR
  • country (str) – the country for the CSR
  • state_province (str) – the state or province for the CSR
  • locality (str) – the locality for the CSR
  • orga (str) – the organization for the CSR
  • unit (str) – the unit for the CSR
  • name (str) – the name for the CSR
  • key_usage (list) – Key Usage parameters. Indices stand for: [digital_signature, content_commitment, key_encipherment, data_encipherment, key_agreement, key_cert_sign, crl_sign, encipher_only, decipher_only]
Returns:

ssl certificate object

koris.ssl.create_certs(config, names, ips, write=True, ca_bundle=None)[source]

create new certificates, useful for replacing certificates and later for adding nodes …

koris.ssl.create_key(size=2048, public_exponent=65537)[source]

Create an RSA private key

Parameters:
  • size (int) –
  • public_exponent (int) –
Returns:

rsa key object instance

koris.ssl.discovery_hash(cert)[source]

calculate a discovery hash based on the cert’s public key

koris.ssl.read_cert(cert)[source]

read SSL certificate from path

Parameters:cert (str) –
Returns:cert (inst) - a certificate instance
koris.ssl.read_key(key)[source]

read SSL key from path

Parameters:key (str) –
Returns:private_key (inst) - a private key instance
koris.ssl.write_cert(cert, filename)[source]

Write the certifiacte instance to the file as ASCII string

Parameters:
  • cert (SSL certificate instance) –
  • filename (str) – the file to write
koris.ssl.write_key(key, passwd=None, filename='key.pem')[source]

Write the key instance to the file as ASCII string :param key: :type key: SSL key instance :param passwd: if given the key will be protected with this password :type passwd: str :param filename: the file to write :type filename: str