Package pulp :: Package server :: Package auth :: Module cert_generator
[hide private]
[frames] | no frames]

Module cert_generator

source code

Functions [hide private]
string
make_admin_user_cert(user)
Generates a x509 certificate for an admin user.
source code
string
make_cert(uid)
Generate an x509 certificate with the Subject set to the uid passed into this method: Subject: CN=someconsumer.example.com
source code
boolean
verify_cert(cert_pem)
Ensures the given certificate can be verified against the server's CA.
source code
string
encode_admin_user(user)
Encodes an admin user's identity into a single line suitable for identification.
source code
boolean
is_admin_user(encoded_string)
Indicates if the encoded user string represents an admin user.
source code
(string, string)
decode_admin_user(encoded_string)
Decodes the single line admin user identification produced by encode_admin_user into all of the parts that make up that identification.
source code
 
_make_priv_key() source code
 
_make_cert_request(uid, rsa) source code
Variables [hide private]
  log = logging.getLogger(__name__)
  ADMIN_PREFIX = 'admin:'
  ADMIN_SPLITTER = ':'
Function Details [hide private]

make_admin_user_cert(user)

source code 

Generates a x509 certificate for an admin user.

Parameters:
  • user (pulp.server.db.model.User) - identification the certificate will be created for; may not be None
Returns: string
PEM encoded string

make_cert(uid)

source code 

Generate an x509 certificate with the Subject set to the uid passed into this method: Subject: CN=someconsumer.example.com

Parameters:
  • uid (string) - ID to be embedded in the certificate
Returns: string
X509 PEM encoded certificate string

verify_cert(cert_pem)

source code 

Ensures the given certificate can be verified against the server's CA.

Parameters:
  • cert_pem (string) - PEM encoded certificate to be verified
Returns: boolean
True if the certificate is successfully verified against the CA; False otherwise

encode_admin_user(user)

source code 

Encodes an admin user's identity into a single line suitable for identification. This is intended to be the identity used in admin certificates.

Parameters:
  • user (pulp.server.db.model.User) - admin user; may not be None
Returns: string
single line identification of the admin user safe for public visibility; any sensitive information is hashed

is_admin_user(encoded_string)

source code 

Indicates if the encoded user string represents an admin user. If the string is identified as an admin user, it can be parsed with decode_admin_user.

Returns: boolean
True if the user string represents an admin user; False otherwise

decode_admin_user(encoded_string)

source code 

Decodes the single line admin user identification produced by encode_admin_user into all of the parts that make up that identification.

Parameters:
  • encoded_string (string) - string representation of the user provided by encode_admin_user
Returns: (string, string)
tuple of information describing the admin user; (username, id)